Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ooU4j-0002a4-MX for pgsql-admin@arkaria.postgresql.org; Fri, 28 Oct 2022 18:27:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ooU4g-0000Gx-Mn for pgsql-admin@arkaria.postgresql.org; Fri, 28 Oct 2022 18:27:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ooU4g-0000Gn-AB for pgsql-admin@lists.postgresql.org; Fri, 28 Oct 2022 18:27:22 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ooU4b-0007cB-69 for pgsql-admin@lists.postgresql.org; Fri, 28 Oct 2022 18:27:21 +0000 Received: by mail-pl1-x62a.google.com with SMTP id g24so5550083plq.3 for ; Fri, 28 Oct 2022 11:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=zUpkluncq7jJpw82ljGRHQKT8iif1uf8LfuZjS/7bpU=; b=CBsWh7gaeQptVSGsYb3/hTmqBZEpKDc+zxaG1j29SQl4KCAg8JgR7ITtz89Y+cQvmw RPgaDKTmWHflKbREK9wGwWZx6JW7RS71eG+OgMbAhGwP1qACY1StBLrvrNT3rqS0sdvB lHfD0dd2kTN8g+vZpb7qRWBScrhCxWIkkw7wTHukc2SP98O6pDcHsJ6WNqcgF2d6oyvL fwzd9g6Aj3XVhcPF5zxZCiJPB8FCig6R+pSU8WYWxMUNzjCi5qQmBllKW61uLKnY551S ilQJNvGZsTpQoelUkfCv8Z3YK3eOI3+OdCe66Gyqj9WtuP3mMbbR65+Cp1o6ViBEWRuT zxdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zUpkluncq7jJpw82ljGRHQKT8iif1uf8LfuZjS/7bpU=; b=FX4xOQW3X5uj1zXFVi11n9nQOPonwDlwpZXd38dlq3CBwGUCmSq4pFCZ0OSyqo/ogm lTUGk/ND/5Qvxa2P8x1RG2PR9PfpGunbNXeDbGF7Y3/4aoFSyEcinmhaBc3OIVG44mF5 iS+2XxwppdsbXmBJheeEgItzBgnt7jW6ODn1ex8tx3pHfC6nMHq7n4KYP5c2dobISsh2 N6pt7oTHh7nQ3um6o528/U9rXCsrl1QBjtFpopuppOshny78egKSiqr0ZauLZlNwsB78 m1JTi9qu2ZHXx4PibBwTfqqWGWcTCkujMKgLrgz8/+em1ZafCMfNbCXzVB86tYP4EEDt RLGg== X-Gm-Message-State: ACrzQf2ASDvbi1+rDO+7knYebvFSnkkn0Ynk0rQZWWwBQt18M5chsL+K js2BpTFo0g6OdPLTKNRv4l9q/nwDGdpxRb9T X-Google-Smtp-Source: AMsMyM6mSmWEdwGNJxtCxpllpVqa40h5S7/7iZn+H4FGUisrhhZmLAjbmmIEk4eHZWClXX9o3g79TA== X-Received: by 2002:a17:902:9b82:b0:183:fffb:1bfe with SMTP id y2-20020a1709029b8200b00183fffb1bfemr263533plp.173.1666981635864; Fri, 28 Oct 2022 11:27:15 -0700 (PDT) Received: from smtpclient.apple (2603-8001-0200-0026-9d7d-a196-018b-8c6b.res6.spectrum.com. [2603:8001:200:26:9d7d:a196:18b:8c6b]) by smtp.gmail.com with ESMTPSA id qe10-20020a17090b4f8a00b0020c899b11f1sm4550417pjb.23.2022.10.28.11.27.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 11:27:15 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-BAC36265-ED13-4A67-853F-C1FD0DA9A83C Content-Transfer-Encoding: 7bit From: Teja Jakkidi Mime-Version: 1.0 (1.0) Subject: Re: Duplicate data even with primary keys enabled Date: Fri, 28 Oct 2022 11:27:14 -0700 Message-Id: <59B1180A-4A4B-4A1A-B50A-C9D9B41AA67D@gmail.com> References: Cc: pgsql-admin In-Reply-To: To: Samed YILDIRIM X-Mailer: iPhone Mail (19G82) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail-BAC36265-ED13-4A67-853F-C1FD0DA9A83C Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi YILDIRIM, Thanks for your response. We have a composite primary key on 3columns. We are noticing multiple rows w= ith same values in the 3pk columns which should not happen as primary constr= aint is defined on them. Also, none of the columns are null. Regards, Teja. J. > On Oct 28, 2022, at 10:59 AM, Samed YILDIRIM wrote: >=20 > =EF=BB=BF > Hello Teja, >=20 > Could you please add some example lines? I need to see some examples to sa= y something more accurate. >=20 > First of all, null !=3D null in PostgreSQL. So, if any of those three colu= mns is null, it means it is unique and won't violate unique constraints even= if there is another row with the same values. >=20 > Another thing, if you defined a composite primary key on those 3 columns, i= t means that it will prevent inserting another row that has exactly the same= values on those columns. If you want to keep values unique on each individu= al columns, you need to create 3 separate unique indexes/constraints. >=20 > Best regards. > Samed YILDIRIM >=20 >> On Fri, 28 Oct 2022, 19:52 Teja Jakkidi, wrote= : >> Hello Admin team, >>=20 >> I have an issue where we are seeing duplicate data in one of the tables. T= he table has primary key constraint defined on 3columns and we are seeing du= plicate data in these column data. >> Is there any way to figure out why this could happen? Also is there a way= that the primary key constraint can be disabled during inserts?? If so how= can we find who disabled it? (Note that audit is not enabled for the table)= >> Please suggest. >>=20 >> Thanks, >> Teja. >>=20 --Apple-Mail-BAC36265-ED13-4A67-853F-C1FD0DA9A83C Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi YILDIRIM,

Thanks for y= our response.

We have a composite primary key on 3c= olumns. We are noticing multiple rows with same values in the 3pk columns wh= ich should not happen as primary constraint is defined on them.
Al= so, none of the columns are null.

Regards,
Teja. J.

On Oct 28, 2022, at 10:59 AM, Samed YILDIRIM <samed@reddoc.net> w= rote:

=EF= =BB=BF
Hello Teja,

Could you please add some example lines? I need to see some examples to= say something more accurate.

First of all, null !=3D null in PostgreSQL. So, if any of those three c= olumns is null, it means it is unique and won't violate unique constraints e= ven if there is another row with the same values.
Another thing, if you defined a composite primary k= ey on those 3 columns, it means that it will prevent inserting another row t= hat has exactly the same values on those columns. If you want to keep values= unique on each individual columns, you need to create 3 separate unique ind= exes/constraints.

Best regards.
Samed YILDIRIM

<= div class=3D"gmail_quote">
On Fri, 28 O= ct 2022, 19:52 Teja Jakkidi, <teja.jakkidi05@gmail.com> wrote:
Hello Admin team,

I have an issue where we are seeing duplicate data in one of the tables. The= table has primary key constraint defined on 3columns and we are seeing dupl= icate data in these column data.
Is there any way to figure out why this could happen? Also is there a way th= at the primary key constraint can be disabled during  inserts?? If so h= ow can we find who disabled it? (Note that audit is not enabled for the tabl= e)
Please suggest.

Thanks,
Teja.

= --Apple-Mail-BAC36265-ED13-4A67-853F-C1FD0DA9A83C--