Re: Gaps in PK sequence numbers [RESOLVED]

2024-06-11 Thread Rich Shepard
On Mon, 10 Jun 2024, Christophe Pettus wrote: The sequence functions are documented here: https://www.postgresql.org/docs/current/functions-sequence.html setval is the function you want. You can use a SELECT so you don't have to copy values around: select setval('t_pk_seq', (sele

Re: Gaps in PK sequence numbers [RESOLVED]

2024-06-10 Thread David G. Johnston
On Monday, June 10, 2024, Rich Shepard wrote: > > Is there a way to reset the sequence to the maximum > number +1? I don't recall seeing this in the postgres docs but will look > again. > https://www.postgresql.org/docs/current/functions-sequence.html setval The bigint argument can be compute

Re: Gaps in PK sequence numbers [RESOLVED]

2024-06-10 Thread Christophe Pettus
> On Jun 10, 2024, at 18:10, Rich Shepard wrote: > Thanks, Christophe. Is there a way to reset the sequence to the maximum > number +1? I don't recall seeing this in the postgres docs but will look > again. The sequence functions are documented here: https://www.postgresql.org/docs/cu

Re: Gaps in PK sequence numbers [RESOLVED]

2024-06-10 Thread Rich Shepard
On Mon, 10 Jun 2024, Christophe Pettus wrote: Strictly speaking, the sequence underlying nextval() has no idea what primary keys are or are not in use. It's just a transaction-ignoring counter that increases with each nextval() call. The only reason that you'd get duplicate key errors in this ca