- Notifications
You must be signed in to change notification settings - Fork5
Commit20a3ddb
committed
Fix the handling of sub-SELECTs appearing in the arguments of an outer-level
aggregate function. By definition, such a sub-SELECT cannot reference anyvariables of query levels between itself and the aggregate's semantic level(else the aggregate would've been assigned to that lower level instead).So the correct, most efficient implementation is to treat the sub-SELECT asbeing a sub-select of that outer query level, not the level the aggregatesyntactically appears in. Not doing so also confuses the heck out of ourparameter-passing logic, as illustrated in bug report from Daniel Grace.Fortunately, we were already copying the whole Aggref expression up to theouter query level, so all that's needed is to delay SS_process_sublinksprocessing of the sub-SELECT until control returns to the outer level.This has been broken since we introduced spec-compliant treatment ofouter aggregates in 7.4; so patch all the way back.1 parent245316e commit20a3ddb
File tree
3 files changed
+48
-3
lines changed- src
- backend/optimizer/plan
- test/regress
- expected
- sql
3 files changed
+48
-3
lines changedLines changed: 32 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
437 | 437 |
| |
438 | 438 |
| |
439 | 439 |
| |
440 |
| - | |
| 440 | + | |
| 441 | + | |
441 | 442 |
| |
442 | 443 |
| |
443 | 444 |
| |
444 | 445 |
| |
445 | 446 |
| |
446 |
| - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
447 | 458 |
| |
448 | 459 |
| |
449 | 460 |
| |
| |||
1531 | 1542 |
| |
1532 | 1543 |
| |
1533 | 1544 |
| |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
1534 | 1551 |
| |
1535 | 1552 |
| |
1536 | 1553 |
| |
| |||
1607 | 1624 |
| |
1608 | 1625 |
| |
1609 | 1626 |
| |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
1610 | 1639 |
| |
1611 | 1640 |
| |
1612 | 1641 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
295 | 295 |
| |
296 | 296 |
| |
297 | 297 |
| |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
298 | 308 |
| |
299 | 309 |
| |
300 | 310 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
80 | 80 |
| |
81 | 81 |
| |
82 | 82 |
| |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
83 | 89 |
| |
84 | 90 |
| |
85 | 91 |
| |
|
0 commit comments
Comments
(0)