forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite522452

Etsuro Fujita
Fix handling of pending inserts in nodeModifyTable.c.
Commitb663a41, which allowed FDWs to INSERT rows in bulk, added tonodeModifyTable.c code to flush pending inserts to the foreign-tableresult relation(s) before completing processing of the ModifyTable node,but the code failed to take into account the case where the INSERT queryhas modifying CTEs, leading to incorrect results.Also, that commit failed to flush pending inserts before firing BEFOREROW triggers so that rows are visible to such triggers.In that commit we scanned through EState'ses_tuple_routing_result_relations or es_opened_result_relations list tofind the foreign-table result relations to which pending inserts areflushed, but that would be inefficient in some cases. So to fix, 1) adda List member to EState to record the insert-pending result relations,and 2) modify nodeModifyTable.c so that it adds the foreign-table resultrelation to the list in ExecInsert() if appropriate, and flushes pendinginserts properly using the list where needed.While here, fix a copy-and-pasteo in a comment in ExecBatchInsert(),which was added by that commit.Back-patch to v14 where that commit appeared.Discussion:https://postgr.es/m/CAPmGK16qutyCmyJJzgQOhfBq%3DNoGDqTB6O0QBZTihrbqre%2BoxA%40mail.gmail.com1 parent9f2cc1a commite522452
File tree
7 files changed
+298
-21
lines changed- contrib/postgres_fdw
- expected
- sql
- src
- backend/executor
- include/nodes
7 files changed
+298
-21
lines changedLines changed: 123 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10168 | 10168 |
| |
10169 | 10169 |
| |
10170 | 10170 |
| |
| 10171 | + | |
| 10172 | + | |
| 10173 | + | |
| 10174 | + | |
10171 | 10175 |
| |
| 10176 | + | |
| 10177 | + | |
| 10178 | + | |
| 10179 | + | |
| 10180 | + | |
| 10181 | + | |
| 10182 | + | |
| 10183 | + | |
| 10184 | + | |
| 10185 | + | |
| 10186 | + | |
| 10187 | + | |
| 10188 | + | |
| 10189 | + | |
| 10190 | + | |
| 10191 | + | |
| 10192 | + | |
| 10193 | + | |
| 10194 | + | |
| 10195 | + | |
| 10196 | + | |
| 10197 | + | |
| 10198 | + | |
| 10199 | + | |
| 10200 | + | |
| 10201 | + | |
| 10202 | + | |
| 10203 | + | |
| 10204 | + | |
| 10205 | + | |
| 10206 | + | |
| 10207 | + | |
| 10208 | + | |
| 10209 | + | |
| 10210 | + | |
| 10211 | + | |
| 10212 | + | |
| 10213 | + | |
| 10214 | + | |
| 10215 | + | |
| 10216 | + | |
| 10217 | + | |
| 10218 | + | |
| 10219 | + | |
| 10220 | + | |
| 10221 | + | |
| 10222 | + | |
| 10223 | + | |
| 10224 | + | |
| 10225 | + | |
| 10226 | + | |
| 10227 | + | |
| 10228 | + | |
| 10229 | + | |
| 10230 | + | |
| 10231 | + | |
| 10232 | + | |
| 10233 | + | |
| 10234 | + | |
| 10235 | + | |
| 10236 | + | |
| 10237 | + | |
| 10238 | + | |
| 10239 | + | |
| 10240 | + | |
| 10241 | + | |
| 10242 | + | |
| 10243 | + | |
| 10244 | + | |
| 10245 | + | |
| 10246 | + | |
| 10247 | + | |
| 10248 | + | |
| 10249 | + | |
| 10250 | + | |
| 10251 | + | |
| 10252 | + | |
| 10253 | + | |
| 10254 | + | |
| 10255 | + | |
| 10256 | + | |
| 10257 | + | |
| 10258 | + | |
| 10259 | + | |
| 10260 | + | |
| 10261 | + | |
| 10262 | + | |
| 10263 | + | |
| 10264 | + | |
| 10265 | + | |
| 10266 | + | |
| 10267 | + | |
| 10268 | + | |
| 10269 | + | |
| 10270 | + | |
| 10271 | + | |
| 10272 | + | |
| 10273 | + | |
| 10274 | + | |
| 10275 | + | |
| 10276 | + | |
| 10277 | + | |
| 10278 | + | |
| 10279 | + | |
| 10280 | + | |
| 10281 | + | |
| 10282 | + | |
| 10283 | + | |
| 10284 | + | |
| 10285 | + | |
| 10286 | + | |
| 10287 | + | |
| 10288 | + | |
| 10289 | + | |
| 10290 | + | |
| 10291 | + | |
| 10292 | + | |
| 10293 | + | |
| 10294 | + | |
10172 | 10295 |
| |
10173 | 10296 |
| |
10174 | 10297 |
| |
|
Lines changed: 86 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3205 | 3205 |
| |
3206 | 3206 |
| |
3207 | 3207 |
| |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
3208 | 3213 |
| |
3209 | 3214 |
| |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + | |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
3210 | 3296 |
| |
3211 | 3297 |
| |
3212 | 3298 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1257 | 1257 |
| |
1258 | 1258 |
| |
1259 | 1259 |
| |
| 1260 | + | |
1260 | 1261 |
| |
1261 | 1262 |
| |
1262 | 1263 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
934 | 934 |
| |
935 | 935 |
| |
936 | 936 |
| |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
937 | 944 |
| |
938 | 945 |
| |
939 | 946 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
127 | 127 |
| |
128 | 128 |
| |
129 | 129 |
| |
| 130 | + | |
130 | 131 |
| |
131 | 132 |
| |
132 | 133 |
| |
|
0 commit comments
Comments
(0)