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 1s82y9-009DuC-Av for pgsql-hackers@arkaria.postgresql.org; Fri, 17 May 2024 19:10:18 +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 1s82y8-00Gbuq-FX for pgsql-hackers@arkaria.postgresql.org; Fri, 17 May 2024 19:10:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s82y8-00Gbuh-4i for pgsql-hackers@lists.postgresql.org; Fri, 17 May 2024 19:10:16 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s82y4-000hpo-AO for pgsql-hackers@lists.postgresql.org; Fri, 17 May 2024 19:10:14 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1ec486198b6so17393645ad.1 for ; Fri, 17 May 2024 12:10:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1715973011; x=1716577811; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vCANkNLUq/1pa/AMtDBKEbSjuO+RWnPfwUzPBuZTH7k=; b=EXfmBrsjBV+dRFCTgtQzwOglXN7CuwS3t2G+p2pOFu0Y9g61KTeMMkAT0e/ffH9YVd l3TTYPwMWP2NMeZNWapi857UWAwqMReRdM+l0SiTQqx3bispGh9VTX4b+uB6do4H07WW rFxXDoK0t0uxkV9I7GnRccXbRPD8y9FaQqQCbKrs35pxgAxnYIMtIUk4a1xUxJvYYFwW zEtLHACU4DejefiJ7+wfFZ0sqO7oqiVtRqd3lUc2t38Bekbq7yGf6qv0LOACLwTol58t rxj8x0aHXLfAP9k3V0d9aVw0JHxYQ5QzfwU7/+lv5728ClFTZ1kLl7zhskwCxNcVBOwS y+kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715973011; x=1716577811; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vCANkNLUq/1pa/AMtDBKEbSjuO+RWnPfwUzPBuZTH7k=; b=dIntXoY7HCpUXVDitJbxG/O27nThEna6utfeKSUFj4VR7CBfFoU3RWMJ7YwfFyo4k3 kGXjUBSqWbx5HXh/E7a0cqbChN4Qw3W1C/YRWihlGIjs+woOgcEd4uEUTUsji6nzk9qK oXhg1UGZss9YEsVL1zVLfFbMdnuZnljLP65V6Ur5zGC4k0Du4zgoJMUu81WVaB0tDWSS ouNDVpaZW5zOZ1WzV7v6A7WUSBWuFUTkLxVKELGtyi/yxiFq0cGL7Tm/cUvgjzkfTqIH MBjpqE/L5U0Ywx/QzQLtB+InvDiCQrYu2cgfqaJUQMElFVqB/5gdcKzvhqFSelRgNjC0 z6ZA== X-Forwarded-Encrypted: i=1; AJvYcCXrzGJWjKpgBAIoxtHJcG2rEGJTphmHx5WnJaqeOVqVg4Wce80lC6fzEWt1U/MuaO97dNgtHoFoKEgBsyRLQbEK0n4roKrNyybLSBoHXFYIvAHK X-Gm-Message-State: AOJu0YzdIc6488cBmT43cE4CuxwXB6Uld1sy6S+0RxEkel7mjMfylN9s Li7KgJw/HTwvug8EwBs2jBmFbbWIptoCsq2M+j2ZFpKzN2ZAkiRtEAZzxEHdzg== X-Google-Smtp-Source: AGHT+IGlFvwEws5uCpROPk14frrz0ctSRqybYBJhph2hAjZ86u+16o07FIWSnwDEhbzvNIiVJIYN9A== X-Received: by 2002:a17:902:f7c5:b0:1de:fbc8:53af with SMTP id d9443c01a7336-1ef43e29626mr200589395ad.25.1715973011403; Fri, 17 May 2024 12:10:11 -0700 (PDT) Received: from smtpclient.apple (24-113-197-127.wavecable.com. [24.113.197.127]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0bf2f503sm160212845ad.122.2024.05.17.12.10.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2024 12:10:10 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6.1.1\)) Subject: Re: [PATCH] Improve amcheck to also check UNIQUE constraint in btree index. From: Mark Dilger In-Reply-To: Date: Fri, 17 May 2024 12:10:10 -0700 Cc: Alexander Korotkov , Tom Lane , Noah Misch , Peter Eisentraut , Aleksander Alekseev , Postgres hackers , Maxim Orlov , Andres Freund , Greg Stark , Julien Rouhaud , David Steele , Peter Geoghegan , Maxim Orlov , lubennikovaav@gmail.com Content-Transfer-Encoding: quoted-printable Message-Id: <28FCD9E5-795E-44F4-ADFA-DBCAC1945DA1@enterprisedb.com> References: <20220922151328.lakwdytvwnyyif3b@awork3.anarazel.de> <8c74cc5e-4b97-4cd7-9aaf-67886822a78c@eisentraut.org> <20240501022412.85@rfd.leadboat.com> <1375614.1715301775@sss.pgh.pa.us> <8635D8B1-45B7-4D67-86C7-D6ECB4F10B11@enterprisedb.com> <2EDAC2EB-E8C2-4B56-9094-288ABD45DA4E@enterprisedb.com> To: Pavel Borisov X-Mailer: Apple Mail (2.3731.700.6.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On May 17, 2024, at 11:51 AM, Pavel Borisov = wrote: >=20 > Amcheck with checkunique option does check uniqueness violation = between pages. But it doesn't warranty detection of cross page = uniqueness violations in extremely rare cases when the first equal index = entry on the next page corresponds to tuple that is not visible (e.g. = dead). In this, I followed the Peter's notion [1] that checking across a = number of dead equal entries that could theoretically span even across = many pages is an unneeded code complication and amcheck is not a tool = that provides any warranty when checking an index. This confuses me a bit. The regression test creates a table and index = but never performs any DELETE nor any UPDATE operations, so none of the = index entries should be dead. If I am understanding you correct, I'd be = forced to conclude that the uniqueness checking code is broken. Can you = take a look? =E2=80=94 Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company