David Rowley <david.row...@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

Reply via email to