forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5955d93
committed
Improve pg_dump's handling of "special" built-in objects.
We had some pretty ad-hoc handling of the public schema and the plpgsqlextension, which are both presumed to exist in template0 but might bemodified or deleted in the database being dumped.Up to now, by default pg_dump would emit a CREATE EXTENSION IF NOT EXISTScommand as well as a COMMENT command for plpgsql. The usefulness of theformer is questionable, and the latter caused annoying errors innon-superuser dump/restore scenarios. Let's instead install a rule thatbuilt-in extensions (identified by having low-numbered OIDs) are not to bedumped. We were doing it that way already in binary-upgrade mode, so thisjust makes regular mode behave the same. It remains true that if someonehas installed a non-default ACL on the plpgsql language, that will getdumped thanks to the pg_init_privs mechanism. This is more consistent withthe handling of built-in objects of other kinds.Also, change the very ad-hoc mechanism that was used to avoid dumpingcreation and comment commands for the public schema. Instead of hardwiringa test in _printTocEntry(), make use of the DUMP_COMPONENT_ infrastructureto mark that schema up-front about what we want to do with it. This hasthe visible effect that the public schema won't be mentioned in the outputat all, except for updating its ACL if it has a non-default ACL.Previously, while it was normally not mentioned, --clean mode would dropand recreate it, again causing headaches for non-superuser usage. Thischange likewise makes the public schema less special and more like otherbuilt-in objects.If plpgsql, or the public schema, has been removed entirely in the sourceDB, that situation won't be reproduced in the destination ... but thatwas true before.Discussion:https://postgr.es/m/29048.1516812451@sss.pgh.pa.us1 parent2a5ecb5 commit5955d93
File tree
3 files changed
+87
-102
lines changed- src/bin/pg_dump
- t
3 files changed
+87
-102
lines changedLines changed: 0 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3453 | 3453 |
| |
3454 | 3454 |
| |
3455 | 3455 |
| |
3456 |
| - | |
3457 |
| - | |
3458 |
| - | |
3459 |
| - | |
3460 |
| - | |
3461 |
| - | |
3462 |
| - | |
3463 |
| - | |
3464 |
| - | |
3465 |
| - | |
3466 |
| - | |
3467 |
| - | |
3468 |
| - | |
3469 |
| - | |
3470 |
| - | |
3471 |
| - | |
3472 |
| - | |
3473 |
| - | |
3474 |
| - | |
3475 |
| - | |
3476 |
| - | |
3477 |
| - | |
3478 |
| - | |
3479 | 3456 |
| |
3480 | 3457 |
| |
3481 | 3458 |
| |
|
Lines changed: 35 additions & 39 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1407 | 1407 |
| |
1408 | 1408 |
| |
1409 | 1409 |
| |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
1410 | 1423 |
| |
1411 | 1424 |
| |
1412 | 1425 |
| |
| |||
1617 | 1630 |
| |
1618 | 1631 |
| |
1619 | 1632 |
| |
1620 |
| - | |
1621 |
| - | |
1622 |
| - | |
| 1633 | + | |
1623 | 1634 |
| |
1624 | 1635 |
| |
| 1636 | + | |
| 1637 | + | |
1625 | 1638 |
| |
1626 | 1639 |
| |
1627 | 1640 |
| |
1628 | 1641 |
| |
1629 | 1642 |
| |
1630 |
| - | |
1631 |
| - | |
1632 |
| - | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
1633 | 1646 |
| |
1634 |
| - | |
| 1647 | + | |
1635 | 1648 |
| |
1636 | 1649 |
| |
1637 | 1650 |
| |
| |||
4435 | 4448 |
| |
4436 | 4449 |
| |
4437 | 4450 |
| |
4438 |
| - | |
4439 |
| - | |
4440 |
| - | |
4441 |
| - | |
4442 |
| - | |
4443 |
| - | |
4444 |
| - | |
4445 |
| - | |
4446 |
| - | |
4447 |
| - | |
4448 |
| - | |
4449 |
| - | |
4450 |
| - | |
4451 |
| - | |
4452 |
| - | |
4453 |
| - | |
4454 |
| - | |
4455 |
| - | |
4456 |
| - | |
4457 |
| - | |
4458 |
| - | |
4459 |
| - | |
4460 |
| - | |
4461 | 4451 |
| |
4462 | 4452 |
| |
4463 | 4453 |
| |
| |||
9945 | 9935 |
| |
9946 | 9936 |
| |
9947 | 9937 |
| |
9948 |
| - | |
9949 |
| - | |
9950 |
| - | |
9951 |
| - | |
| 9938 | + | |
| 9939 | + | |
| 9940 | + | |
9952 | 9941 |
| |
9953 |
| - | |
9954 |
| - | |
9955 |
| - | |
| 9942 | + | |
| 9943 | + | |
| 9944 | + | |
| 9945 | + | |
9956 | 9946 |
| |
9957 | 9947 |
| |
9958 | 9948 |
| |
9959 | 9949 |
| |
9960 | 9950 |
| |
9961 | 9951 |
| |
| 9952 | + | |
| 9953 | + | |
| 9954 | + | |
| 9955 | + | |
| 9956 | + | |
| 9957 | + | |
| 9958 | + | |
| 9959 | + | |
9962 | 9960 |
| |
9963 | 9961 |
| |
9964 | 9962 |
| |
| |||
9968 | 9966 |
| |
9969 | 9967 |
| |
9970 | 9968 |
| |
9971 |
| - | |
9972 |
| - | |
9973 | 9969 |
| |
9974 | 9970 |
| |
9975 | 9971 |
| |
|
Lines changed: 52 additions & 40 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1548 | 1548 |
| |
1549 | 1549 |
| |
1550 | 1550 |
| |
1551 |
| - | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
1552 | 1555 |
| |
1553 | 1556 |
| |
| 1557 | + | |
1554 | 1558 |
| |
| 1559 | + | |
1555 | 1560 |
| |
1556 | 1561 |
| |
1557 | 1562 |
| |
1558 | 1563 |
| |
1559 | 1564 |
| |
1560 |
| - | |
1561 | 1565 |
| |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
1562 | 1569 |
| |
| 1570 | + | |
1563 | 1571 |
| |
| 1572 | + | |
1564 | 1573 |
| |
1565 |
| - | |
1566 |
| - | |
1567 |
| - | |
1568 |
| - | |
1569 |
| - | |
1570 |
| - | |
1571 |
| - | |
1572 |
| - | |
1573 |
| - | |
1574 |
| - | |
| 1574 | + | |
| 1575 | + | |
1575 | 1576 |
| |
1576 | 1577 |
| |
1577 | 1578 |
| |
| |||
2751 | 2752 |
| |
2752 | 2753 |
| |
2753 | 2754 |
| |
2754 |
| - | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
2755 | 2759 |
| |
2756 | 2760 |
| |
| 2761 | + | |
2757 | 2762 |
| |
| 2763 | + | |
2758 | 2764 |
| |
2759 | 2765 |
| |
2760 | 2766 |
| |
2761 | 2767 |
| |
2762 | 2768 |
| |
2763 |
| - | |
2764 | 2769 |
| |
2765 |
| - | |
2766 |
| - | |
2767 |
| - | |
2768 |
| - | |
2769 |
| - | |
2770 |
| - | |
2771 |
| - | |
2772 |
| - | |
| 2770 | + | |
2773 | 2771 |
| |
2774 | 2772 |
| |
| 2773 | + | |
2775 | 2774 |
| |
2776 | 2775 |
| |
2777 | 2776 |
| |
| 2777 | + | |
2778 | 2778 |
| |
2779 | 2779 |
| |
2780 |
| - | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
2781 | 2783 |
| |
2782 | 2784 |
| |
2783 | 2785 |
| |
| |||
4565 | 4567 |
| |
4566 | 4568 |
| |
4567 | 4569 |
| |
4568 |
| - | |
4569 |
| - | |
4570 |
| - | |
| 4570 | + | |
| 4571 | + | |
4571 | 4572 |
| |
4572 | 4573 |
| |
| 4574 | + | |
| 4575 | + | |
4573 | 4576 |
| |
4574 | 4577 |
| |
4575 | 4578 |
| |
| |||
5395 | 5398 |
| |
5396 | 5399 |
| |
5397 | 5400 |
| |
5398 |
| - | |
| 5401 | + | |
| 5402 | + | |
5399 | 5403 |
| |
| 5404 | + | |
5400 | 5405 |
| |
5401 | 5406 |
| |
5402 | 5407 |
| |
5403 | 5408 |
| |
5404 | 5409 |
| |
5405 | 5410 |
| |
5406 | 5411 |
| |
5407 |
| - | |
| 5412 | + | |
| 5413 | + | |
5408 | 5414 |
| |
5409 | 5415 |
| |
| 5416 | + | |
5410 | 5417 |
| |
5411 | 5418 |
| |
5412 | 5419 |
| |
5413 | 5420 |
| |
5414 | 5421 |
| |
5415 | 5422 |
| |
5416 |
| - | |
| 5423 | + | |
| 5424 | + | |
5417 | 5425 |
| |
| 5426 | + | |
5418 | 5427 |
| |
5419 | 5428 |
| |
5420 | 5429 |
| |
| |||
5494 | 5503 |
| |
5495 | 5504 |
| |
5496 | 5505 |
| |
5497 |
| - | |
| 5506 | + | |
| 5507 | + | |
5498 | 5508 |
| |
5499 | 5509 |
| |
| 5510 | + | |
5500 | 5511 |
| |
5501 | 5512 |
| |
5502 | 5513 |
| |
| |||
6264 | 6275 |
| |
6265 | 6276 |
| |
6266 | 6277 |
| |
6267 |
| - | |
6268 |
| - | |
6269 |
| - | |
| 6278 | + | |
| 6279 | + | |
6270 | 6280 |
| |
6271 | 6281 |
| |
| 6282 | + | |
| 6283 | + | |
6272 | 6284 |
| |
6273 | 6285 |
| |
6274 | 6286 |
| |
| |||
6537 | 6549 |
| |
6538 | 6550 |
| |
6539 | 6551 |
| |
| 6552 | + | |
| 6553 | + | |
6540 | 6554 |
| |
6541 | 6555 |
| |
6542 | 6556 |
| |
| |||
6549 | 6563 |
| |
6550 | 6564 |
| |
6551 | 6565 |
| |
6552 |
| - | |
6553 |
| - | |
6554 | 6566 |
| |
6555 | 6567 |
| |
6556 | 6568 |
| |
| |||
6576 | 6588 |
| |
6577 | 6589 |
| |
6578 | 6590 |
| |
| 6591 | + | |
| 6592 | + | |
6579 | 6593 |
| |
| 6594 | + | |
6580 | 6595 |
| |
6581 | 6596 |
| |
| 6597 | + | |
6582 | 6598 |
| |
6583 | 6599 |
| |
6584 |
| - | |
6585 |
| - | |
6586 | 6600 |
| |
6587 |
| - | |
6588 | 6601 |
| |
6589 |
| - | |
6590 |
| - | |
| 6602 | + | |
6591 | 6603 |
| |
6592 | 6604 |
| |
6593 | 6605 |
| |
|
0 commit comments
Comments
(0)