forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit128dd9f
committed
Fix logic buglets in pg_dump's flagInhAttrs().
As it stands, flagInhAttrs() can make changes in table properties thatchange decisions made at other tables during other iterations of itsloop. This is a pretty bad idea, since we visit the tables in OIDorder which is not necessarily related to inheritance relationships.So far as I can tell, the consequences are just cosmetic: we mightdump DEFAULT or GENERATED expressions that we don't really need tobecause they match properties of the parent. Nonetheless, it's buggy,and somebody might someday add functionality here that fails lessbenignly when the traversal order varies.One issue is that when we decide we needn't dump a particularGENERATED expression, we physically unlink the struct for it,so that it will now look like the table has no such expression,causing the wrong choice to be made at any child visited later.We can improve that by instead clearing the dobj.dump flag,and taking care to check that flag when it comes time to dumpthe expression or not.The other problem is that if we decide we need to fake up a DEFAULTNULL clause to override a default that would otherwise get inherited,we modify the data structure in the reverse fashion, creating anattrdefs entry where there hadn't been one. It's harder to avoiddoing that, but since the backend won't report a plain "DEFAULT NULL"property we can modify the code to recognize ones we just added.Add some commentary to perhaps forestall future mistakes of thesame ilk.Since the effects of this seem only cosmetic, no back-patch.Discussion:https://postgr.es/m/1506298.1676323579@sss.pgh.pa.us1 parentb5737ef commit128dd9f
2 files changed
+29
-10
lines changedLines changed: 23 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
471 | 471 |
| |
472 | 472 |
| |
473 | 473 |
| |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
474 | 481 |
| |
475 | 482 |
| |
476 | 483 |
| |
| |||
519 | 526 |
| |
520 | 527 |
| |
521 | 528 |
| |
| 529 | + | |
| 530 | + | |
522 | 531 |
| |
523 |
| - | |
| 532 | + | |
| 533 | + | |
524 | 534 |
| |
525 | 535 |
| |
526 | 536 |
| |
527 | 537 |
| |
528 |
| - | |
| 538 | + | |
529 | 539 |
| |
530 |
| - | |
| 540 | + | |
531 | 541 |
| |
532 | 542 |
| |
533 | 543 |
| |
| |||
539 | 549 |
| |
540 | 550 |
| |
541 | 551 |
| |
542 |
| - | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
543 | 560 |
| |
544 | 561 |
| |
545 | 562 |
| |
| |||
575 | 592 |
| |
576 | 593 |
| |
577 | 594 |
| |
578 |
| - | |
| 595 | + | |
579 | 596 |
| |
580 | 597 |
| |
581 |
| - | |
| 598 | + | |
582 | 599 |
| |
583 | 600 |
| |
584 | 601 |
| |
|
Lines changed: 6 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8525 | 8525 |
| |
8526 | 8526 |
| |
8527 | 8527 |
| |
8528 |
| - | |
8529 |
| - | |
8530 |
| - | |
| 8528 | + | |
| 8529 | + | |
| 8530 | + | |
8531 | 8531 |
| |
8532 | 8532 |
| |
8533 | 8533 |
| |
| |||
15345 | 15345 |
| |
15346 | 15346 |
| |
15347 | 15347 |
| |
15348 |
| - | |
| 15348 | + | |
| 15349 | + | |
15349 | 15350 |
| |
15350 | 15351 |
| |
| 15352 | + | |
15351 | 15353 |
| |
15352 | 15354 |
| |
15353 | 15355 |
| |
|
0 commit comments
Comments
(0)