Re: BUG #18252: Assert in CheckOpSlotCompatibility() fails when recursive union filters tuples in non-recursive term
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org, Andres Freund <andres@anarazel.de>
Date: 2024-01-10T07:46:12Z
Lists: 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
Commits
-
Fix typos in simplehash.h
- 141752bbb030 17.0 landed
-
Verify that expected slot types match returned slot types.
- 15d8f83128e1 12.0 cited