Re: BUG #19742: `INTERSECT` under a `UNION ALL` with an empty arm fails with "could not find pathkey item t" - Mailing list pgsql-bugs

From shihao zhong
Subject Re: BUG #19742: `INTERSECT` under a `UNION ALL` with an empty arm fails with "could not find pathkey item t"
Date
Msg-id CAGRkXqQFkCL6=axWqL00wDO4pSY+Lu-jPc9w_HdefyU_SgAA2Q@mail.gmail.com
Whole thread
In response to Re: BUG #19742: `INTERSECT` under a `UNION ALL` with an empty arm fails with "could not find pathkey item t"  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #19742: `INTERSECT` under a `UNION ALL` with an empty arm fails with "could not find pathkey item t"
List pgsql-bugs
Hi Tom,

> There are other calls to create_append_path in prepunion.c, and I
> think they may all need to do likewise, but I didn't analyze them.

The EXCEPT ALL one needs it too.  With only your patch this still
fails:
    set enable_hashagg = off;
    (select a from d where a = 1 intersect select a from d where a = 1)
    except all select a from d where false;

The v2-0001 I posted upthread changes both places.  The partial
Append looks safe, its children always have NIL pathkeys.

Thanks,
Shihao

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #19742: `INTERSECT` under a `UNION ALL` with an empty arm fails with "could not find pathkey item t"
Next
From: shihao zhong
Date:
Subject: Re: BUG #19735: `jsonb_object_agg_unique_strict` drops a JSONB `null` value as if it were SQL NULL