Re: [BUG] false positive in bt_index_check in case of short 4B varlena datum

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>
Cc: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, Michael Zhilin <m(dot)zhilin(at)postgrespro(dot)ru>, pgsql-bugs(at)postgresql(dot)org, Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
Subject: Re: [BUG] false positive in bt_index_check in case of short 4B varlena datum
Date: 2024-03-20 10:24:55
Message-ID: CAPpHfdsAs-B7O2_=jGbF+BQzuW3kGSboY9CcxzEOWUgxxZCr5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi!

On Fri, Jan 26, 2024 at 9:00 AM Alexander Lakhin <exclusion(at)gmail(dot)com> 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 thread. 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 objections.

------
Regards,
Alexander Korotkov

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kritika Agarwal 2024-03-20 12:27:28 Re: BUG #18401: Cannot install
Previous Message Mingjun Yang 2024-03-20 09:55:05 performance: `tuplehash_iterate` and `group by` question, very slow