postgresql/src/include/optimizer
Tom Lane da4ed75881 Fix incorrect tests for SRFs in relation_can_be_sorted_early().
Commit fac1b470a thought we could check for set-returning functions
by testing only the top-level node in an expression tree.  This is
wrong in itself, and to make matters worse it encouraged others
to make the same mistake, by exporting tlist.c's special-purpose
IS_SRF_CALL() as a widely-visible macro.  I can't find any evidence
that anyone's taken the bait, but it was only a matter of time.

Use expression_returns_set() instead, and stuff the IS_SRF_CALL()
genie back in its bottle, this time with a warning label.  I also
added a couple of cross-reference comments.

After a fair amount of fooling around, I've despaired of making
a robust test case that exposes the bug reliably, so no test case
here.  (Note that the test case added by fac1b470a is itself
broken, in that it doesn't notice if you remove the code change.
The repro given by the bug submitter currently doesn't fail either
in v15 or HEAD, though I suspect that may indicate an unrelated bug.)

Per bug #17564 from Martijn van Oosterhout.  Back-patch to v13,
as the faulty patch was.

Discussion: https://postgr.es/m/17564-c7472c2f90ef2da3@postgresql.org
2022-08-03 17:33:42 -04:00
..
appendinfo.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
clauses.h Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00
cost.h Remove hashagg_avoid_disk_plan GUC. 2020-07-27 17:53:17 -07:00
geqo.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_copy.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_gene.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_misc.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_mutation.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_pool.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_random.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_recombination.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geqo_selection.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
inherit.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
joininfo.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
optimizer.h Fix incorrect tests for SRFs in relation_can_be_sorted_early(). 2022-08-03 17:33:42 -04:00
orclauses.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
paramassign.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pathnode.h Fix missing outfuncs.c support for IncrementalSortPath. 2020-11-30 16:33:09 -05:00
paths.h Fix planner failure in some cases of sorting by an aggregate. 2021-04-20 11:32:02 -04:00
placeholder.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
plancat.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
planmain.h Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00
planner.h Allow the planner-related functions and hook to accept the query string. 2020-03-30 13:51:05 +09:00
prep.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
restrictinfo.h Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00
subselect.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tlist.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00