- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitb73e6d7
committed
Fix erroneous construction of functions' dependencies on transforms.
The list of transform objects that a function should use is specifiedin CREATE FUNCTION's TRANSFORM clause, and then represented indirectlyin pg_proc.protrftypes. However, ProcedureCreate completely ignoredthat for purposes of constructing pg_depend entries, and instead madethe function depend on any transforms that exist for its parameter orreturn data types. This is bad in both directions: the function couldbe made dependent on a transform it does not actually use, or itcould try to use a transform that's since been dropped. (The latterscenario would require use of a transform that's not for any of theparameter or return types, but that seems legit for cases where thefunction performs SQL operations internally.)To fix, pass in the list of transform objects that CreateFunctionidentified, and build pg_depend entries from that not from theparameter/return types. This results in changes in the expectedtest outputs in contrib/bool_plperl, which I guess are due todifferent ordering of pg_depend entries -- that test case issurely not exercising either of the problem scenarios.This fix is not back-patchable as-is: changing the signature ofProcedureCreate seems too risky in stable branches. We coulddo something like making ProcedureCreate a wrapper aroundProcedureCreateExt or so. However, I'm more inclined to donothing in the back branches. We had no field complaints up tonow, so the hazards don't seem to be a big issue in practice.And we couldn't do anything about existing pg_depend entries,so a back-patched fix would result in a mishmash of dependenciescreated according to different rules. That cure could be worsethan the disease, perhaps.I bumped catversion just to lay down a marker that the expectedcontents of pg_depend are a bit different than before.Reported-by: Chapman Flack <jcflack@acm.org>Author: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/3112950.1743984111@sss.pgh.pa.us1 parenta379061 commitb73e6d7
File tree
8 files changed
+52
-22
lines changed- contrib/bool_plperl/expected
- src
- backend
- catalog
- commands
- include/catalog
8 files changed
+52
-22
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
104 | 104 |
| |
105 | 105 |
| |
106 | 106 |
| |
107 |
| - | |
108 |
| - | |
| 107 | + | |
109 | 108 |
| |
110 | 109 |
| |
111 | 110 |
| |
112 | 111 |
| |
| 112 | + |
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
104 | 104 |
| |
105 | 105 |
| |
106 | 106 |
| |
107 |
| - | |
108 |
| - | |
| 107 | + | |
109 | 108 |
| |
110 | 109 |
| |
111 | 110 |
| |
112 | 111 |
| |
| 112 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
637 | 637 |
| |
638 | 638 |
| |
639 | 639 |
| |
| 640 | + | |
640 | 641 |
| |
641 | 642 |
| |
642 | 643 |
| |
|
Lines changed: 36 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
30 | 29 |
| |
31 | 30 |
| |
32 | 31 |
| |
| |||
61 | 60 |
| |
62 | 61 |
| |
63 | 62 |
| |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
64 | 92 |
| |
65 | 93 |
| |
66 | 94 |
| |
| |||
90 | 118 |
| |
91 | 119 |
| |
92 | 120 |
| |
| 121 | + | |
93 | 122 |
| |
94 | 123 |
| |
95 | 124 |
| |
| |||
115 | 144 |
| |
116 | 145 |
| |
117 | 146 |
| |
118 |
| - | |
119 | 147 |
| |
120 | 148 |
| |
121 | 149 |
| |
| |||
609 | 637 |
| |
610 | 638 |
| |
611 | 639 |
| |
612 |
| - | |
613 |
| - | |
614 |
| - | |
615 |
| - | |
616 |
| - | |
617 |
| - | |
618 |
| - | |
619 | 640 |
| |
620 | 641 |
| |
621 | 642 |
| |
622 | 643 |
| |
623 | 644 |
| |
| 645 | + | |
624 | 646 |
| |
625 |
| - | |
626 |
| - | |
627 |
| - | |
628 |
| - | |
629 |
| - | |
630 |
| - | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
631 | 652 |
| |
632 | 653 |
| |
633 | 654 |
| |
|
Lines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1046 | 1046 |
| |
1047 | 1047 |
| |
1048 | 1048 |
| |
| 1049 | + | |
1049 | 1050 |
| |
1050 | 1051 |
| |
1051 | 1052 |
| |
| |||
1157 | 1158 |
| |
1158 | 1159 |
| |
1159 | 1160 |
| |
| 1161 | + | |
1160 | 1162 |
| |
1161 | 1163 |
| |
1162 |
| - | |
1163 |
| - | |
| 1164 | + | |
1164 | 1165 |
| |
| 1166 | + | |
1165 | 1167 |
| |
1166 | 1168 |
| |
1167 | 1169 |
| |
| |||
1292 | 1294 |
| |
1293 | 1295 |
| |
1294 | 1296 |
| |
| 1297 | + | |
1295 | 1298 |
| |
1296 | 1299 |
| |
1297 | 1300 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1810 | 1810 |
| |
1811 | 1811 |
| |
1812 | 1812 |
| |
| 1813 | + | |
1813 | 1814 |
| |
1814 | 1815 |
| |
1815 | 1816 |
| |
| |||
1875 | 1876 |
| |
1876 | 1877 |
| |
1877 | 1878 |
| |
| 1879 | + | |
1878 | 1880 |
| |
1879 | 1881 |
| |
1880 | 1882 |
| |
| |||
1919 | 1921 |
| |
1920 | 1922 |
| |
1921 | 1923 |
| |
| 1924 | + | |
1922 | 1925 |
| |
1923 | 1926 |
| |
1924 | 1927 |
| |
| |||
1957 | 1960 |
| |
1958 | 1961 |
| |
1959 | 1962 |
| |
| 1963 | + | |
1960 | 1964 |
| |
1961 | 1965 |
| |
1962 | 1966 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
60 |
| - | |
| 60 | + | |
61 | 61 |
| |
62 | 62 |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
211 | 211 |
| |
212 | 212 |
| |
213 | 213 |
| |
| 214 | + | |
214 | 215 |
| |
215 | 216 |
| |
216 | 217 |
| |
|
0 commit comments
Comments
(0)