forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitba9f18a
committed
Fix corner case for a BEFORE ROW UPDATE trigger returning OLD.
If the old row has any "missing" attributes that are supposed tobe retrieved from an associated tuple descriptor, the wrong thingshappened because the trigger result is shoved directly into anexecutor slot that lacks the missing-attribute data. Notably,CHECK-constraint verification would incorrectly see those columnsas NULL, and so would RETURNING-list evaluation.Band-aid around this by forcibly expanding the tuple before passingit to the trigger function. (IMO it was a fundamental misdesign toput the missing-attribute data into tuple constraints, which somuch of the system considers to be optional. But we're probablystuck with that now, and will have to continue to apply band-aidsas we find other places with similar issues.)Back-patch to v12. v11 would also have the issue, except thatcommit920311a already applied a similar band-aid. That forcedexpansion in more cases than seem really necessary, though, sothis isn't a directly equivalent fix.Amit Langote, with some cosmetic changes by meDiscussion:https://postgr.es/m/16644-5da7ef98a7ac4545@postgresql.org1 parente83c9f9 commitba9f18a
File tree
3 files changed
+90
-1
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+90
-1
lines changedLines changed: 40 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
89 | 89 |
| |
90 | 90 |
| |
91 | 91 |
| |
| 92 | + | |
| 93 | + | |
92 | 94 |
| |
93 | 95 |
| |
94 | 96 |
| |
| |||
2672 | 2674 |
| |
2673 | 2675 |
| |
2674 | 2676 |
| |
2675 |
| - | |
| 2677 | + | |
2676 | 2678 |
| |
2677 | 2679 |
| |
2678 | 2680 |
| |
| |||
2925 | 2927 |
| |
2926 | 2928 |
| |
2927 | 2929 |
| |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
2928 | 2933 |
| |
2929 | 2934 |
| |
2930 | 2935 |
| |
| |||
3038 | 3043 |
| |
3039 | 3044 |
| |
3040 | 3045 |
| |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
| 3053 | + | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
| 3068 | + | |
| 3069 | + | |
| 3070 | + | |
| 3071 | + | |
| 3072 | + | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
| 3079 | + | |
3041 | 3080 |
| |
3042 | 3081 |
| |
3043 | 3082 |
| |
|
Lines changed: 32 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
214 | 214 |
| |
215 | 215 |
| |
216 | 216 |
| |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
217 | 249 |
| |
218 | 250 |
| |
219 | 251 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
154 | 154 |
| |
155 | 155 |
| |
156 | 156 |
| |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
157 | 175 |
| |
158 | 176 |
| |
159 | 177 |
| |
|
0 commit comments
Comments
(0)