Assert failure in _bt_preprocess_array_keys

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>
Subject: Assert failure in _bt_preprocess_array_keys
Date: 2024-04-22 02:36:13
Message-ID: CAMbWs48f5rDOwxaT76Zd40m7n9iGZQcjEk7vG_5p3YWNh6oPfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I came across an assert failure in _bt_preprocess_array_keys regarding
the sanity check on the datatype of the array elements. It can be
reproduced with the query below.

create table t (c int4range);
create unique index on t (c);

select * from t where c in ('(1, 100]'::int4range, '(50, 300]'::int4range);

It fails on this Assert:

+ elemtype = cur->sk_subtype;
+ if (elemtype == InvalidOid)
+ elemtype = rel->rd_opcintype[cur->sk_attno - 1];
+ Assert(elemtype == ARR_ELEMTYPE(arrayval));

... which was introduced in 5bf748b86b.

I didn't spend much time digging into it, but I wonder if this Assert is
sensible. I noticed that before commit 5bf748b86b, the two datatypes
were not equal to each other either (anyrange vs. int4range).

Thanks
Richard

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2024-04-22 02:52:16 Re: Assert failure in _bt_preprocess_array_keys
Previous Message David Steele 2024-04-22 00:47:10 Re: pg_combinebackup does not detect missing files