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 1rMqiS-0075Sa-RF for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Jan 2024 14:35:02 +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 1rMqiR-005ZO2-RZ for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Jan 2024 14:34:59 +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 1rMqiR-005ZNd-Eb for pgsql-bugs@lists.postgresql.org; Mon, 08 Jan 2024 14:34:59 +0000 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rMqiF-000Ukd-Iq for pgsql-bugs@postgresql.org; Mon, 08 Jan 2024 14:34:58 +0000 Received: from mail-nwsmtp-smtp-corp-main-62.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-62.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:291a:0:640:e5df:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 776EA61557; Mon, 8 Jan 2024 17:34:43 +0300 (MSK) Received: from smtpclient.apple (unknown [2a02:6b8:b081:b403::1:23]) by mail-nwsmtp-smtp-corp-main-62.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id gYhIaS8IZ4Y0-SrhuFnwj; Mon, 08 Jan 2024 17:34:42 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1704724482; bh=0pq+YNYCepK4sl+m7hsTFjf2UDLKT5RFrVb27Lxj4r0=; h=Message-Id:To:Date:References:Cc:In-Reply-To:From:Subject; b=HNPmGoXlCCPk1PaFCQqAmlg2TUhoHlY46JxcAd4BHtBac6aA2zI29yHGDfrfjnbQ8 O86E0g1yZ9uy0OnAddQ7AhEq9dNn6x2JEtTqJilULdJTpisS80Sx2VcN8Y+GPDuIZ/ VseT4OQBfmRDHUvTHGploTj2C+QrYe/FnNHZr9bM= Authentication-Results: mail-nwsmtp-smtp-corp-main-62.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.4\)) Subject: Re: [BUG] false positive in bt_index_check in case of short 4B varlena datum From: "Andrey M. Borodin" In-Reply-To: Date: Mon, 8 Jan 2024 19:34:41 +0500 Cc: Michael Zhilin , pgsql-bugs@postgresql.org, y sokolov Content-Transfer-Encoding: quoted-printable Message-Id: <49BBA065-4C9A-4E50-9048-B457907FF219@yandex-team.ru> References: <7bdbe559-d61a-4ae4-a6e1-48abdf3024cc@postgrespro.ru> <0FDE2089-D306-4CBB-AD1F-EC4B419E3B33@yandex-team.ru> To: Alexander Lakhin X-Mailer: Apple Mail (2.3696.120.41.1.4) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Alexander! I think both cases are very interesting and deserve two separate bug = items. > On 14 Dec 2023, at 22:17, Alexander Lakhin = wrote: >=20 >=20 > By changing the storage mode for a column, you can also get another = error: > CREATE TABLE t(f1 text); > CREATE INDEX t_idx ON t(f1); > INSERT INTO t VALUES(repeat('1234567890', 1000)); > ALTER TABLE t ALTER COLUMN f1 SET STORAGE plain; >=20 > CREATE EXTENSION amcheck; > SELECT bt_index_check('t_idx', true); >=20 > ERROR: index row requires 10016 bytes, maximum size is 8191 >=20 I think In this case we should warn user that index contains tuples with = datums that are not insertable anymore. And abort heapallindexed. > On 8 Jan 2024, at 00:00, Alexander Lakhin wrote: >=20 > What is your opinion regarding similar failures, which are not = addressed > by the patch? Besides the case shown above, there is another one: > CREATE TABLE tbl(i int4, t text); > ALTER TABLE tbl ALTER COLUMN t SET STORAGE plain; > CREATE INDEX tbl_idx ON tbl (t, i) WITH (fillfactor =3D 10); > INSERT INTO tbl SELECT g, repeat('Test', 250) FROM generate_series(1, = 130) g; > ALTER TABLE tbl ALTER COLUMN t SET STORAGE extended; >=20 > CREATE EXTENSION amcheck; > SELECT bt_index_check('tbl_idx', true); >=20 > ERROR: heap tuple (0,1) from table "tbl" lacks matching index tuple = within index "tbl_idx" > HINT: Retrying verification using the function = bt_index_parent_check() might provide a more specific error. IMO In this case we should handle VARATT_IS_EXTENDED in = bt_normalize_tuple(). BTW CI fails of the original patch ITT are related to the fact that COPY = in\out file is created in PG_ABS_SRCDIR instead of PG_ABS_BUILDDIR. In = an off-list conversation I recommended Michael to mimic tests = regress/largeobject.sql. Though, there might be better ideas. Thanks! Best regards, Andrey Borodin.=