Re: Reset sequence to current maximum value of rows - Mailing list pgsql-general

From David G. Johnston
Subject Re: Reset sequence to current maximum value of rows
Date
Msg-id CAKFQuwY-E_EuCHO+Q1o2Lc1d0r-TUp9f18UWRx1TtMEsLzDHvA@mail.gmail.com
Whole thread Raw
In response to Re: Reset sequence to current maximum value of rows  (Rich Shepard <rshepard@appl-ecosys.com>)
List pgsql-general
On Thu, Jun 13, 2024 at 3:13 PM Rich Shepard <rshepard@appl-ecosys.com> wrote:
Yes, I'm sure. Early yesterday I did get duplicate key errors. That's when I
looked on stackexchange to learn how to reset the sequence's max value to
the value of the number of rows in the table. Not only did my attempt to add
a single new company to the companies table change all company names in that
one industry to the new name, but I just discovered that it changed all rows
in that column to the new company name:


At present the belief there is a bug in PostgreSQL is unsubstantiated.

I suggest you look internally for how an update command that caused the resultant data could have been executed.  That is much more plausible, and thus a better use of time, if you want to spend more time on this, than trying to produce the observed behavior again using just insert and setval(...) commands.

David J.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Reset sequence to current maximum value of rows
Next
From: "Shenavai, Manuel"
Date:
Subject: Configure autovacuum