pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix incorrect tests for SRFs in relation_can_be_sorted_early().
4+ messages / 1 participants
[nested] [flat]

* pgsql: Fix incorrect tests for SRFs in relation_can_be_sorted_early().
@ 2022-08-03 21:33  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-03 21:33 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/445b9020c97f3e1ff63534efeec5a280e33d2495

Modified Files
--------------
src/backend/nodes/nodeFuncs.c           |  6 ++++++
src/backend/optimizer/path/equivclass.c |  4 ++--
src/backend/optimizer/util/tlist.c      | 11 +++++++++++
src/include/optimizer/optimizer.h       |  5 -----
4 files changed, 19 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix incorrect tests for SRFs in relation_can_be_sorted_early().
@ 2022-08-03 21:33  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-03 21:33 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/da4ed7588132db44ab11bf52bad0472eb0c868e4

Modified Files
--------------
src/backend/nodes/nodeFuncs.c           |  6 ++++++
src/backend/optimizer/path/equivclass.c |  4 ++--
src/backend/optimizer/util/tlist.c      | 11 +++++++++++
src/include/optimizer/optimizer.h       |  5 -----
4 files changed, 19 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix incorrect tests for SRFs in relation_can_be_sorted_early().
@ 2022-08-03 21:33  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-03 21:33 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/14168d57bb91e889ff03b3098f67299608289573

Modified Files
--------------
src/backend/nodes/nodeFuncs.c           |  6 ++++++
src/backend/optimizer/path/equivclass.c |  4 ++--
src/backend/optimizer/util/tlist.c      | 11 +++++++++++
src/include/optimizer/optimizer.h       |  5 -----
4 files changed, 19 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix incorrect tests for SRFs in relation_can_be_sorted_early().
@ 2022-08-03 21:33  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-03 21:33 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1aa8dad41ffad99923a658389ee948e88394491c

Modified Files
--------------
src/backend/nodes/nodeFuncs.c           |  6 ++++++
src/backend/optimizer/path/equivclass.c |  4 ++--
src/backend/optimizer/util/tlist.c      | 11 +++++++++++
src/include/optimizer/optimizer.h       |  5 -----
4 files changed, 19 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2022-08-03 21:33 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03 21:33 pgsql: Fix incorrect tests for SRFs in relation_can_be_sorted_early(). Tom Lane <tgl@sss.pgh.pa.us>
2022-08-03 21:33 pgsql: Fix incorrect tests for SRFs in relation_can_be_sorted_early(). Tom Lane <tgl@sss.pgh.pa.us>
2022-08-03 21:33 pgsql: Fix incorrect tests for SRFs in relation_can_be_sorted_early(). Tom Lane <tgl@sss.pgh.pa.us>
2022-08-03 21:33 pgsql: Fix incorrect tests for SRFs in relation_can_be_sorted_early(). Tom Lane <tgl@sss.pgh.pa.us>

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