forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit37d6d07
committed
Throw error for indeterminate collation of an ORDER/GROUP/DISTINCT target.
This restores a parse error that was thrown (though only in the ORDER BYcase) by the original collation patch. I had removed it in my recentrevisions because it was thrown at a place where collations now haven'tbeen computed yet; but I thought of another way to handle it.Throwing the error at parse time, rather than leaving it to be done atruntime, is good because a syntax error pointer is helpful for localizingthe problem. We can reasonably assume that the comparison function for acollatable datatype will complain if it doesn't have a collation to use.Now the planner might choose to implement GROUP or DISTINCT via hashing,in which case no runtime error would actually occur, but it seems betterto throw error consistently rather than let the error depend on what theplanner chooses to do. Another possible objection is that the user mightspecify a nondefault sort operator that doesn't care about collation... but that's surely an uncommon usage, and it wouldn't hurt him to throwin a COLLATE clause anyway. This change also makes the ORDER BY/GROUPBY/DISTINCT case more consistent with the UNION/INTERSECT/EXCEPT case,which was already coded to throw this error even though the same objectionscould be raised there.1 parent1192ba8 commit37d6d07
File tree
5 files changed
+36
-0
lines changed- src
- backend/parser
- test/regress
- expected
- sql
5 files changed
+36
-0
lines changedLines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
533 | 533 |
| |
534 | 534 |
| |
535 | 535 |
| |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
536 | 560 |
| |
537 | 561 |
| |
538 | 562 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
637 | 637 |
| |
638 | 638 |
| |
639 | 639 |
| |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
640 | 645 |
| |
641 | 646 |
| |
642 | 647 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
443 | 443 |
| |
444 | 444 |
| |
445 | 445 |
| |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
446 | 451 |
| |
447 | 452 |
| |
448 | 453 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
193 | 193 |
| |
194 | 194 |
| |
195 | 195 |
| |
| 196 | + | |
196 | 197 |
| |
197 | 198 |
| |
198 | 199 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
145 | 145 |
| |
146 | 146 |
| |
147 | 147 |
| |
| 148 | + | |
148 | 149 |
| |
149 | 150 |
| |
150 | 151 |
| |
|
0 commit comments
Comments
(0)