Re: Automatic PK values not added to new rows - Mailing list pgsql-general

From David G. Johnston
Subject Re: Automatic PK values not added to new rows
Date
Msg-id CAKFQuwZeb8y-p9kXzPhACZVGZYXjKvz22B+Tk7H3w+d20HTA3Q@mail.gmail.com
Whole thread Raw
In response to Automatic PK values not added to new rows  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Automatic PK values not added to new rows
List pgsql-general
On Wednesday, May 25, 2022, Rich Shepard <rshepard@appl-ecosys.com> wrote:

I'm trying to insert 15 new rows to that table by inserting all columns
except the first one..

That…
 

person_nbr 683 is not in any row to be inserted.

Implies that.
 

I was under the impression that the person_nbr for the new rows would start
with 966 but that's apparently not happening.

The value the sequence provides next is wholly independent of everything except the state of the sequence.  It doesn’t care how many rows any table, even its owner, has.  The very existence of the delete command should make this self-evident.

David J.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Automatic PK values not added to new rows
Next
From: Bryn Llewellyn
Date:
Subject: Re: "Join Postgres on Slack" ?