Re: Duplicate Key Values - Mailing list pgsql-general

From Ron Johnson
Subject Re: Duplicate Key Values
Date
Msg-id CANzqJaCZefaoZqJzPSFqEaRA1W-Ps5E6yNuL_PT-WxUw9x38Nw@mail.gmail.com
Whole thread Raw
In response to Duplicate Key Values  (mark bradley <markbradyju@outlook.com>)
Responses Re: Duplicate Key Values
List pgsql-general
What does "and unique identifier" mean?

(Creating a Primary Key constraint automatically creates a unique no-nulls-allowed index on the column(s), so no other index is needed.)

Can you show the table definition?

Anyway, you should be able to delete one of the duplicate node_id records by specifying another column with a different value;

On Wed, Mar 5, 2025 at 6:14 PM mark bradley <markbradyju@outlook.com> wrote:
Hi Ron,

The key is an integer.  I'm using pGAdmin4 and recently updated to the latest version.

The records are not all identical, some have NULL values of the non-key for some unknown reason.  Here is a screenshot.  The key is node_id, which I have specified as a key and unique identifier.




From: Ron Johnson <ronljohnsonjr@gmail.com>
Sent: Wednesday, March 5, 2025 12:50 PM
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Duplicate Key Values
 
On Wed, Mar 5, 2025 at 12:36 PM mark bradley <markbradyju@outlook.com> wrote:
Although I did not enter them, somehow duplicate primary key values have appeared in one of my tables. 

Is it a text/varchar column?  Has the distro been upgraded "recently", or maybe streamed from an older Linux system to a newer Linux system?
 
I can't remove the offending rows because the key is a foreign key in another table.

What to do?

Are the records completely (i.e., all columns) identical?

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


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

pgsql-general by date:

Previous
From: Igor Korot
Date:
Subject: Re: Error on query execution
Next
From: Adrian Klaver
Date:
Subject: Re: Duplicate Key Values