- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit95f6506
committed
Fix broken handling of domains in atthasmissing logic.
If a domain type has a default, adding a column of that type (withoutany explicit DEFAULT clause) failed to install the domain's defaultvalue in existing rows, instead leaving the new column null. Thisis unexpected, and it used to work correctly before v11. The causeis confusion in the atthasmissing mechanism about which default valueto install: we'd only consider installing an explicitly-specifieddefault, and then we'd decide that no table rewrite is needed.To fix, take the responsibility for filling attmissingval out ofStoreAttrDefault, and instead put it into ATExecAddColumn's existinglogic that derives the correct value to fill the new column with.Also, centralize the logic that determines the need fordefault-related table rewriting there, instead of spreading it overfour or five places.In the back branches, we'll leave the attmissingval-filling codein StoreAttrDefault even though it's now dead, for fear that someextension may be depending on that functionality to exist there.A separate HEAD-only patch will clean up the now-useless code.Reported-by: jian he <jian.universality@gmail.com>Author: jian he <jian.universality@gmail.com>Author: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/CACJufxHFssPvkP1we7WMhPD_1kwgbG52o=kQgL+TnVoX5LOyCQ@mail.gmail.comBackpatch-through: 131 parent99f8f3f commit95f6506
File tree
6 files changed
+235
-34
lines changed- src
- backend
- catalog
- commands
- include/catalog
- test/regress
- expected
- sql
6 files changed
+235
-34
lines changedLines changed: 56 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
69 | 69 |
| |
70 | 70 |
| |
71 | 71 |
| |
| 72 | + | |
72 | 73 |
| |
73 | 74 |
| |
74 | 75 |
| |
| |||
2010 | 2011 |
| |
2011 | 2012 |
| |
2012 | 2013 |
| |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
2013 | 2068 |
| |
2014 | 2069 |
| |
2015 | 2070 |
| |
| |||
2392 | 2447 |
| |
2393 | 2448 |
| |
2394 | 2449 |
| |
2395 |
| - | |
2396 |
| - | |
2397 |
| - | |
2398 |
| - | |
2399 |
| - | |
2400 | 2450 |
| |
2401 |
| - | |
| 2451 | + | |
2402 | 2452 |
| |
2403 | 2453 |
| |
2404 | 2454 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
120 | 120 |
| |
121 | 121 |
| |
122 | 122 |
| |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
123 | 129 |
| |
124 | 130 |
| |
125 | 131 |
| |
|
Lines changed: 60 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7321 | 7321 |
| |
7322 | 7322 |
| |
7323 | 7323 |
| |
7324 |
| - | |
7325 |
| - | |
7326 |
| - | |
7327 |
| - | |
7328 |
| - | |
7329 |
| - | |
7330 |
| - | |
7331 |
| - | |
| 7324 | + | |
7332 | 7325 |
| |
7333 | 7326 |
| |
7334 | 7327 |
| |
| |||
7340 | 7333 |
| |
7341 | 7334 |
| |
7342 | 7335 |
| |
7343 |
| - | |
7344 |
| - | |
7345 |
| - | |
7346 |
| - | |
7347 |
| - | |
7348 |
| - | |
7349 |
| - | |
7350 | 7336 |
| |
7351 | 7337 |
| |
7352 | 7338 |
| |
| |||
7363 | 7349 |
| |
7364 | 7350 |
| |
7365 | 7351 |
| |
7366 |
| - | |
7367 |
| - | |
7368 |
| - | |
| 7352 | + | |
| 7353 | + | |
| 7354 | + | |
7369 | 7355 |
| |
7370 | 7356 |
| |
7371 | 7357 |
| |
| |||
7384 | 7370 |
| |
7385 | 7371 |
| |
7386 | 7372 |
| |
| 7373 | + | |
| 7374 | + | |
| 7375 | + | |
7387 | 7376 |
| |
7388 | 7377 |
| |
7389 | 7378 |
| |
| |||
7396 | 7385 |
| |
7397 | 7386 |
| |
7398 | 7387 |
| |
7399 |
| - | |
7400 |
| - | |
7401 |
| - | |
7402 | 7388 |
| |
7403 | 7389 |
| |
7404 | 7390 |
| |
7405 | 7391 |
| |
7406 |
| - | |
| 7392 | + | |
| 7393 | + | |
| 7394 | + | |
7407 | 7395 |
| |
7408 | 7396 |
| |
7409 | 7397 |
| |
| |||
7429 | 7417 |
| |
7430 | 7418 |
| |
7431 | 7419 |
| |
| 7420 | + | |
| 7421 | + | |
| 7422 | + | |
| 7423 | + | |
7432 | 7424 |
| |
7433 | 7425 |
| |
7434 |
| - | |
| 7426 | + | |
7435 | 7427 |
| |
7436 | 7428 |
| |
7437 | 7429 |
| |
7438 |
| - | |
7439 | 7430 |
| |
7440 |
| - | |
7441 |
| - | |
| 7431 | + | |
| 7432 | + | |
| 7433 | + | |
| 7434 | + | |
| 7435 | + | |
| 7436 | + | |
| 7437 | + | |
| 7438 | + | |
| 7439 | + | |
| 7440 | + | |
| 7441 | + | |
| 7442 | + | |
| 7443 | + | |
| 7444 | + | |
| 7445 | + | |
| 7446 | + | |
| 7447 | + | |
| 7448 | + | |
| 7449 | + | |
| 7450 | + | |
| 7451 | + | |
| 7452 | + | |
| 7453 | + | |
| 7454 | + | |
| 7455 | + | |
| 7456 | + | |
| 7457 | + | |
| 7458 | + | |
| 7459 | + | |
| 7460 | + | |
| 7461 | + | |
| 7462 | + | |
| 7463 | + | |
| 7464 | + | |
| 7465 | + | |
| 7466 | + | |
| 7467 | + | |
| 7468 | + | |
| 7469 | + | |
| 7470 | + | |
| 7471 | + | |
| 7472 | + | |
| 7473 | + | |
| 7474 | + | |
7442 | 7475 |
| |
7443 |
| - | |
| 7476 | + | |
7444 | 7477 |
| |
7445 | 7478 |
| |
7446 | 7479 |
| |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
| 32 | + | |
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
| |||
121 | 121 |
| |
122 | 122 |
| |
123 | 123 |
| |
| 124 | + | |
| 125 | + | |
| 126 | + | |
124 | 127 |
| |
125 | 128 |
| |
126 | 129 |
| |
|
Lines changed: 65 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
257 | 257 |
| |
258 | 258 |
| |
259 | 259 |
| |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
260 | 325 |
| |
261 | 326 |
| |
262 | 327 |
| |
|
Lines changed: 44 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
248 | 248 |
| |
249 | 249 |
| |
250 | 250 |
| |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
251 | 295 |
| |
252 | 296 |
| |
253 | 297 |
| |
|
0 commit comments
Comments
(0)