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 CAMbWs49MVPE7-T06gRvFO3KsNrjQt5OywsRyVAO3wawexvWJ2Q@mail.gmail.com
обсуждение исходный текст
Ответ на 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 7:28 PM Richard Guo <guofenglinux@gmail.com> wrote:
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.

This Assert was added in 15d8f8312:

commit 15d8f83128e15de97de61430d0b9569f5ebecc26
Author: Andres Freund <andres@anarazel.de>
Date:   Thu Nov 15 22:00:30 2018 -0800

    Verify that expected slot types match returned slot types.

So loop in Andres to have a look.

Thanks
Richard

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

Предыдущее
От: Richard Guo
Дата:
Сообщение: Re: BUG #18252: Assert in CheckOpSlotCompatibility() fails when recursive union filters tuples in non-recursive term
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #18279: Duplicate key violation and Deadlock when using ON CONFLICT/DO UPDATE with multiple unique indexes