Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ts0mT-00DDqX-D7 for pgsql-general@arkaria.postgresql.org; Tue, 11 Mar 2025 14:40:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ts0mR-00HTLC-FZ for pgsql-general@arkaria.postgresql.org; Tue, 11 Mar 2025 14:40:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ts0mR-00HTHC-2a for pgsql-general@lists.postgresql.org; Tue, 11 Mar 2025 14:40:27 +0000 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ts0mN-002FdA-0Z for pgsql-general@postgresql.org; Tue, 11 Mar 2025 14:40:26 +0000 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-7273f35b201so2982857a34.1 for ; Tue, 11 Mar 2025 07:40:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741704022; x=1742308822; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=Iwu3vwVec2ZTMbtTAJq1uzAVkODgNJb4/GQmMrACaVk=; b=ca/Mf87pw5OM9tEhMqF35CoWsZaa4QQWrYo3fDuCfKuMlqrNX+L2CmQ0rZ0yKIxSzj r6eqxBdskUXiWz1DZp76tRMN1Mk0Sdi5Zl7UB7zOXGpXHJyHsbb7MkMPtM/wyqfZOlOv uWRsl+/bcYTasvjDy4VIHGmTBL6Cc7hnM/HxWjA5giag20adMWyw8YS0cSParZU2FYUv jvAjwI3EvX5jwLepHIVadNsWCEVGXuYPLoDacSxCNOtnjubZIvC1uEnsUjnwdc8UgdSE y+zdeeFjLAEoubPAI0mJ+Qm9rUnvFxGOUtU8OblGez2nz83aDtH82mhSY3wJzYn78sht DRjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741704022; x=1742308822; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Iwu3vwVec2ZTMbtTAJq1uzAVkODgNJb4/GQmMrACaVk=; b=XrrjQOlvTtCysKODRR1GjndCsUPj9847OizJbZXHW0smkoluZkD+nXwqvOYghAtrEs GVmFc2qAeCiXqkmPl5XXdPGgGSbUAFWpSRQiv6jOBvnLBjR0bx0Y1UVBnVyaiSBiZqyn 43XzAvSmgJCToeuAkUEBvCAJvH+xqc9pG98RJa+hKsUj7my0/hkEAMhgoohi5MhGXREe 4XZT8ZCDTZHvES56jGTbnd2fUny1RlidXI19beLT/bN6em4NQ33Rl2qAbnSA45owczgZ bVAhDXsRzVRdV3QiAuW17UMuKEkCpKOp2t7eedl6HptkSeCTj0H//HazoQf5SIgHjOhM 0GXw== X-Gm-Message-State: AOJu0Ywi9QRKOx6y8iwZKhsXNg9IpSwbl3zwRf/YB4RH3NEoWFy4niZL HGA+YLac1rfh4pZKYNtT9lTeXBueiwvidxse/odjJsrJplFuCNYXEEB7zEoXJQ33B1cpnTTmOrM ftvxlAW9cjTcqtDhR56FH6WtLd22FcQ== X-Gm-Gg: ASbGnctCPsBbzxcap40WUpbcbEg0ahG38RN3kWJheTGkoGtnJcbOXGn8UScLkd5y3Rj d9WV+mWNPhvjMx+Dzckq10JVl9UQYm8UUYXNBmBIuMIO/hQIq/1sEOO7Vn9qAeHa95VYsf9ze8t 5ncqQFUwRAxlcJwS9H9dPrgzLgO6W5PA5syTLrWfVJdA04MlDaOttWlERZbxUt X-Google-Smtp-Source: AGHT+IE3iuOZxrNlTnA8O08Zp2tTaZlG+meGs5KYoEfW4qqPkqtUa5QPJhW4Lrts3eC0oiyzV4cXCr43UAetiz8mOQ0= X-Received: by 2002:a05:6808:118e:b0:3fa:3922:5fbe with SMTP id 5614622812f47-3fa39226245mr2045752b6e.5.1741704022028; Tue, 11 Mar 2025 07:40:22 -0700 (PDT) MIME-Version: 1.0 References: <36356aa1-1a5c-44af-a1c0-f190249812ca@aklaver.com> <6aee94f9-d421-4622-bccc-bdac37969be0@aklaver.com> <75b33741-ee99-4524-b63a-edad21c1266d@aklaver.com> <9d919848-3fe1-46fd-b343-c5f2931864f7@aklaver.com> <513ddbee-135c-4af2-b6f6-acca667b8d09@aklaver.com> In-Reply-To: From: Ron Johnson Date: Tue, 11 Mar 2025 10:40:11 -0400 X-Gm-Features: AQ5f1JrfjgmCiglES_4cYeRTEDt2sHMEcEJ__O0aOQnif60AUvh5TcIviagr4IY Message-ID: Subject: Re: Duplicate Key Values To: pgsql-general Content-Type: multipart/alternative; boundary="0000000000008979ef063012118a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000008979ef063012118a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Do you *currently* take regular backups? We'd be glad to show you how to take regular logical backups. On Tue, Mar 11, 2025 at 10:29=E2=80=AFAM mark bradley wrote: > 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 > *amazon.com/author/markjbrady * > ------------------------------ > *From:* Adrian Klaver > *Sent:* Friday, March 7, 2025 3:25 PM > *To:* mark bradley > *Cc:* pgsql-general > *Subject:* Re: Duplicate Key Values > > On 3/7/25 11:47, mark bradley wrote: > > Wouldn't that be nice =F0=9F=99=82 > > 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-edad21c1266= d%40aklaver.com > > You where provided an answer, which is further extended here: > > > https://www.postgresql.org/message-id/CAKAnmm%2BBBBaXGN2xPHhXywkwb72UWzin= Wu2wQ5WadcMw3_57rQ%40mail.gmail.com > > > > > > > Best regards, > > Mark Brady > > _amazon.com/author/markjbrady _ > > -----------------------------------------------------------------------= - > > *From:* Adrian Klaver > > *Sent:* Friday, March 7, 2025 10:55 AM > > *To:* mark bradley > > *Cc:* pgsql-general > > *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 becaus= e > >> 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 > > --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --0000000000008979ef063012118a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Do you currently=C2=A0take re= gular backups?

We'd be glad to show you how to= take regular logical=C2=A0backups.

On= Tue, Mar 11, 2025 at 10:29=E2=80=AFAM mark bradley <markbradyju@outlook.com> w= rote:
An "interesting" effect of reindexing is that all the records tha= t 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.=C2=A0 I will reenter the data, make = a backup, and then try your further extended suggestions.=C2=A0=C2=A0

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
=C2=A0
On 3/7/25 11:47, mark bradley wrote:
> Wouldn't that be nice =F0=9F=99=82

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/mess= age-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
> _ama= zon.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 <= br> >> Postgres inserts extra rows violating a primary keys uniqueness co= nstraint:
>
>
>
>> What to do?=C2=A0 I hesitate to just delete my tables and start ov= er because
>> this error will reoccur.
>
> Let the AI solve it.
>
>>
>> Best regards,
>> Mark Brady
>
>
> --
> Adrian Klaver
> adrian.= klaver@aklaver.com
>

--
Adrian Klaver
adrian.klave= r@aklaver.com



--
Death to <Redacted>, and butter sauce= .
Don't boil me, I'm still alive.
<Redacted>= lobster!
--0000000000008979ef063012118a--