Re: Gaps in PK sequence numbers [RESOLVED]

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Gaps in PK sequence numbers [RESOLVED]
Date: 2024-06-11 12:28:45
Message-ID: 92fc77dd-8b98-2810-107b-aac4795191d5@appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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', (select max(pk) from t));
> That form of setval() sets the sequence so that the next value will be one
> more than the value you set it to, so you don't have to do max()+1 there.

Thanks again, Christophe.

Regards,

Rich

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dominique Devienne 2024-06-11 15:05:57 Unexpected Backend PID reported by Notification
Previous Message hubert depesz lubaczewski 2024-06-11 11:33:44 Re: Does trigger only accept functions?