forked from greenplum-db/gpbackup-archive
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix attnum mismatch in pg_statistic after drop column and database re…
…store (#90) Problem: In case a column (or columns) was dropped from a table, after backup and restore cycle, second backup may contain pg_statistic values with a type not matching the data (for ex. "array_in('{"test"}', '"timestamp"'::regtype::oid, -1)"). Root cause: Records from pg_statistic were backed up with their actual values, including attnums for the columns. But during restore, all tables are restored from scratch. So, if a column is dropped in the table before backup, after the restore attnum values in the pg_attribute table differ from the attnum values that were before the backup (if the dropped column is not the one with the highest attnum). But the restored values of pg_statistic had old attnums. So, pg_statistics was not consistent with pg_attribute, and one of the side effects was that on next backup the type for pg_statistic value was taken from other column (and some pg_statistic were just lost). Fix: On the restore phase the column name is used to obtain actual attnum value from the restored catalog and this value is now used when restoring statistics. The 'AttNumber' field is removed from the AttributeStatistic struct to prevent its future use. Ticket: ADBDEV-5861
- Loading branch information
Showing
8 changed files
with
221 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.