forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0e1deaa
committed
Install dependencies to prevent dropping partition key columns.
The logic in ATExecDropColumn that rejects dropping partition keycolumns is quite an inadequate defense, because it doesn't executein cases where a column needs to be dropped due to cascade fromsomething that only the column, not the whole partitioned table,depends on. That leaves us with a badly broken partitioned table;even an attempt to load its relcache entry will fail.We really need to have explicit pg_depend entries that show that thecolumn can't be dropped without dropping the whole table. Hence,add those entries. In v12 and HEAD, bump catversion to ensure thatpartitioned tables will have such entries. We can't do that inreleased branches of course, so in v10 and v11 this patch affordsprotection only to partitioned tables created after the patch isinstalled. Given the lack of field complaints (this bug was foundby fuzz-testing not by end users), that's probably good enough.In passing, fix ATExecDropColumn and ATPrepAlterColumnTypemessages to be more specific about which partition key columnthey're complaining about.Per report from Manuel Rigger. Back-patch to v10 where partitionedtables were added.Discussion:https://postgr.es/m/CA+u7OA4JKCPFrdrAbOs7XBiCyD61XJxeNav4LefkSmBLQ-Vobg@mail.gmail.comDiscussion:https://postgr.es/m/31920.1562526703@sss.pgh.pa.us1 parent8a4fa29 commit0e1deaa
File tree
8 files changed
+182
-39
lines changed- src
- backend
- catalog
- commands
- bin/pg_dump
- include/catalog
- test/regress
- expected
- sql
8 files changed
+182
-39
lines changedLines changed: 47 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
526 | 526 |
| |
527 | 527 |
| |
528 | 528 |
| |
| 529 | + | |
529 | 530 |
| |
530 | 531 |
| |
531 | 532 |
| |
532 | 533 |
| |
533 | 534 |
| |
534 | 535 |
| |
535 | 536 |
| |
| 537 | + | |
| 538 | + | |
536 | 539 |
| |
| 540 | + | |
537 | 541 |
| |
538 | 542 |
| |
539 | 543 |
| |
| |||
546 | 550 |
| |
547 | 551 |
| |
548 | 552 |
| |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
549 | 565 |
| |
550 | 566 |
| |
551 | 567 |
| |
| |||
732 | 748 |
| |
733 | 749 |
| |
734 | 750 |
| |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
735 | 761 |
| |
736 | 762 |
| |
737 | 763 |
| |
| |||
1379 | 1405 |
| |
1380 | 1406 |
| |
1381 | 1407 |
| |
1382 |
| - | |
1383 |
| - | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
1384 | 1412 |
| |
1385 | 1413 |
| |
1386 | 1414 |
| |
| |||
1393 | 1421 |
| |
1394 | 1422 |
| |
1395 | 1423 |
| |
1396 |
| - | |
| 1424 | + | |
1397 | 1425 |
| |
1398 | 1426 |
| |
1399 | 1427 |
| |
| |||
1416 | 1444 |
| |
1417 | 1445 |
| |
1418 | 1446 |
| |
1419 |
| - | |
| 1447 | + | |
| 1448 | + | |
1420 | 1449 |
| |
1421 | 1450 |
| |
1422 | 1451 |
| |
| |||
1447 | 1476 |
| |
1448 | 1477 |
| |
1449 | 1478 |
| |
1450 |
| - | |
1451 |
| - | |
| 1479 | + | |
| 1480 | + | |
1452 | 1481 |
| |
1453 | 1482 |
| |
1454 | 1483 |
| |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
1455 | 1496 |
| |
1456 | 1497 |
| |
1457 | 1498 |
| |
|
Lines changed: 24 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3170 | 3170 |
| |
3171 | 3171 |
| |
3172 | 3172 |
| |
3173 |
| - | |
3174 |
| - | |
3175 |
| - | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
3176 | 3195 |
| |
3177 | 3196 |
| |
3178 | 3197 |
| |
3179 | 3198 |
| |
3180 | 3199 |
| |
3181 | 3200 |
| |
3182 |
| - | |
| 3201 | + | |
| 3202 | + | |
3183 | 3203 |
| |
3184 | 3204 |
| |
3185 | 3205 |
| |
|
Lines changed: 17 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6549 | 6549 |
| |
6550 | 6550 |
| |
6551 | 6551 |
| |
6552 |
| - | |
| 6552 | + | |
| 6553 | + | |
| 6554 | + | |
| 6555 | + | |
6553 | 6556 |
| |
6554 | 6557 |
| |
6555 | 6558 |
| |
6556 | 6559 |
| |
6557 | 6560 |
| |
6558 | 6561 |
| |
6559 |
| - | |
| 6562 | + | |
| 6563 | + | |
| 6564 | + | |
| 6565 | + | |
| 6566 | + | |
6560 | 6567 |
| |
6561 |
| - | |
6562 |
| - | |
6563 |
| - | |
6564 |
| - | |
6565 |
| - | |
6566 |
| - | |
6567 |
| - | |
6568 |
| - | |
6569 |
| - | |
6570 |
| - | |
| 6568 | + | |
| 6569 | + | |
| 6570 | + | |
| 6571 | + | |
6571 | 6572 |
| |
6572 | 6573 |
| |
6573 | 6574 |
| |
| |||
8776 | 8777 |
| |
8777 | 8778 |
| |
8778 | 8779 |
| |
8779 |
| - | |
8780 |
| - | |
8781 |
| - | |
8782 |
| - | |
8783 |
| - | |
8784 |
| - | |
8785 |
| - | |
8786 |
| - | |
8787 |
| - | |
8788 |
| - | |
| 8780 | + | |
| 8781 | + | |
| 8782 | + | |
| 8783 | + | |
8789 | 8784 |
| |
8790 | 8785 |
| |
8791 | 8786 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1173 | 1173 |
| |
1174 | 1174 |
| |
1175 | 1175 |
| |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
1176 | 1194 |
| |
1177 | 1195 |
| |
1178 | 1196 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
194 | 194 |
| |
195 | 195 |
| |
196 | 196 |
| |
197 |
| - | |
| 197 | + | |
198 | 198 |
| |
199 | 199 |
| |
200 | 200 |
| |
|
Lines changed: 6 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3309 | 3309 |
| |
3310 | 3310 |
| |
3311 | 3311 |
| |
3312 |
| - | |
| 3312 | + | |
3313 | 3313 |
| |
3314 |
| - | |
| 3314 | + | |
3315 | 3315 |
| |
3316 |
| - | |
| 3316 | + | |
3317 | 3317 |
| |
3318 |
| - | |
| 3318 | + | |
3319 | 3319 |
| |
3320 | 3320 |
| |
3321 | 3321 |
| |
| |||
3697 | 3697 |
| |
3698 | 3698 |
| |
3699 | 3699 |
| |
3700 |
| - | |
| 3700 | + | |
3701 | 3701 |
| |
3702 |
| - | |
| 3702 | + | |
3703 | 3703 |
| |
3704 | 3704 |
| |
3705 | 3705 |
| |
|
Lines changed: 36 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
461 | 461 |
| |
462 | 462 |
| |
463 | 463 |
| |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
464 | 500 |
| |
465 | 501 |
| |
466 | 502 |
| |
|
Lines changed: 33 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
433 | 433 |
| |
434 | 434 |
| |
435 | 435 |
| |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
436 | 469 |
| |
437 | 470 |
| |
438 | 471 |
| |
|
0 commit comments
Comments
(0)