Re: Reset sequence to current maximum value of 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
Subject: Re: Reset sequence to current maximum value of rows
Date: 2024-06-13 22:29:01
Message-ID: CAKFQuwY-E_EuCHO+Q1o2Lc1d0r-TUp9f18UWRx1TtMEsLzDHvA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 13, 2024 at 3:13 PM Rich Shepard <rshepard(at)appl-ecosys(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shenavai, Manuel 2024-06-14 06:20:11 Configure autovacuum
Previous Message Adrian Klaver 2024-06-13 22:24:51 Re: Reset sequence to current maximum value of rows