Thread

  1. Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs

    Alexander Lakhin <exclusion@gmail.com> — 2025-11-04T08:00:00Z

    Hello David,
    
    04.10.2025 06:55, David Rowley wrote:
    > On Fri, 3 Oct 2025 at 10:02, Tom Lane <tgl@sss.pgh.pa.us> wrote:
    >> David Rowley <dgrowleyml@gmail.com> writes:
    >>> An alternative way would be to propagate those during build_setop_child_paths()
    >> That answer works for me.  I was expecting you to just document the
    >> need for the extra check in is_dummy_rel ;-) ... but this way is
    >> perhaps better.
    > So, I pushed the UNION portion earlier, but on hacking more on the
    > EXCEPT/INTERSECT patch, I noticed that I don't have the target lists
    > correct when marking the top-level set op as dummy. ...
    
    Please look at a new anomaly, introduced with 03d40e4b5:
    CREATE TABLE t(i integer);
    CREATE TABLE pt(i integer) PARTITION BY LIST(i);
    
    SET enable_seqscan = 'off';
    SELECT * FROM t UNION SELECT * FROM t
    UNION ALL
    SELECT * FROM pt;
    produces:
    ERROR:  XX000: unrecognized node type: 0
    LOCATION:  create_plan_recurse, createplan.c:538
    
    
    Best regards.
    Alexander