pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ajinkya Tankhiwale <ajinkya.tankhiwale@tcs.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: RE: BUG #18002: Duplicate entries of row possible even after having primary key
Date: Thu, 29 Jun 2023 12:12:49 +0000
Message-ID: <MA0PR01MB76602245C747427B940134D28E25A@MA0PR01MB7660.INDPRD01.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20230628205955.7hrmows5ry247xwe@awork3.anarazel.de>
References: <18002-00f2b6cb2b9c0b02@postgresql.org>
	<20230627203640.fkh66zps3p2jpxvd@awork3.anarazel.de>
	<MA0PR01MB7660CF4D25A524E5DDBAD3F38E24A@MA0PR01MB7660.INDPRD01.PROD.OUTLOOK.COM>
	<20230628205955.7hrmows5ry247xwe@awork3.anarazel.de>

Hello,



Please find below snippet from pgAdmin



[cid:image001.png@01D9AA93.93616B90]



I was able to enter duplicates from pgAdmin.



Regards,

Ajinkya

-----Original Message-----
From: Andres Freund <andres@anarazel.de>
Sent: Wednesday, June 28, 2023 11:00 PM
To: Ajinkya Tankhiwale <ajinkya.tankhiwale@tcs.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18002: Duplicate entries of row possible even after having primary key



"External email. Open with Caution"



Hi,



On 2023-06-28 08:38:03 +0000, Ajinkya Tankhiwale wrote:

> CREATE TABLE IF NOT EXISTS offer

> (

>     action_id bigint NOT NULL DEFAULT nextval('trade.seq_ao_id'::regclass),

>     action_type character varying COLLATE pg_catalog."default" NOT NULL,

>     buy_sell_indicator character varying COLLATE pg_catalog."default" NOT NULL,

>     creation_date_time timestamp without time zone NOT NULL,

>     modification_date_time timestamp without time zone NOT NULL,

>     CONSTRAINT pk_ado PRIMARY KEY (action_id) );



Just to check, the non-detected uniqueness violations are in this table?



How exactly are you inserting?



As the primary key is using a sequence, you shouldn't even get to the situation that there could be a uniqueness violation.





> Interesting point here is, if I create new table then constraint violation is thrown, on old table I could enter duplicate records.

> Also, we migrated from el7 to el8.



If the relevant constraints were on some form of a string, I'd suspect that you ran into a corrupted index due to collation changes between el7 and el8. But the pkey of the table above is on a bigint...



Greetings,



Andres Freund


=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you

Attachments:

image001.png (image/png, 35.3K) download view image

view thread (10+ messages)  latest in thread

Message-ID: <MA0PR01MB76602245C747427B940134D28E25A@MA0PR01MB7660.INDPRD01.PROD.OUTLOOK.COM>
Permalink:  ../MA0PR01MB76602245C747427B940134D28E25A@MA0PR01MB7660.INDPRD01.PROD.OUTLOOK.COM/
Also on:    postgresql.org/message-id/MA0PR01MB76602245C747427B940134D28E25A@MA0PR01MB7660.INDPRD01.PROD.OUTLOOK.COM

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: ajinkya.tankhiwale@tcs.com, andres@anarazel.de
  Subject: Re: BUG #18002: Duplicate entries of row possible even after having primary key
  In-Reply-To: <MA0PR01MB76602245C747427B940134D28E25A@MA0PR01MB7660.INDPRD01.PROD.OUTLOOK.COM>
  References: <18002-00f2b6cb2b9c0b02@postgresql.org> <20230627203640.fkh66zps3p2jpxvd@awork3.anarazel.de> <MA0PR01MB7660CF4D25A524E5DDBAD3F38E24A@MA0PR01MB7660.INDPRD01.PROD.OUTLOOK.COM> <20230628205955.7hrmows5ry247xwe@awork3.anarazel.de> <MA0PR01MB76602245C747427B940134D28E25A@MA0PR01MB7660.INDPRD01.PROD.OUTLOOK.COM>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox