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 1tFTt0-00DEYG-39 for pgsql-general@arkaria.postgresql.org; Mon, 25 Nov 2024 07:51:58 +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 1tFTsy-00D75e-NT for pgsql-general@arkaria.postgresql.org; Mon, 25 Nov 2024 07:51:56 +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 1tFTsy-00D75V-C7 for pgsql-general@lists.postgresql.org; Mon, 25 Nov 2024 07:51:56 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tFTsw-003jeZ-Th for pgsql-general@postgresql.org; Mon, 25 Nov 2024 07:51:55 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2ffc380b1d0so5753071fa.0 for ; Sun, 24 Nov 2024 23:51:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732521114; x=1733125914; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2K+TUUbz9EQZlGLH/wqVIgRPz7ILmmVR/t979M+LUXE=; b=Y2KPUe/Llsd2Cfjb//PN52abmjZ6HSijxheRIe51EwQGd8kjOFETGZBXRwiHUjaGy1 5RgOSZ/0e7H9nazSW0+AG0hSiIYwbJ1s04yUeDPi1psk2GxO9Mv6I9/D3n9kGHNhzy4a 77jDFef4bxq+0UMozKez7ky4ntaIaIkJv5SeaTLL1xP+xbwQe9TXnCWn2HKsbKftyJTd dvWqpsZ7S1/8y6W71UCzZ/9CO0ql6YggU7C7bGATvtmQc16JFXB+qlEqvzqXP1zHDEpO 2/x9YjfobpAMou9VUDxPueLfwpJtxactLWgY7doItT1cA3bEEAHXRxP+77ZVw4rMt2dW VDDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732521114; x=1733125914; h=cc: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=2K+TUUbz9EQZlGLH/wqVIgRPz7ILmmVR/t979M+LUXE=; b=dwevYcrbyWpP83bjZZtlDZWUt4H3cr/Jn2xsj3zzVDrlkwsK49G+ccmcBqdFrEdcJc 417YEaurfm23tUhGkpVI1lS2Ynx/y94Ar7MxAHRtgIlQim918kLrGk+rox0ZAsG70z3w i7oagm9MngNQu4iJS3uV+s/mhGBkcrwUJfi7ayCiQRMUJzvQ/DWYIt3ZHZL/QnWMgfZH LK95zOTYzO/bSg2zeHBxenlX9u7AZbHMiPVT5nueucQ9ZNdZxiA0EWTZuceu5JHyYK2Z YEMrL/qq90bq3K3TU1jHLgf1ahi9dzFvxf9sx2mqRdazuheqTUe9lQrsDI+ChDiQAyZ6 5bFQ== X-Gm-Message-State: AOJu0YxTigf3QGnldIAQ1F8EHEbL7qsZpuuA5AG0vL82xe/nBr8TJLh3 IbSivIdi/zqa39D3D+SJ9+IPma5Ty1sQ1Ut5lqCnDNCSiEWdYr6zfxudMy2ggmiHbxIDYa3GQZ5 mC/pNCV6MmrO2ELgfdRCCRSO2mAg= X-Gm-Gg: ASbGncs3W8fI8oM9CBHcnmI5ouQ0TolAAqWsj37CIz7kw4R6BWsUiFoyaY2JvLmwXnf 1NisQc2MHG5bXY9pPJlf7fmpEk2M5SjY= X-Google-Smtp-Source: AGHT+IGf6my8nn4xQB/D2DVPY8P5WdGTnB08Sf3imgknc07zoC83CkSWg+/iJKI5pOzaTGbiUdtYkppUY0mhJmb7aK4= X-Received: by 2002:a05:651c:1691:b0:2ff:ad99:b72e with SMTP id 38308e7fff4ca-2ffad99bd37mr21351431fa.9.1732521113360; Sun, 24 Nov 2024 23:51:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: ajit wangkhem Date: Mon, 25 Nov 2024 13:21:41 +0530 Message-ID: Subject: Re: Unique key constraint Issue To: shashidhar Reddy Cc: pgsql-general Content-Type: multipart/alternative; boundary="000000000000871fd40627b80162" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000871fd40627b80162 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Output should be consistent across servers below query o/p SELECT conname, pg_get_constraintdef(oid) FROM pg_constraint WHERE conrelid =3D 'your table name'::regclass AND contype =3D 'u'; (different datatype combine in UK is not an issue). This issue may not happen in asynchronous, log shipping or streaming replication. In logical replication it may create problem. On Mon, Nov 25, 2024 at 12:01=E2=80=AFPM shashidhar Reddy < shashidharreddy001@gmail.com> wrote: > Hello, > > We have postgresql servers with PostgreSQL 13.10 on Ubuntu release 22.0= 4. > > The issue is a unique key constraint with two columns one is character > another is integer. At some point the unique key did not work as I see > duplicate values with these two columns combination and it happened on > multiple servers on multiple databases on same table with same unique key= . > I tried db dump and restore but the key is failing to create when restore > with duplicate value errors. > > > > --000000000000871fd40627b80162 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
=C2=A0 Output=C2=A0should be consistent across servers bel= ow query o/p

SELECT conname, pg_get_constraintdef(oid)FROM pg_constraint
WHERE conrelid =3D 'your table name'::regcl= ass AND contype =3D 'u';
(different datatype=C2=A0combine= =C2=A0in UK is not an issue). This issue may not happen in asynchronous, lo= g shipping or streaming replication. In logical replication it may create p= roblem.

On Mon, Nov 25, 2024 at 12:01=E2=80=AFPM shashidhar Reddy <= shashidharreddy001@gmail.co= m> wrote:
Hello,

We have postgresql servers with PostgreSQL 13.10=C2=A0 = =C2=A0on Ubuntu release 22.04.

The issue is a unique key constraint with two columns one is charact= er another is integer. At some=C2=A0point the unique key did=C2=A0not work = as I see duplicate values with these two columns combination and it happene= d on multiple servers on multiple databases on same table with same unique = key. I tried db dump and restore but the key is failing to create when rest= ore with duplicate value errors.



--000000000000871fd40627b80162--