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 1rmt8H-00AQtu-OV for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Mar 2024 10:25: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 1rmt8F-004DlY-KI for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Mar 2024 10:25:16 +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 1rmt8F-004DlP-Bv for pgsql-bugs@lists.postgresql.org; Wed, 20 Mar 2024 10:25:15 +0000 Received: from mail-yb1-xb33.google.com ([2607:f8b0:4864:20::b33]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rmt88-005WmG-CH for pgsql-bugs@postgresql.org; Wed, 20 Mar 2024 10:25:14 +0000 Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-dcbd1d4904dso6505021276.3 for ; Wed, 20 Mar 2024 03:25:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710930307; x=1711535107; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JXN0xwmDLWx4TLlNk8do13X3ueQf0CCWPzukzmFkvoc=; b=bxGB3IRxco10NRSysb1hubYrFF5vcwMA9Jg+nui/WmbkKRNXy96vaEHnLyRMuNUuRT RBt/g+oafGXsWs+GMRFmuTDaveNvBZoQGUKH/DHSlnyMesYfFP/UwhqLEYCyQYIQxcJK /HyoWEimUKughG++s3OXzIHmEFwIwvMWQ7UkRxrrXy1M0tM0vcrg7zFP2m20tcO3pFT2 TZiX4o58VOaxJf4+r9Sv74Zs29Jr12Owm2VNYf2pYA66MeWLxHbi7X4lx0IRQ0kRK+mi yC3AC7yTODrCGzFPt3yS8NMPUgrFCWgBbAk9fDwVrFE/7IiEBNXWGi4dKf87iwojm42G ToAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710930307; x=1711535107; h=content-transfer-encoding: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=JXN0xwmDLWx4TLlNk8do13X3ueQf0CCWPzukzmFkvoc=; b=VQWmUw1g2I0af4K+MgKCfebIDdwEbVRICwtzii7wWJrPB7fSOXfxGr5/4gQ03TZClM u2kvvT3IT4+XX3UsoZpAuQo0K/SS2J4WFgO9nHptT7p0F+B9O2wzxin7L0DqK3HGwLvN KgC+PyD/WEzcpfi10L9hy3nGWdfN4VweVLgcLE8d7Oet1C0HCNiB6GVctiPo9jo/H37Q TiSwelTh26tg7kDGYYc86Ye1Q5P4Nc2KVP9B0zLG3Z0DP5eS3QQ7Iy5QIacXHQNUUcd/ 8GyLnvS0CJdhpSd0fB/b1jEytGlqmF2uKIR0c7wP1j8BXbAenTaIXRYlfjxZgW6KETfx AlLw== X-Forwarded-Encrypted: i=1; AJvYcCUWILjDVVDVUn/927SyzvMZMz060G8i15i1Ks3H53SFuSBq0UWRxL1Tz0yqtANBkiEWS94yf7j4JFWx1mJVI4geyTSUqnEc5jj7 X-Gm-Message-State: AOJu0Yztes2zRkeGf/wTZRfKpur0hFZnIQr8oWgvXnU849g19Rd2szdC 0RlsfrugUmMuzp4DJcN5PUoRx4zR+zhhxdWcIYmXg+tloVzcUI11M8QnyC/sVp2AB6HhxuW2W1e FFRnzqL/n7Kz6qHpHu/bH09c8PF4= X-Google-Smtp-Source: AGHT+IENM6caZHT+qS1t7xMAqrI9FOeoYARnZGAgR7lNOlN49ys+r0vO9zxGpvSFlVeDBrshELa4yyR6wssdMW0yn1A= X-Received: by 2002:a5b:ec2:0:b0:dc6:c617:7ca with SMTP id a2-20020a5b0ec2000000b00dc6c61707camr1305689ybs.29.1710930306589; Wed, 20 Mar 2024 03:25:06 -0700 (PDT) MIME-Version: 1.0 References: <7bdbe559-d61a-4ae4-a6e1-48abdf3024cc@postgrespro.ru> <0FDE2089-D306-4CBB-AD1F-EC4B419E3B33@yandex-team.ru> <49BBA065-4C9A-4E50-9048-B457907FF219@yandex-team.ru> <76bc0dc9-4e43-4cd8-8eec-249b254ed1c9@postgrespro.ru> <8C83FCCA-2548-499A-8B1C-96C3D8ADB787@yandex-team.ru> <0b535249-a00c-a38a-85f6-d5a38c62dd55@gmail.com> In-Reply-To: <0b535249-a00c-a38a-85f6-d5a38c62dd55@gmail.com> From: Alexander Korotkov Date: Wed, 20 Mar 2024 12:24:55 +0200 Message-ID: Subject: Re: [BUG] false positive in bt_index_check in case of short 4B varlena datum To: Alexander Lakhin Cc: "Andrey M. Borodin" , Michael Zhilin , pgsql-bugs@postgresql.org, Yura Sokolov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi! On Fri, Jan 26, 2024 at 9:00=E2=80=AFAM Alexander Lakhin wrote: > > 23.01.2024 21:09, Andrey M. Borodin wrote: > > PFA draft fixes for both this errors. Alexander, Michael, Jian, what do= you think? > > > > I did not touch anything in first step - fix for original bug in this t= hread. However, I think that comments from Jian He worth incorporating into= the fix. > > > > I''m confused by a NOTICE added, as it printed now even for cases, which > worked before, for example: > CREATE TABLE t(f1 text); > CREATE INDEX idx ON t(f1); > INSERT INTO t VALUES(repeat('1234567890', 1000)); > SELECT bt_index_check('idx', true); > NOTICE: Index contain tuples that cannot fit into index page, if toasted= with current toast policy > bt_index_check > ---------------- > > (1 row) Right, the patch number 0003 looks wrong to me. It uses heap_compute_data_size() to compute the size of the future index tuple. But heap_compute_data_size() doesn't apply any compression on the attributes. I suggest instead we just need to have a version of index_form_tuple() that reports an oversized tuple in a return value rather than throwing the error. BTW, 0001 and 0002 look good to me. I'm going to push them if no objection= s. ------ Regards, Alexander Korotkov