public inbox for [email protected]
help / color / mirror / Atom feedFrom: Alban Hertroys <[email protected]>
To: Rich Shepard <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Reset sequence to current maximum value of rows
Date: Fri, 14 Jun 2024 09:08:51 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<CAKFQuwba=vb16vR47W0oo3SirkJ+UqLEg5j9-fqe+vm=0Q7_qw@mail.gmail.com>
<[email protected]>
<CAKFQuwY4PXdUYWxWzZ+idD64GLA2vrKf_UDcSPf=5VuYSDNRUA@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
> company_nbr | company_name -------------+-------------------------------------------------
> 1 | Markowitz Herbold PC
> 2 | Markowitz Herbold PC
> 3 | Markowitz Herbold PC
> 4 | Markowitz Herbold PC
> 5 | Markowitz Herbold PC
> 6 | Markowitz Herbold PC
> 7 | Markowitz Herbold PC
> 8 | Markowitz Herbold PC
> 9 | Markowitz Herbold PC
> 10 | Markowitz Herbold PC
> 11 | Markowitz Herbold PC
> 12 | Markowitz Herbold PC
> 13 | Markowitz Herbold PC
> 14 | Markowitz Herbold PC
> 15 | Markowitz Herbold PC
> 16 | Markowitz Herbold PC
> 17 | Markowitz Herbold PC
> 18 | Markowitz Herbold PC
> 19 | Markowitz Herbold PC
> 20 | Markowitz Herbold PC
> 22 | Markowitz Herbold PC
> 23 | Markowitz Herbold PC
> --More--
Did those rows contain these values in some earlier transaction in your data-entry process perhaps? I’m thinking that perhaps you overwrote them in a later transaction with the correct values for the names, but forgot to commit that transaction?
It’s either that, or you did run an UPDATE statement against those rows without specifying a WHERE-clause, as others already suggested as a likely cause.
I think we can rule out the possibility of index corruption (a very rare occurrence, usually caused by factors external to PG) for your case. A data-set this limited would most likely result in an execution plan using a sequential scan instead of an index scan (an EXPLAIN ANALYZE of above select statement would show proof).
> It might be quicker for me to restore the entire database from that backup
> and then insert all new table rows since I have saved all the scripts.
If you end up in the same situation again after doing that, then you know at least it’s repeatable and can analyse how you got there.
Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.
view thread (10+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Reset sequence to current maximum value of rows
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox