forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc402b02
committed
Fix old bug with coercing the result of a COLLATE expression.
There are hacks in parse_coerce.c to push down a requested coercionto below any CollateExpr that may appear. However, we did that evenif the requested data type is non-collatable, leading to an invalidexpression tree in which CollateExpr is applied to a non-collatabletype. The fix is just to drop the CollateExpr altogether, reasoningthat it's useless.This bug is ten years old, dating to the original addition ofCOLLATE support. The lack of field complaints suggests that therearen't a lot of user-visible consequences. We noticed the problembecause it would trigger an assertion in DefineVirtualRelation ifthe invalid structure appears as an output column of a view; however,in a non-assert build, you don't see a crash just a (subtly incorrect)complaint about applying collation to a non-collatable type. I foundthat by putting the incorrect structure further down in a view, I couldmake a view definition that would fail dump/reload, per the addedregression test case. But CollateExpr doesn't do anything at run-time,so this likely doesn't lead to any really exciting consequences.Per report from Yulin Pei. Back-patch to all supported branches.Discussion:https://postgr.es/m/HK0PR01MB22744393C474D503E16C8509F4709@HK0PR01MB2274.apcprd01.prod.exchangelabs.com1 parent6787e53 commitc402b02
File tree
3 files changed
+39
-12
lines changed- src
- backend/parser
- test/regress
- expected
- sql
3 files changed
+39
-12
lines changedLines changed: 18 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
95 | 95 |
| |
96 | 96 |
| |
97 | 97 |
| |
| 98 | + | |
98 | 99 |
| |
99 | 100 |
| |
100 | 101 |
| |
| |||
114 | 115 |
| |
115 | 116 |
| |
116 | 117 |
| |
117 |
| - | |
| 118 | + | |
118 | 119 |
| |
119 | 120 |
| |
120 | 121 |
| |
| |||
388 | 389 |
| |
389 | 390 |
| |
390 | 391 |
| |
391 |
| - | |
392 |
| - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
393 | 395 |
| |
394 | 396 |
| |
395 | 397 |
| |
396 |
| - | |
397 | 398 |
| |
398 |
| - | |
399 |
| - | |
400 |
| - | |
401 |
| - | |
402 |
| - | |
403 |
| - | |
404 |
| - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
405 | 412 |
| |
406 | 413 |
| |
407 | 414 |
| |
|
Lines changed: 15 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
688 | 688 |
| |
689 | 689 |
| |
690 | 690 |
| |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
691 | 704 |
| |
692 | 705 |
| |
693 | 706 |
| |
694 | 707 |
| |
695 | 708 |
| |
696 | 709 |
| |
697 |
| - | |
| 710 | + | |
698 | 711 |
| |
699 | 712 |
| |
700 | 713 |
| |
| |||
713 | 726 |
| |
714 | 727 |
| |
715 | 728 |
| |
| 729 | + |
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
266 | 266 |
| |
267 | 267 |
| |
268 | 268 |
| |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
269 | 275 |
| |
270 | 276 |
| |
271 | 277 |
| |
|
0 commit comments
Comments
(0)