Commit 0b126c6
committed
Fix pg_dump --inserts mode for generated columns with dropped columns.
If a table contains a generated column that's preceded by a dropped
column, dumpTableData_insert failed to account for the dropped
column, and would emit DEFAULT placeholder(s) in the wrong column(s).
This resulted in failures at restore time. The default COPY code path
did not have this bug, likely explaining why it wasn't noticed sooner.
While we're fixing this, we can be a little smarter about the
situation: (1) avoid unnecessarily fetching the values of generated
columns, (2) omit generated columns from the output, too, if we're
using --column-inserts. While these modes aren't expected to be
as high-performance as the COPY path, we might as well be as
efficient as we can; it doesn't add much complexity.
Per report from Дмитрий Иванов.
Back-patch to v12 where generated columns came in.
Discussion: https://postgr.es/m/CAPL5KHrkBniyQt5e1rafm5DdXvbgiiqfEQEJ9GjtVzN71Jj5pA@mail.gmail.com1 parent c4fe319 commit 0b126c6
2 files changed
+111
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2088 | 2088 | | |
2089 | 2089 | | |
2090 | 2090 | | |
| 2091 | + | |
2091 | 2092 | | |
2092 | | - | |
| 2093 | + | |
| 2094 | + | |
2093 | 2095 | | |
2094 | 2096 | | |
2095 | 2097 | | |
2096 | | - | |
2097 | | - | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
2098 | 2127 | | |
2099 | 2128 | | |
2100 | 2129 | | |
| |||
2105 | 2134 | | |
2106 | 2135 | | |
2107 | 2136 | | |
2108 | | - | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
2109 | 2143 | | |
2110 | 2144 | | |
2111 | 2145 | | |
2112 | 2146 | | |
2113 | | - | |
2114 | | - | |
2115 | | - | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
2116 | 2150 | | |
2117 | 2151 | | |
2118 | 2152 | | |
| |||
2191 | 2225 | | |
2192 | 2226 | | |
2193 | 2227 | | |
2194 | | - | |
| 2228 | + | |
2195 | 2229 | | |
2196 | 2230 | | |
2197 | 2231 | | |
| |||
2296 | 2330 | | |
2297 | 2331 | | |
2298 | 2332 | | |
| 2333 | + | |
2299 | 2334 | | |
2300 | 2335 | | |
2301 | 2336 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
219 | 226 | | |
220 | 227 | | |
221 | 228 | | |
| |||
610 | 617 | | |
611 | 618 | | |
612 | 619 | | |
| 620 | + | |
613 | 621 | | |
614 | 622 | | |
615 | 623 | | |
| |||
957 | 965 | | |
958 | 966 | | |
959 | 967 | | |
| 968 | + | |
960 | 969 | | |
961 | 970 | | |
962 | 971 | | |
| |||
977 | 986 | | |
978 | 987 | | |
979 | 988 | | |
| 989 | + | |
980 | 990 | | |
981 | 991 | | |
982 | 992 | | |
| |||
1128 | 1138 | | |
1129 | 1139 | | |
1130 | 1140 | | |
| 1141 | + | |
1131 | 1142 | | |
1132 | 1143 | | |
1133 | 1144 | | |
| |||
1327 | 1338 | | |
1328 | 1339 | | |
1329 | 1340 | | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
1330 | 1362 | | |
1331 | 1363 | | |
1332 | 1364 | | |
| |||
1418 | 1450 | | |
1419 | 1451 | | |
1420 | 1452 | | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
1421 | 1465 | | |
1422 | 1466 | | |
1423 | 1467 | | |
1424 | | - | |
| 1468 | + | |
1425 | 1469 | | |
1426 | 1470 | | |
1427 | 1471 | | |
| |||
2633 | 2677 | | |
2634 | 2678 | | |
2635 | 2679 | | |
| 2680 | + | |
| 2681 | + | |
| 2682 | + | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
2636 | 2702 | | |
2637 | 2703 | | |
2638 | 2704 | | |
| |||
3316 | 3382 | | |
3317 | 3383 | | |
3318 | 3384 | | |
| 3385 | + | |
3319 | 3386 | | |
3320 | 3387 | | |
3321 | 3388 | | |
| |||
0 commit comments