pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs
Date: Mon, 06 Oct 2025 21:48:35 -0400
Message-ID: <2248554.1759801715@sss.pgh.pa.us> (raw)
In-Reply-To: <CAApHDvpVxP+y87i__H4dq_xFmOyq_hd1vWca=P+KhrQpFgRh8g@mail.gmail.com>
References: <CAApHDvri53PPF76c3M94_QNWbJfXjyCnjXuj_2=LYM-0m8WZtw@mail.gmail.com>
	<976130.1759375308@sss.pgh.pa.us>
	<CAApHDvpk88w3MrzgZShROjQw3NPK54YKr_hOi0++0QKGwTq+-g@mail.gmail.com>
	<1064547.1759418336@sss.pgh.pa.us>
	<CAApHDvpVYC43mi8atZ2Q39emK45xh7AaXetMJE9gJyV6sge_mg@mail.gmail.com>
	<1196118.1759438964@sss.pgh.pa.us>
	<CAApHDvrUASy9sfULMEsM2udvZJP6AoBRCZvHYXYxZTy2tX9FYw@mail.gmail.com>
	<1507624.1759592628@sss.pgh.pa.us>
	<CAApHDvo5v+dpos_4_CR49_2y8rpAbExBEmrYo0QGHagW8BQOzA@mail.gmail.com>
	<CAApHDvpVxP+y87i__H4dq_xFmOyq_hd1vWca=P+KhrQpFgRh8g@mail.gmail.com>

David Rowley <dgrowleyml@gmail.com> writes:
> The reason I didn't go down the route of SETOP_VAR was that it's still
> a hack, it's just making it look a bit more official.  I suppose the
> correct way to fix all this and get rid of the varno==0 stuff forever
> is to have a proper top-level RTE for the top-level set operation and
> make it so each child is an OTHER_MEMBER rel at that query level. It
> felt like going a bit too far to do something like that to fix this
> bug, so I didn't explore that further.

Yeah, I think "more RTEs" is the ultimate solution here, but it's
never risen to the top of my to-do list either.  I was kind of
thinking about an RTE per set-op child, though.  Not sure if one
for the top-level op, or one for an intermediate op, would help;
though it's certainly possible it would.

			regards, tom lane





view thread (23+ messages)  latest in thread

Message-ID: <2248554.1759801715@sss.pgh.pa.us>
Permalink:  ../2248554.1759801715@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2248554.1759801715@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dgrowleyml@gmail.com
  Subject: Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs
  In-Reply-To: <2248554.1759801715@sss.pgh.pa.us>
  References: <CAApHDvri53PPF76c3M94_QNWbJfXjyCnjXuj_2=LYM-0m8WZtw@mail.gmail.com> <976130.1759375308@sss.pgh.pa.us> <CAApHDvpk88w3MrzgZShROjQw3NPK54YKr_hOi0++0QKGwTq+-g@mail.gmail.com> <1064547.1759418336@sss.pgh.pa.us> <CAApHDvpVYC43mi8atZ2Q39emK45xh7AaXetMJE9gJyV6sge_mg@mail.gmail.com> <1196118.1759438964@sss.pgh.pa.us> <CAApHDvrUASy9sfULMEsM2udvZJP6AoBRCZvHYXYxZTy2tX9FYw@mail.gmail.com> <1507624.1759592628@sss.pgh.pa.us> <CAApHDvo5v+dpos_4_CR49_2y8rpAbExBEmrYo0QGHagW8BQOzA@mail.gmail.com> <CAApHDvpVxP+y87i__H4dq_xFmOyq_hd1vWca=P+KhrQpFgRh8g@mail.gmail.com> <2248554.1759801715@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox