forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc7b3539
committed
Fix non-equivalence of VARIADIC and non-VARIADIC function call formats.
For variadic functions (other than VARIADIC ANY), the syntaxes foo(x,y,...)and foo(VARIADIC ARRAY[x,y,...]) should be considered equivalent, since theformer is converted to the latter at parse time. They have indeed beenequivalent, in all releases before 9.3. However, commit75b39e7 made anill-considered decision to record which syntax had been used in FuncExprnodes, and then to make equal() test that in checking node equality ---which caused the syntaxes to not be seen as equivalent by the planner.This is the underlying cause of bug #9817 from Dmitry Ryabov.It might seem that a quick fix would be to make equal() disregardFuncExpr.funcvariadic, but the same commit made that untenable, becausethe field actually *is* semantically significant for some VARIADIC ANYfunctions. This patch instead adopts the approach of redefiningfuncvariadic (and aggvariadic, in HEAD) as meaning that the last argumentis a variadic array, whether it got that way by parser intervention or wassupplied explicitly by the user. Therefore the value will always be truefor non-ANY variadic functions, restoring the principle of equivalence.(However, the planner will continue to consider use of VARIADIC as ameaningful difference for VARIADIC ANY functions, even though some suchfunctions might disregard it.)In HEAD, this change lets us simplify the decompilation logic inruleutils.c, since the funcvariadic/aggvariadic flag tells directly whetherto print VARIADIC. However, in 9.3 we have to continue to cope withexisting stored rules/views that might contain the previous definition.Fortunately, this just means no change in ruleutils.c, since its existingbehavior effectively ignores funcvariadic for all cases other than VARIADICANY functions.In HEAD, bump catversion to reflect the fact that FuncExpr.funcvariadicchanged meanings; this is sort of pro forma, since I don't believe anybuilt-in views are affected.Unfortunately, this patch doesn't magically fix everything for affected9.3 users. After installing 9.3.5, they might need to recreate theirrules/views/indexes containing variadic function calls in order to geteverything consistent with the new definition. As in the cited bug,the symptom of a problem would be failure to use a nominally matchingindex that has a variadic function call in its definition. We'll needto mention this in the 9.3.5 release notes.1 parent741364b commitc7b3539
File tree
7 files changed
+46
-38
lines changed- contrib/postgres_fdw
- doc/src/sgml
- src
- backend
- parser
- utils
- adt
- fmgr
- include
- catalog
- nodes
7 files changed
+46
-38
lines changedLines changed: 1 addition & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1548 | 1548 |
| |
1549 | 1549 |
| |
1550 | 1550 |
| |
1551 |
| - | |
1552 |
| - | |
1553 |
| - | |
1554 |
| - | |
1555 |
| - | |
1556 |
| - | |
1557 |
| - | |
1558 |
| - | |
1559 |
| - | |
| 1551 | + | |
1560 | 1552 |
| |
1561 | 1553 |
| |
1562 | 1554 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3152 | 3152 |
| |
3153 | 3153 |
| |
3154 | 3154 |
| |
3155 |
| - | |
3156 |
| - | |
3157 |
| - | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
3158 | 3159 |
| |
3159 | 3160 |
| |
3160 | 3161 |
| |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
555 | 555 |
| |
556 | 556 |
| |
557 | 557 |
| |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
558 | 569 |
| |
559 | 570 |
| |
560 | 571 |
| |
| |||
584 | 595 |
| |
585 | 596 |
| |
586 | 597 |
| |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
587 | 603 |
| |
588 | 604 |
| |
589 | 605 |
| |
|
Lines changed: 18 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
401 | 401 |
| |
402 | 402 |
| |
403 | 403 |
| |
404 |
| - | |
| 404 | + | |
405 | 405 |
| |
406 | 406 |
| |
407 | 407 |
| |
| |||
8849 | 8849 |
| |
8850 | 8850 |
| |
8851 | 8851 |
| |
8852 |
| - | |
| 8852 | + | |
8853 | 8853 |
| |
8854 |
| - | |
| 8854 | + | |
8855 | 8855 |
| |
8856 | 8856 |
| |
8857 | 8857 |
| |
8858 | 8858 |
| |
8859 | 8859 |
| |
8860 | 8860 |
| |
8861 |
| - | |
| 8861 | + | |
8862 | 8862 |
| |
8863 | 8863 |
| |
8864 | 8864 |
| |
| |||
8884 | 8884 |
| |
8885 | 8885 |
| |
8886 | 8886 |
| |
8887 |
| - | |
8888 |
| - | |
8889 |
| - | |
8890 |
| - | |
8891 |
| - | |
8892 |
| - | |
8893 |
| - | |
8894 |
| - | |
8895 |
| - | |
| 8887 | + | |
| 8888 | + | |
| 8889 | + | |
| 8890 | + | |
| 8891 | + | |
| 8892 | + | |
| 8893 | + | |
| 8894 | + | |
| 8895 | + | |
| 8896 | + | |
8896 | 8897 |
| |
8897 | 8898 |
| |
8898 | 8899 |
| |
8899 |
| - | |
8900 |
| - | |
8901 |
| - | |
8902 |
| - | |
8903 |
| - | |
8904 |
| - | |
8905 |
| - | |
8906 |
| - | |
8907 |
| - | |
| 8900 | + | |
| 8901 | + | |
| 8902 | + | |
8908 | 8903 |
| |
8909 | 8904 |
| |
8910 | 8905 |
| |
8911 | 8906 |
| |
8912 |
| - | |
| 8907 | + | |
8913 | 8908 |
| |
8914 | 8909 |
| |
8915 | 8910 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2449 | 2449 |
| |
2450 | 2450 |
| |
2451 | 2451 |
| |
| 2452 | + | |
| 2453 | + | |
2452 | 2454 |
| |
2453 | 2455 |
| |
2454 | 2456 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
257 | 257 |
| |
258 | 258 |
| |
259 | 259 |
| |
260 |
| - | |
| 260 | + | |
| 261 | + | |
261 | 262 |
| |
262 | 263 |
| |
263 | 264 |
| |
| |||
358 | 359 |
| |
359 | 360 |
| |
360 | 361 |
| |
361 |
| - | |
| 362 | + | |
| 363 | + | |
362 | 364 |
| |
363 | 365 |
| |
364 | 366 |
| |
|
0 commit comments
Comments
(0)