Re: Reset sequence to current maximum value of rows

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Rich Shepard <rshepard@appl-ecosys.com>
Cc: pgsql-general@lists.postgresql.org
Date: 2024-06-13T20:14:56Z
Lists: pgsql-general
On Thu, Jun 13, 2024 at 12:57 PM Rich Shepard <rshepard@appl-ecosys.com>
wrote:

> INSERT into companies (company_nbr,company_name,industry,status) VALUES
> (DEFAULT,'A new company name', 'Manufacturing',DEFAULT);
>
> Yesterday, before learning to use DEFAULT for the company_nbr PK I entered
> all rows using company_nbr 2342-2391. This morning, after running the
> single-line INSERT command company numbers from 2341-2392 all had 'A new
> company name' as the company_name.
>
>
There is no way, in the absence of a user trigger, that the above insert
command changed pre-existing rows.  And if you cannot reproduce the
behavior you claim to have seen I will continue to just assume you have
faulty memory.

David J.