forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcd1b215
committed
Fix handling of expanded objects in CoerceToDomain and CASE execution.
When the input value to a CoerceToDomain expression node is a read-writeexpanded datum, we should pass a read-only pointer to any domain CHECKexpressions and then return the original read-write pointer as theexpression result. Previously we were blindly passing the same pointer toall the consumers of the value, making it possible for a function in CHECKto modify or even delete the expanded value. (Since a plpgsql functionwill absorb a passed-in read-write expanded array as a local variablevalue, it will in fact delete the value on exit.)A similar hazard of passing the same read-write pointer to multipleconsumers exists in domain_check() and in ExecEvalCase, so fix those too.The fix requires adding MakeExpandedObjectReadOnly calls at the appropriateplaces, which is simple enough except that we need to get the data type'styplen from somewhere. For the domain cases, solve this by redefiningDomainConstraintRef.tcache as okay for callers to access; there wasn't anyreason for the original convention against that, other than not wanting theAPI of typcache.c to be any wider than it had to be. For CASE, there'sno good solution except to add a syscache lookup during executor start.Per bug #14472 from Marcos Castedo. Back-patch to 9.5 where expandedvalues were introduced.Discussion:https://postgr.es/m/15225.1482431619@sss.pgh.pa.us1 parent6ef2eba commitcd1b215
File tree
8 files changed
+127
-8
lines changed- src
- backend
- executor
- utils/adt
- include
- nodes
- utils
- test/regress
- expected
- sql
8 files changed
+127
-8
lines changedLines changed: 20 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2992 | 2992 |
| |
2993 | 2993 |
| |
2994 | 2994 |
| |
| 2995 | + | |
2995 | 2996 |
| |
2996 | 2997 |
| |
2997 |
| - | |
2998 |
| - | |
2999 |
| - | |
3000 |
| - | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
3001 | 3007 |
| |
3002 | 3008 |
| |
3003 | 3009 |
| |
| |||
4127 | 4133 |
| |
4128 | 4134 |
| |
4129 | 4135 |
| |
| 4136 | + | |
| 4137 | + | |
| 4138 | + | |
| 4139 | + | |
| 4140 | + | |
4130 | 4141 |
| |
4131 | 4142 |
| |
4132 | 4143 |
| |
4133 | 4144 |
| |
4134 |
| - | |
| 4145 | + | |
| 4146 | + | |
| 4147 | + | |
4135 | 4148 |
| |
4136 | 4149 |
| |
4137 | 4150 |
| |
| |||
4939 | 4952 |
| |
4940 | 4953 |
| |
4941 | 4954 |
| |
| 4955 | + | |
| 4956 | + | |
4942 | 4957 |
| |
4943 | 4958 |
| |
4944 | 4959 |
| |
|
Lines changed: 8 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
| 38 | + | |
38 | 39 |
| |
39 | 40 |
| |
40 | 41 |
| |
| |||
166 | 167 |
| |
167 | 168 |
| |
168 | 169 |
| |
169 |
| - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
170 | 174 |
| |
171 |
| - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
172 | 178 |
| |
173 | 179 |
| |
174 | 180 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
889 | 889 |
| |
890 | 890 |
| |
891 | 891 |
| |
| 892 | + | |
892 | 893 |
| |
893 | 894 |
| |
894 | 895 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
131 | 131 |
| |
132 | 132 |
| |
133 | 133 |
| |
| 134 | + | |
134 | 135 |
| |
135 | 136 |
| |
136 |
| - | |
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
|
Lines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
338 | 338 |
| |
339 | 339 |
| |
340 | 340 |
| |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
341 | 367 |
| |
342 | 368 |
| |
343 | 369 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5664 | 5664 |
| |
5665 | 5665 |
| |
5666 | 5666 |
| |
| 5667 | + | |
| 5668 | + | |
| 5669 | + | |
| 5670 | + | |
| 5671 | + | |
| 5672 | + | |
| 5673 | + | |
| 5674 | + | |
| 5675 | + | |
| 5676 | + | |
| 5677 | + | |
| 5678 | + | |
| 5679 | + | |
| 5680 | + | |
| 5681 | + | |
| 5682 | + | |
| 5683 | + | |
| 5684 | + | |
| 5685 | + | |
| 5686 | + |
Lines changed: 28 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
200 | 200 |
| |
201 | 201 |
| |
202 | 202 |
| |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
203 | 231 |
| |
204 | 232 |
| |
205 | 233 |
| |
|
Lines changed: 23 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4452 | 4452 |
| |
4453 | 4453 |
| |
4454 | 4454 |
| |
| 4455 | + | |
| 4456 | + | |
| 4457 | + | |
| 4458 | + | |
| 4459 | + | |
| 4460 | + | |
| 4461 | + | |
| 4462 | + | |
| 4463 | + | |
| 4464 | + | |
| 4465 | + | |
| 4466 | + | |
| 4467 | + | |
| 4468 | + | |
| 4469 | + | |
| 4470 | + | |
| 4471 | + | |
| 4472 | + | |
| 4473 | + | |
| 4474 | + | |
| 4475 | + | |
| 4476 | + | |
| 4477 | + |
0 commit comments
Comments
(0)