Re: duplicate key value violates unique constraint

From: Ashkar Dev <ashkardev(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, dave(at)davebolt(dot)co(dot)uk, Pepe TD Vo <pepevo(at)yahoo(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: duplicate key value violates unique constraint
Date: 2020-03-07 20:21:32
Message-ID: CAHaowgV-bt-pe2_ezHeEXE=X0q0K7N8dAmBcgUuq=bQ56-wfSA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Thanks for answers.

On Sat, Mar 7, 2020 at 10:55 PM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Sat, Mar 7, 2020 at 12:35 PM Ashkar Dev <ashkardev(at)gmail(dot)com> wrote:
>
>>
>> Hi all,
>>
>> how to fix a problem, suppose there is a table with id and username
>>
>
> You should probably provide the definition though in this case it is
> self-evident that you are using bigserial.
>
>
>> 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?
>>
>
> Alter sequence
>
> https://www.postgresql.org/docs/12/sql-altersequence.html
>
>
>> and if the id reaches the limit and maybe there is some ids that are not
>> used.
>>
>
> This is highly unlikely.
>
> Is the subject line supposed to relate to this in some way?
>
> You should not worry about any of this in production; and frankly,
> worrying about it in development is largely pointless as well.
>
> There is no actual problem here to be fixed.
>
> David J.
>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Adrian Klaver 2020-03-07 20:28:05 Re: duplicate key value violates unique constraint
Previous Message David G. Johnston 2020-03-07 19:55:02 Re: duplicate key value violates unique constraint

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-03-07 20:28:05 Re: duplicate key value violates unique constraint
Previous Message David G. Johnston 2020-03-07 19:55:02 Re: duplicate key value violates unique constraint