forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit40d1bde
committed
Fix confusion about the return rowtype of SQL-language procedures.
There is a very ancient hack in check_sql_fn_retval that allows asingle SELECT targetlist entry of composite type to be taken assupplying all the output columns of a function returning composite.(This is grotty and fundamentally ambiguous, but it's really hardto do nested composite-returning functions without it.)As far as I know, that doesn't cause any problems in ordinaryfunctions. It's disastrous for procedures however. All proceduresthat have any output parameters are labeled with prorettype RECORD,and the CALL code expects it will get back a record with one columnper output parameter, regardless of whether any of those parametersis composite. Doing something else leads to an assertion failureor core dump.This is simple enough to fix: we just need to not apply that rulewhen considering procedures. However, that requires adding anotherargument to check_sql_fn_retval, which at least in principle might begetting called by external callers. Therefore, in the back branchesconvert check_sql_fn_retval into an ABI-preserving wrapper around anew function check_sql_fn_retval_ext.Per report from Yahor Yuzefovich. This has been broken since weimplemented procedures, so back-patch to all supported branches.Discussion:https://postgr.es/m/CABz5gWHSjj2df6uG0NRiDhZ_Uz=Y8t0FJP-_SVSsRsnrQT76Gg@mail.gmail.com1 parent539e328 commit40d1bde
File tree
6 files changed
+69
-18
lines changed- src
- backend
- catalog
- executor
- optimizer/util
- include/executor
- test/regress
- expected
- sql
6 files changed
+69
-18
lines changedLines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
959 | 959 |
| |
960 | 960 |
| |
961 | 961 |
| |
962 |
| - | |
963 |
| - | |
964 |
| - | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
965 | 966 |
| |
966 | 967 |
| |
967 | 968 |
| |
|
Lines changed: 28 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
743 | 743 |
| |
744 | 744 |
| |
745 | 745 |
| |
746 |
| - | |
747 |
| - | |
748 |
| - | |
749 |
| - | |
750 |
| - | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
751 | 752 |
| |
752 | 753 |
| |
753 | 754 |
| |
| |||
1608 | 1609 |
| |
1609 | 1610 |
| |
1610 | 1611 |
| |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
1611 | 1627 |
| |
1612 | 1628 |
| |
1613 | 1629 |
| |
| |||
1625 | 1641 |
| |
1626 | 1642 |
| |
1627 | 1643 |
| |
1628 |
| - | |
| 1644 | + | |
1629 | 1645 |
| |
1630 | 1646 |
| |
1631 | 1647 |
| |
| |||
1780 | 1796 |
| |
1781 | 1797 |
| |
1782 | 1798 |
| |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
1783 | 1804 |
| |
1784 |
| - | |
| 1805 | + | |
1785 | 1806 |
| |
1786 | 1807 |
| |
1787 | 1808 |
| |
|
Lines changed: 8 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4708 | 4708 |
| |
4709 | 4709 |
| |
4710 | 4710 |
| |
4711 |
| - | |
4712 |
| - | |
4713 |
| - | |
| 4711 | + | |
| 4712 | + | |
| 4713 | + | |
| 4714 | + | |
4714 | 4715 |
| |
4715 | 4716 |
| |
4716 | 4717 |
| |
| |||
5254 | 5255 |
| |
5255 | 5256 |
| |
5256 | 5257 |
| |
5257 |
| - | |
5258 |
| - | |
5259 |
| - | |
| 5258 | + | |
| 5259 | + | |
| 5260 | + | |
| 5261 | + | |
5260 | 5262 |
| |
5261 | 5263 |
| |
5262 | 5264 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
50 | 50 |
| |
51 | 51 |
| |
52 | 52 |
| |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
53 | 59 |
| |
54 | 60 |
| |
55 | 61 |
|
Lines changed: 13 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
148 | 148 |
| |
149 | 149 |
| |
150 | 150 |
| |
151 |
| - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
152 | 164 |
| |
153 | 165 |
| |
154 | 166 |
| |
|
Lines changed: 10 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
90 | 90 |
| |
91 | 91 |
| |
92 | 92 |
| |
93 |
| - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
94 | 103 |
| |
95 | 104 |
| |
96 | 105 |
| |
|
0 commit comments
Comments
(0)