Re: duplicate key value violates unique constraint

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: duplicate key value violates unique constraint
Date: 2020-03-07 21:13:26
Message-ID: e4c5d934-038b-735b-ba53-88844ae7ed15@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general


Asking the same question on multiple lists is strongly frowned upon.

On 3/7/20 1:29 PM, Ashkar Dev wrote:
> Hi all,
>
> how to fix a problem, suppose there is a table with id and username
>
> if I set the id to bigint so the limit is 9223372036854775807
> if I insert for example 3 rows
> id    username
> --    --------------
> 1     abc
> 2     def
> 3     ghi
>
> if I delete all rows and insert one another it is like
>
> id    username
> --    --------------
> 4     jkl
>
>
> So it doesn't start again from non-available id 1, so what is needed to do
> to make the new inserts go into non-available id numbers?

--
Angular momentum makes the world go 'round.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Chris Kim 2020-03-10 17:38:25 Re: Autovacuum/Analyze Doesn't seem to be running properly
Previous Message Adrian Klaver 2020-03-07 20:28:05 Re: duplicate key value violates unique constraint

Browse pgsql-general by date

  From Date Subject
Next Message Tiffany Thang 2020-03-07 22:35:51 Re: Restrict user to create only one db with a specific name
Previous Message Adrian Klaver 2020-03-07 20:28:05 Re: duplicate key value violates unique constraint