Re: Duplicate Key Values - Mailing list pgsql-general

From mark bradley
Subject Re: Duplicate Key Values
Date
Msg-id SJ2PR22MB4328C3D2704FB8F6CD079924BAD12@SJ2PR22MB4328.namprd22.prod.outlook.com
Whole thread Raw
In response to Re: Duplicate Key Values  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Duplicate Key Values
Re: Duplicate Key Values
Re: Duplicate Key Values
List pgsql-general
An "interesting" effect of reindexing is that all the records that were dups in the nodes table were deleted, both copies.

Also, all rows having node_id as a foreign key in other tables were deleted, which means all rows in these tables were deleted.

Fortunately these are not huge tables.  I will reenter the data, make a backup, and then try your further extended suggestions.  

Best regards,
Mark Brady

From: Adrian Klaver <adrian.klaver@aklaver.com>
Sent: Friday, March 7, 2025 3:25 PM
To: mark bradley <markbradyju@outlook.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Duplicate Key Values
 
On 3/7/25 11:47, mark bradley wrote:
> Wouldn't that be nice 🙂

No, because you would end up with a mess.

My AI rant:

AI is neither artificial or intelligent. It is human code that pattern
matches and then throws the matches against the wall and hope something
sticks. It is left to the human to clean up.

At any rate, in this post:

https://www.postgresql.org/message-id/75b33741-ee99-4524-b63a-edad21c1266d%40aklaver.com

You where provided an answer, which is further extended here:

https://www.postgresql.org/message-id/CAKAnmm%2BBBBaXGN2xPHhXywkwb72UWzinWu2wQ5WadcMw3_57rQ%40mail.gmail.com

>
>
> Best regards,
> Mark Brady
> _amazon.com/author/markjbrady <https://amazon.com/author/markjbrady>_
> ------------------------------------------------------------------------
> *From:* Adrian Klaver <adrian.klaver@aklaver.com>
> *Sent:* Friday, March 7, 2025 10:55 AM
> *To:* mark bradley <markbradyju@outlook.com>
> *Cc:* pgsql-general <pgsql-general@postgresql.org>
> *Subject:* Re: Duplicate Key Values
> On 3/7/25 06:34, mark bradley wrote:
>> This is what MS Copilot has to say about this apparent bug where
>> Postgres inserts extra rows violating a primary keys uniqueness constraint:
>
>
>
>> What to do?  I hesitate to just delete my tables and start over because
>> this error will reoccur.
>
> Let the AI solve it.
>
>>
>> Best regards,
>> Mark Brady
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

--
Adrian Klaver
adrian.klaver@aklaver.com

pgsql-general by date:

Previous
From: Achilleas Mantzios - cloud
Date:
Subject: Re: exclusion constraint question
Next
From: Greg Sabino Mullane
Date:
Subject: Re: exclusion constraint question