From: Jwiencek3 <jwiencek3@comcast.net>
To: Teju Jakkidi vlogs <teja.jakkidi05@gmail.com>
Cc: Scott Ribe <scott_ribe@elevated-dev.com>
Cc: Holger Jakobs <holger@jakobs.com>
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: Duplicate data even with primary keys enabled
Date: Fri, 28 Oct 2022 21:53:30 -0500
Message-ID: <BFDB1F38-F820-4BAF-AEE9-CBDB34387BDA@comcast.net> (raw)
In-Reply-To: <CAKA2XvYoEw0qbMKmnk686gOKe+FrR22R14S6Ts1aY96+ExHtgA@mail.gmail.com>
References: <CAKA2XvYoEw0qbMKmnk686gOKe+FrR22R14S6Ts1aY96+ExHtgA@mail.gmail.com>
Is it possible that a column is padded with spaces? I’d check the length of each column. Extra spaces to the right would make the columns unique. You can’t tell if the column is padded with blanks from your query. Checking the length would confirm each column is exactly the same.
Sent from my iPad
> On Oct 28, 2022, at 3:42 PM, Teju Jakkidi vlogs <teja.jakkidi05@gmail.com> wrote:
>
>
> Hello Scott,
>
> I am wondering how the query matters here?
>
> Also, I am just running a simple select from "TEST" with COL1, COL2, COL3 in the WHERE condition.
> select * from 'TEST" WHERE COL1='3456' AND COL2='76542' AND COL3='5';
>
> The actual Issue is I am unable to figure out why the table is having duplicate data in the primary key columns. Or how postgres accepted 2 rows with the same combination of the columns in the primary key constraint. I would expect it to throw primary key constraint violation error.
>
> Regards,
> Teja. J.
>
>
>> On Fri, Oct 28, 2022 at 1:27 PM Scott Ribe <scott_ribe@elevated-dev.com> wrote:
>> > On Oct 28, 2022, at 2:15 PM, Teju Jakkidi vlogs <teja.jakkidi05@gmail.com> wrote:
>> >
>> > Also, the values that we are seeing is as below:
>> >
>> > COL1 COL2 COL3 COL4 COL5 COL6
>> > 1 3456 76542 5 ABC 1234
>> > 1 3456 76542 5 ABC 1234
>> > 2 9872 89765 0 FGT 1234
>> > 3 6547 78659 7 JHL 8790
>> >
>> > We already defined COL1, COL2, COL3 as primary keys, but still as you see above in the table output, the first 2 rows has exactly same combination for those 3 rows.
>>
>> What query are you running?
>>
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: pgsql-admin@postgresql.org
Cc: jwiencek3@comcast.net, teja.jakkidi05@gmail.com, scott_ribe@elevated-dev.com, holger@jakobs.com, pgsql-admin@lists.postgresql.org
Subject: Re: Duplicate data even with primary keys enabled
In-Reply-To: <BFDB1F38-F820-4BAF-AEE9-CBDB34387BDA@comcast.net>
* 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