forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitccd10a9
committed
Tighten enforcement of variable CONSTANT markings in plpgsql.
I noticed that plpgsql would allow assignment of a new value to avariable even when that variable is marked CONSTANT, if the variableis used as an output parameter in CALL or is a refcursor variablethat OPEN assigns a new value to. Fix these oversights.In the CALL case, the check has to be done at runtime because wecannot know at parse time which parameters are OUT parameters.For OPEN, it seems best to likewise enforce at runtime becausethen we needn't throw error if the variable has a nonnull value(since OPEN will only try to overwrite a null value).Although this is surely a bug fix, no back-patch: it seems unlikelythat anyone would thank us for breaking formerly-working code inminor releases.Discussion:https://postgr.es/m/214453.1651182729@sss.pgh.pa.us1 parenta79153b commitccd10a9
File tree
5 files changed
+134
-4
lines changed- src
- pl/plpgsql/src
- expected
- sql
- test/regress
- expected
- sql
5 files changed
+134
-4
lines changedLines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
122 | 122 |
| |
123 | 123 |
| |
124 | 124 |
| |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
125 | 137 |
| |
126 | 138 |
| |
127 | 139 |
| |
|
Lines changed: 59 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
331 | 331 |
| |
332 | 332 |
| |
333 | 333 |
| |
| 334 | + | |
334 | 335 |
| |
335 | 336 |
| |
336 | 337 |
| |
| |||
2342 | 2343 |
| |
2343 | 2344 |
| |
2344 | 2345 |
| |
| 2346 | + | |
2345 | 2347 |
| |
2346 | 2348 |
| |
2347 |
| - | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
2348 | 2353 |
| |
2349 | 2354 |
| |
2350 | 2355 |
| |
| |||
2926 | 2931 |
| |
2927 | 2932 |
| |
2928 | 2933 |
| |
2929 |
| - | |
| 2934 | + | |
| 2935 | + | |
2930 | 2936 |
| |
2931 | 2937 |
| |
| 2938 | + | |
| 2939 | + | |
2932 | 2940 |
| |
| 2941 | + | |
2933 | 2942 |
| |
2934 | 2943 |
| |
2935 | 2944 |
| |
| |||
4688 | 4697 |
| |
4689 | 4698 |
| |
4690 | 4699 |
| |
4691 |
| - | |
| 4700 | + | |
| 4701 | + | |
| 4702 | + | |
4692 | 4703 |
| |
4693 | 4704 |
| |
4694 | 4705 |
| |
4695 | 4706 |
| |
4696 | 4707 |
| |
| 4708 | + | |
| 4709 | + | |
4697 | 4710 |
| |
| 4711 | + | |
4698 | 4712 |
| |
4699 | 4713 |
| |
4700 | 4714 |
| |
| |||
4763 | 4777 |
| |
4764 | 4778 |
| |
4765 | 4779 |
| |
4766 |
| - | |
| 4780 | + | |
| 4781 | + | |
4767 | 4782 |
| |
4768 | 4783 |
| |
| 4784 | + | |
| 4785 | + | |
4769 | 4786 |
| |
| 4787 | + | |
4770 | 4788 |
| |
4771 | 4789 |
| |
4772 | 4790 |
| |
| |||
8242 | 8260 |
| |
8243 | 8261 |
| |
8244 | 8262 |
| |
| 8263 | + | |
| 8264 | + | |
| 8265 | + | |
| 8266 | + | |
| 8267 | + | |
| 8268 | + | |
| 8269 | + | |
| 8270 | + | |
| 8271 | + | |
| 8272 | + | |
| 8273 | + | |
| 8274 | + | |
| 8275 | + | |
| 8276 | + | |
| 8277 | + | |
| 8278 | + | |
| 8279 | + | |
| 8280 | + | |
| 8281 | + | |
| 8282 | + | |
| 8283 | + | |
| 8284 | + | |
| 8285 | + | |
| 8286 | + | |
| 8287 | + | |
| 8288 | + | |
| 8289 | + | |
| 8290 | + | |
| 8291 | + | |
| 8292 | + | |
| 8293 | + | |
| 8294 | + | |
| 8295 | + | |
| 8296 | + | |
| 8297 | + | |
| 8298 | + | |
| 8299 | + | |
8245 | 8300 |
| |
8246 | 8301 |
| |
8247 | 8302 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
112 | 112 |
| |
113 | 113 |
| |
114 | 114 |
| |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
115 | 127 |
| |
116 | 128 |
| |
117 | 129 |
| |
|
Lines changed: 27 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2256 | 2256 |
| |
2257 | 2257 |
| |
2258 | 2258 |
| |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
2259 | 2286 |
| |
2260 | 2287 |
| |
2261 | 2288 |
| |
|
Lines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1933 | 1933 |
| |
1934 | 1934 |
| |
1935 | 1935 |
| |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
1936 | 1960 |
| |
1937 | 1961 |
| |
1938 | 1962 |
| |
|
0 commit comments
Comments
(0)