forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8bf66de
committed
Fix confusion about havingQual vs hasHavingQual in planner.
Preprocessing of the HAVING clause will reduce havingQual to NILif the clause is constant-TRUE. This is one case where thatconvention is rather unfortunate, because "HAVING TRUE" is not at allthe 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 thisby having a boolean hasHavingQual that records whether havingQual wasoriginally nonempty; places that just want to check whether HAVINGwas specified are supposed to consult that.I found three places that got that wrong. Fortunately, these couldonly affect cost estimates not correctness. It'd be hard evento demonstrate the errors; for example, the one in allpaths.c wouldonly matter in a query that has HAVING TRUE but no GROUP BY and noaggregates, which would require a completely variable-free SELECTlist, making the case probably of only academic interest. Hence,while these are worth fixing before someone copies the incorrectcoding 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.us1 parent997cd15 commit8bf66de
File tree
2 files changed
+3
-3
lines changed- contrib/postgres_fdw
- src/backend/optimizer/path
2 files changed
+3
-3
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3357 | 3357 |
| |
3358 | 3358 |
| |
3359 | 3359 |
| |
3360 |
| - | |
| 3360 | + | |
3361 | 3361 |
| |
3362 | 3362 |
| |
3363 | 3363 |
| |
| |||
3405 | 3405 |
| |
3406 | 3406 |
| |
3407 | 3407 |
| |
3408 |
| - | |
| 3408 | + | |
3409 | 3409 |
| |
3410 | 3410 |
| |
3411 | 3411 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2575 | 2575 |
| |
2576 | 2576 |
| |
2577 | 2577 |
| |
2578 |
| - | |
| 2578 | + | |
2579 | 2579 |
| |
2580 | 2580 |
| |
2581 | 2581 |
| |
|
0 commit comments
Comments
(0)