forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfe9e658
committed
Ensure that MERGE recomputes GENERATED expressions properly.
This fixes a bug that, under some circumstances, would cause MERGE tofail to properly recompute expressions for GENERATED STORED columns.Formerly, ExecInitModifyTable() did not call ExecInitStoredGenerated()for a MERGE command, which meant that the generated expressionsinformation was not computed until later, when the first merge actionwas executed. However, if the first merge action to execute was anUPDATE, then ExecInitStoredGenerated() could decide to skip some somegenerated columns, if the columns on which they depended were notupdated, which was a problem if the MERGE also contained an INSERTaction, for which no generated columns should be skipped.So fix by having ExecInitModifyTable() call ExecInitStoredGenerated()for MERGE, and assume that it isn't safe to skip any generated columnsin a MERGE. Possibly that could be relaxed, by allowing some generatedcolumns to be skipped for a MERGE without an INSERT action, but it'snot clear that it's worth the effort.Noticed while investigating bug #17759. Back-patch to v15, where MERGEwas added.Dean Rasheed, reviewed by Tom Lane.Discussion:https://postgr.es/m/17759-e76d9bece1b5421c%40postgresql.orghttps://postgr.es/m/CAEZATCXb_ezoMCcL0tzKwRGA1x0oeE%3DawTaysRfTPq%2B3wNJn8g%40mail.gmail.com1 parent1e8b617 commitfe9e658
File tree
3 files changed
+37
-2
lines changed- src
- backend/executor
- test/regress
- expected
- sql
3 files changed
+37
-2
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4141 | 4141 |
| |
4142 | 4142 |
| |
4143 | 4143 |
| |
4144 |
| - | |
| 4144 | + | |
4145 | 4145 |
| |
4146 | 4146 |
| |
4147 | 4147 |
| |
4148 | 4148 |
| |
4149 |
| - | |
| 4149 | + | |
4150 | 4150 |
| |
4151 | 4151 |
| |
4152 | 4152 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
192 | 192 |
| |
193 | 193 |
| |
194 | 194 |
| |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
195 | 215 |
| |
196 | 216 |
| |
197 | 217 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
84 | 99 |
| |
85 | 100 |
| |
86 | 101 |
| |
|
0 commit comments
Comments
(0)