forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb97a346
committed
Consider syntactic form when disambiguating function vs column reference.
Postgres has traditionally considered the syntactic forms f(x) and x.fto be equivalent, allowing tricks such as writing a function and thenusing it as though it were a computed-on-demand column. However, ourbehavior when both interpretations are feasible left something to bedesired: we always chose the column interpretation. This could leadto very surprising results, as in a recent bug report from Neil Conway.It also created a dump-and-reload hazard, since what was a functioncall in a dumped view could get interpreted as a column referenceat reload, if a matching column name had been added to the underlyingtable since the view was created.What seems better, in ambiguous situations, is to prefer the choicematching the syntactic form of the reference. This seems much lessastonishing in general, and it fixes the dump/reload hazard.Although this could be called a bug fix, there have been few complaintsand there's some small risk of breaking applications that depend on theold behavior, so no back-patch. It does seem reasonable to slip itinto v11, though.Discussion:https://postgr.es/m/CAOW5sYa3Wp7KozCuzjOdw6PiOYPi6D=VvRybtH2S=2C0SVmRmA@mail.gmail.com1 parent4c8156d commitb97a346
File tree
4 files changed
+148
-50
lines changed- doc/src/sgml
- src
- backend/parser
- test/regress
- expected
- sql
4 files changed
+148
-50
lines changedLines changed: 6 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
441 | 441 |
| |
442 | 442 |
| |
443 | 443 |
| |
444 |
| - | |
445 |
| - | |
446 |
| - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
447 | 450 |
| |
448 | 451 |
| |
449 | 452 |
| |
|
Lines changed: 78 additions & 47 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
49 | 49 |
| |
50 | 50 |
| |
51 | 51 |
| |
52 |
| - | |
53 |
| - | |
54 |
| - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
55 | 58 |
| |
56 | 59 |
| |
57 |
| - | |
58 |
| - | |
59 |
| - | |
60 |
| - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
61 | 63 |
| |
62 | 64 |
| |
63 | 65 |
| |
| |||
84 | 86 |
| |
85 | 87 |
| |
86 | 88 |
| |
| 89 | + | |
87 | 90 |
| |
88 | 91 |
| |
89 | 92 |
| |
| |||
202 | 205 |
| |
203 | 206 |
| |
204 | 207 |
| |
205 |
| - | |
206 |
| - | |
207 |
| - | |
208 |
| - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
209 | 213 |
| |
210 |
| - | |
211 |
| - | |
212 |
| - | |
213 |
| - | |
214 |
| - | |
215 |
| - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
216 | 221 |
| |
217 |
| - | |
218 |
| - | |
219 |
| - | |
220 |
| - | |
221 |
| - | |
222 |
| - | |
223 |
| - | |
224 |
| - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
225 | 233 |
| |
226 |
| - | |
227 |
| - | |
228 |
| - | |
229 |
| - | |
230 |
| - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
231 | 238 |
| |
232 | 239 |
| |
233 | 240 |
| |
234 |
| - | |
235 | 241 |
| |
236 | 242 |
| |
237 | 243 |
| |
| |||
334 | 340 |
| |
335 | 341 |
| |
336 | 342 |
| |
337 |
| - | |
| 343 | + | |
338 | 344 |
| |
339 | 345 |
| |
340 | 346 |
| |
| |||
524 | 530 |
| |
525 | 531 |
| |
526 | 532 |
| |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
527 | 554 |
| |
528 | 555 |
| |
529 | 556 |
| |
530 |
| - | |
531 |
| - | |
532 |
| - | |
533 |
| - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
534 | 560 |
| |
535 | 561 |
| |
536 | 562 |
| |
537 | 563 |
| |
538 | 564 |
| |
539 |
| - | |
| 565 | + | |
540 | 566 |
| |
541 |
| - | |
542 |
| - | |
543 |
| - | |
544 |
| - | |
545 |
| - | |
546 |
| - | |
547 |
| - | |
548 |
| - | |
549 |
| - | |
550 |
| - | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
551 | 582 |
| |
552 | 583 |
| |
553 | 584 |
| |
|
Lines changed: 44 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
797 | 797 |
| |
798 | 798 |
| |
799 | 799 |
| |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
800 | 844 |
| |
801 | 845 |
| |
802 | 846 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
345 | 345 |
| |
346 | 346 |
| |
347 | 347 |
| |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
348 | 368 |
| |
349 | 369 |
| |
350 | 370 |
| |
|
0 commit comments
Comments
(0)