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 1tLcyy-00FyZm-35 for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Dec 2024 06:47:32 +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 1tLcyu-0087rl-D7 for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Dec 2024 06:47:29 +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 1tLcyu-0087pk-3J for pgsql-bugs@lists.postgresql.org; Thu, 12 Dec 2024 06:47:29 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tLcyr-002PkE-Vr for pgsql-bugs@lists.postgresql.org; Thu, 12 Dec 2024 06:47:28 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3862a921123so131838f8f.3 for ; Wed, 11 Dec 2024 22:47:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1733986045; x=1734590845; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=FpfIDbMVL4j56c7J45MLle6z/J1LJWG78NzY/ymunuk=; b=m6PwyCtZmZ487AEPRBY11uRwAbZ/bdvlsCyZZYyHhdQqGxkF6MDvFt8kbeVoiuCp3E qqVA+Qs5Pm6CkHj1g7p1mR/XH+0fcdnVEN9fKUusAa3TUi43J+3RCdC5WeiEKoKAQboO fH6fX/AZBaCOUlLoYHA3R3hqTub0cub2bo2mNrh92A5BIGwKnbnSzW2bLhN2uj8n9SAo hS1E/7VXdL85IySpXRFoDhISp4H8PyO5xlQAXHMbNCR3ZzpdPewDP2Obn3VqlVLB1LwX r4JyaRBTNmmUE+8lNDzic7u19C/plVovACJ24MrGjY/FAKPa50I31P1iiI9V9VoIfDD7 a/Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733986045; x=1734590845; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FpfIDbMVL4j56c7J45MLle6z/J1LJWG78NzY/ymunuk=; b=LjBczwwHvDjmp91zDKpiLc+812UIwPgBsax7rilkQFXKPl5XL1Cx9kdCOJnPeCBY8o Hil3XSXDlhpVv0m2rS08uV0/23hw49bMEJa5aERUovc1aUBKPfFCLSySqfM/vXMvynoJ zrSnTCnypp9LJ8tnfHphV1xWdfauzdMCWZ1UEK7w5/vWXBODvzoi/bYUof7qRBwTnbB0 Nf4YMtwmoV09I+Kx98k1ZXI4ffZauSujQWLNPr8R354s4ED4I4DiMaZNG1B+uFPKYr6O 1st+qhsEjF6ds47S6lqIcbrKoh6LT0PCXgMPXBSS8GuDBFO8SPEEkTRot4yMP2cEN/aP TOdQ== X-Forwarded-Encrypted: i=1; AJvYcCUYnEa71P4HVSfCVM4Ava44DcbZEihGMFUJGDEAm00E25eEQ3lz9KXD3AurcGvSmMRscsqaubwA2cvq@lists.postgresql.org X-Gm-Message-State: AOJu0Yw0WlNiLXSSKO+8PHmDYAVCNX1GJsTLsV7ukdiVlJ5X//nIEett ZXeBhSqTIIpvTzvlSDqd//EMmMmapN1YJGSxlNrp6PKmEyC/cag834fiZe9fPb7i5Unzhx1wuPj Y X-Gm-Gg: ASbGncts2OY6B4FJSuYox60/8euALwYO/t8t3KXEQFItHFw+yaHfkeklBV4PBVOjl2c VrxGx9C/siCSvx9B0wdnoJiqf+/ccoOR3NA8PWAcQrOK4tI8q9NmYxCLv8TwXDO7Fq+VDFX3WHQ oKPUK54VaUZxX+5RR/KBZex+UiPnyV6TgjQjU5IjeKNrdJbQjKkRDr3CJM0EavBdsEMDifAowbK wsRQN18s1oH/RCahGC1GPgD0t6/jpW52D5HK9OYAy4qPuyaTVfbKZsYNuew47iBUF9caPbaTXE= X-Google-Smtp-Source: AGHT+IEP3SfL4lZ56OzbIaNlXz4ia91rAkSM+sPoVB/rBEhRoVnLN9TahvdsoeeCkCdI/+UHla5cpA== X-Received: by 2002:a5d:6dac:0:b0:385:f220:f779 with SMTP id ffacd0b85a97d-387877dc3camr1667811f8f.49.1733986045063; Wed, 11 Dec 2024 22:47:25 -0800 (PST) Received: from localhost.localdomain ([2001:871:260:168:2a46:3a5f:edaa:a7f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436256b42c8sm6883815e9.29.2024.12.11.22.47.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 22:47:24 -0800 (PST) Message-ID: <0c1f6b24a56b4ee79331c656efce9ca622ffa0a1.camel@cybertec.at> Subject: Re: Problem with constraint unique. From: Laurenz Albe To: =?UTF-8?Q?=D0=9C=D0=B0=D1=80=D0=B0=D1=82_?= =?UTF-8?Q?=D0=93=D0=B0=D1=81=D0=B0=D0=BD=D1=8F=D0=BD?= , pgsql-bugs@lists.postgresql.org Date: Thu, 12 Dec 2024 07:47:24 +0100 In-Reply-To: <1733928443.950047988@f125.i.mail.ru> References: <1733928443.950047988@f125.i.mail.ru> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.2 (3.54.2-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2024-12-11 at 17:47 +0300, =D0=9C=D0=B0=D1=80=D0=B0=D1=82 =D0=93=D0= =B0=D1=81=D0=B0=D0=BD=D1=8F=D0=BD wrote: > I apologies for bothering your team,=C2=A0before send this message we goo= gle the > problem and was not able to find any tips about it.=C2=A0Our project enco= unter > with quite strange situation where we found violation of unique constrain= t > of primary key. We have a table that has an attribute ID as PK. The table > name enerstorymain_task_info. Surprisingly the query=C2=A0 > select id, count(*) from=C2=A0=C2=A0enerstroymain_task_info group by 1 ha= ving count(*) > 1 > return a lot of rows. Than we rechecked PK it is ok. So we supposed that > some how we had dropped the PK and then created duplicates and than rebui= ld > the PK, but in this case PK would not rebuild. To avoid any weird setting= s > I run the query from PGAdmin and DBView from different computers. > Also I doubt that any kind problem like repeatable red could=C2=A0be the = reason > due to insert operation is done only a server without any complicated que= ry. > I mean simple INSERT INTO =E2=80=A6. No, dropping and re-creating the constraint cannot be the explanation, unless the primary key constraint is NOT VALID. With "uuid", it also cannot be a collation problem. The best thing to get rid of this data corruption is to delete the extra entries and then to sump and restore the data to a new database. Check if your hardware has problems. Yours, Laurenz Albe