Re: Automatic PK values not added to new rows

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Automatic PK values not added to new rows
Date: 2022-05-25 17:52:19
Message-ID: CAKFQuwZeb8y-p9kXzPhACZVGZYXjKvz22B+Tk7H3w+d20HTA3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday, May 25, 2022, Rich Shepard <rshepard(at)appl-ecosys(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bryn Llewellyn 2022-05-25 18:08:11 Re: "Join Postgres on Slack" ?
Previous Message Adrian Klaver 2022-05-25 17:45:53 Re: Automatic PK values not added to new rows