- Notifications
You must be signed in to change notification settings - Fork28
Commitd16d453
committed
Postpone aggregate checks until after collation is assigned.
Previously, parseCheckAggregates was run beforeassign_query_collations, but this causes problems if any expressionhas already had a collation assigned by some transform function (e.g.transformCaseExpr) before parseCheckAggregates runs. The differingcollations would cause expressions not to be recognized as equal tothe ones in the GROUP BY clause, leading to spurious errors aboutunaggregated column references.The result was that CASE expr WHEN val ... would fail when "expr"contained a GROUPING() expression or matched one of the group byexpressions, and where collatable types were involved; whereas thesupposedly identical CASE WHEN expr = val ... would succeed.Backpatch all the way; this appears to have been wrong ever sincecollations were introduced.Per report from Guillaume Lelarge, analysis and patch by me.Discussion:https://postgr.es/m/CAECtzeVSO_US8C2Khgfv54ZMUOBR4sWq+6_bLrETnWExHT=rFg@mail.gmail.comDiscussion:https://postgr.es/m/87muo0k0c7.fsf@news-spur.riddles.org.uk1 parent2472ea0 commitd16d453
File tree
5 files changed
+75
-6
lines changed- src
- backend/parser
- test/regress
- expected
- sql
5 files changed
+75
-6
lines changedLines changed: 12 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
451 | 451 |
| |
452 | 452 |
| |
453 | 453 |
| |
454 |
| - | |
455 |
| - | |
456 | 454 |
| |
457 | 455 |
| |
458 | 456 |
| |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
459 | 461 |
| |
460 | 462 |
| |
461 | 463 |
| |
| |||
1319 | 1321 |
| |
1320 | 1322 |
| |
1321 | 1323 |
| |
1322 |
| - | |
1323 |
| - | |
1324 | 1324 |
| |
1325 | 1325 |
| |
1326 | 1326 |
| |
| |||
1330 | 1330 |
| |
1331 | 1331 |
| |
1332 | 1332 |
| |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
1333 | 1337 |
| |
1334 | 1338 |
| |
1335 | 1339 |
| |
| |||
1791 | 1795 |
| |
1792 | 1796 |
| |
1793 | 1797 |
| |
1794 |
| - | |
1795 |
| - | |
1796 | 1798 |
| |
1797 | 1799 |
| |
1798 | 1800 |
| |
| |||
1802 | 1804 |
| |
1803 | 1805 |
| |
1804 | 1806 |
| |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
1805 | 1811 |
| |
1806 | 1812 |
| |
1807 | 1813 |
| |
|
Lines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2244 | 2244 |
| |
2245 | 2245 |
| |
2246 | 2246 |
| |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + |
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1540 | 1540 |
| |
1541 | 1541 |
| |
1542 | 1542 |
| |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
1543 | 1568 |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
976 | 976 |
| |
977 | 977 |
| |
978 | 978 |
| |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + |
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
415 | 415 |
| |
416 | 416 |
| |
417 | 417 |
| |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
418 | 429 |
|
0 commit comments
Comments
(0)