postgresql/src/include/optimizer
Tom Lane 1aa8dad41f 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 copyright for 2022 2022-01-07 19:04:57 -05:00
clauses.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
cost.h Estimate cost of elided SubqueryScan, Append, MergeAppend nodes better. 2022-07-19 11:18:19 -04:00
geqo.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
geqo_copy.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_gene.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_misc.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_mutation.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_pool.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_random.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_recombination.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geqo_selection.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
inherit.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
joininfo.h Update copyright for 2022 2022-01-07 19:04:57 -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 copyright for 2022 2022-01-07 19:04:57 -05:00
paramassign.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pathnode.h Estimate cost of elided SubqueryScan, Append, MergeAppend nodes better. 2022-07-19 11:18:19 -04:00
paths.h Improve performance of ORDER BY / DISTINCT aggregates 2022-08-02 23:11:45 +12:00
placeholder.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
plancat.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
planmain.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
planner.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
prep.h Add support for MERGE SQL command 2022-03-28 16:47:48 +02:00
restrictinfo.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
subselect.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tlist.h Update copyright for 2022 2022-01-07 19:04:57 -05:00