Re: BUG #18252: Assert in CheckOpSlotCompatibility() fails when recursive union filters tuples in non-recursive term

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: BUG #18252: Assert in CheckOpSlotCompatibility() fails when recursive union filters tuples in non-recursive term
Дата
Msg-id CAMbWs4-LHk1tQmj6gYL3ESh9fvP21Zmo9yHSscBzua0Kx=pOHw@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #18252: Assert in CheckOpSlotCompatibility() fails when recursive union filters tuples in non-recursive term  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #18252: Assert in CheckOpSlotCompatibility() fails when recursive union filters tuples in non-recursive term  (Peter Eisentraut <peter@eisentraut.org>)
Re: BUG #18252: Assert in CheckOpSlotCompatibility() fails when recursive union filters tuples in non-recursive term  (Richard Guo <guofenglinux@gmail.com>)
Список pgsql-bugs

On Tue, Dec 19, 2023 at 12:30 AM PG Bug reporting form <noreply@postgresql.org> wrote:
CREATE TABLE t(i int);
INSERT INTO t VALUES (1), (1);

WITH RECURSIVE rt(i) AS (
    SELECT * FROM t
    UNION
    SELECT * FROM rt
)
SELECT * FROM rt;

Nice catch.  The TupleHashTable's tableslot is created as type
TTSOpsMinimalTuple.  The RecursiveUnion's non-recursive term generates
tuples of type TTSOpsBufferHeapTuple.  If the non-recursive term
produces duplicate tuples, we'd find non-empty bucket when inserting the
same key into the hashtable.  In this case we need to check to see if
the two tuples match: one is of the hashtable's tableslot
(TTSOpsMinimalTuple), and the other comes from the non-recursive term
(TTSOpsBufferHeapTuple).  And the incompatible slot type would fail
CheckOpSlotCompatibility.

I have no idea about how to fix it.

BTW, while reading the codes, I noticed two typos in simplehash.h, one
is in the comment of SH_INSERT, the other is in the comment of
SH_INSERT_HASH.  Attached is a trivial patch for that.

Thanks
Richard
Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #18246: pgstathashindex() attempts to read invalid file for hash index attached to partitioned table
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #18247: Integer overflow leads to negative width