forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit624046a
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 parent3814096 commit624046a
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 | |
---|---|---|---|
| |||
418 | 418 |
| |
419 | 419 |
| |
420 | 420 |
| |
421 |
| - | |
422 |
| - | |
423 | 421 |
| |
424 | 422 |
| |
425 | 423 |
| |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
426 | 428 |
| |
427 | 429 |
| |
428 | 430 |
| |
| |||
1255 | 1257 |
| |
1256 | 1258 |
| |
1257 | 1259 |
| |
1258 |
| - | |
1259 |
| - | |
1260 | 1260 |
| |
1261 | 1261 |
| |
1262 | 1262 |
| |
| |||
1266 | 1266 |
| |
1267 | 1267 |
| |
1268 | 1268 |
| |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
1269 | 1273 |
| |
1270 | 1274 |
| |
1271 | 1275 |
| |
| |||
1715 | 1719 |
| |
1716 | 1720 |
| |
1717 | 1721 |
| |
1718 |
| - | |
1719 |
| - | |
1720 | 1722 |
| |
1721 | 1723 |
| |
1722 | 1724 |
| |
| |||
1726 | 1728 |
| |
1727 | 1729 |
| |
1728 | 1730 |
| |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
1729 | 1735 |
| |
1730 | 1736 |
| |
1731 | 1737 |
| |
|
Lines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2047 | 2047 |
| |
2048 | 2048 |
| |
2049 | 2049 |
| |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + |
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
921 | 921 |
| |
922 | 922 |
| |
923 | 923 |
| |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
924 | 949 |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
900 | 900 |
| |
901 | 901 |
| |
902 | 902 |
| |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + |
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
255 | 255 |
| |
256 | 256 |
| |
257 | 257 |
| |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
258 | 269 |
|
0 commit comments
Comments
(0)