Re: Soon-to-be-broken regression test case

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, Robert Haas <robertmhaas@gmail.com>, Jeevan Chalke <jeevan.chalke@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-10-11T20:45:44Z
Lists: pgsql-hackers
David Rowley <david.rowley@2ndquadrant.com> writes:
> I guess if we ever did something to break that then we'd need to not
> do anything when there are volatile functions present.

Yeah, nothing I'm doing here changes the rule that we don't flatten
sub-selects containing volatiles in their tlist.

> If people are
> writing that then probably they're doing so to trick the planner,
> perhaps to hide some stats that get outdated easily. I'd imagine we'd
> upset more people than we'd please.

The specific case I'm aware of is that people sometimes write
"(SELECT x)" rather than just "x" so as to make the calculation
be a done-only-once InitPlan.  That code path isn't affected by
this, either (and that's why the partition_prune tests didn't
change behavior).

It's fair to wonder whether partition_prune needs to be testing
other subplan cases besides InitPlans, but that seems like a
distinct issue.

			regards, tom lane


Commits

  1. Make some subquery-using test cases a bit more robust.

  2. Prevent generation of bogus subquery scan paths.