postgresql/contrib/postgres_fdw
Tom Lane 8bf66dedd8 Fix confusion about havingQual vs hasHavingQual in planner.
Preprocessing of the HAVING clause will reduce havingQual to NIL
if the clause is constant-TRUE.  This is one case where that
convention is rather unfortunate, because "HAVING TRUE" is not at all
the same as not having any HAVING clause at all.  (Per the SQL spec,
it still forces the query to be grouped.)  The planner deals with this
by having a boolean hasHavingQual that records whether havingQual was
originally nonempty; places that just want to check whether HAVING
was specified are supposed to consult that.

I found three places that got that wrong.  Fortunately, these could
only affect cost estimates not correctness.  It'd be hard even
to demonstrate the errors; for example, the one in allpaths.c would
only matter in a query that has HAVING TRUE but no GROUP BY and no
aggregates, which would require a completely variable-free SELECT
list, making the case probably of only academic interest.  Hence,
while these are worth fixing before someone copies the incorrect
coding somewhere more critical, they don't seem worth back-patching.
I didn't bother trying to devise regression tests, either.

Discussion: https://postgr.es/m/2503888.1666042643@sss.pgh.pa.us
2022-10-18 10:44:34 -04:00
..
expected Disallow MERGE cleanly for foreign partitions 2022-10-15 19:24:26 +02:00
sql Disallow MERGE cleanly for foreign partitions 2022-10-15 19:24:26 +02:00
.gitignore Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
Makefile postgres_fdw: Add function to list cached connections to foreign servers. 2021-01-18 15:11:08 +09:00
connection.c Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:35 +09:00
deparse.c Fix final warnings produced by -Wshadow=compatible-local 2022-10-07 13:13:27 +13:00
meson.build meson: Add windows resource files 2022-10-05 09:56:05 -07:00
option.c Adjust assorted hint messages that list all valid options. 2022-09-16 14:53:12 +02:00
postgres_fdw--1.0--1.1.sql postgres_fdw: Add functions to discard cached connections. 2021-01-26 15:35:54 +09:00
postgres_fdw--1.0.sql Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
postgres_fdw.c Fix confusion about havingQual vs hasHavingQual in planner. 2022-10-18 10:44:34 -04:00
postgres_fdw.control postgres_fdw: Add function to list cached connections to foreign servers. 2021-01-18 15:11:08 +09:00
postgres_fdw.h Harmonize parameter names in contrib code. 2022-09-22 13:59:20 -07:00
shippable.c Update copyright for 2022 2022-01-07 19:04:57 -05:00