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 duplicated column definition in the gpbackup metadata (#83)
Problem description: If a column in a table had privileges granted for two (or more) users, gpbackup created metadata file, where this column was duplicated. Cause: The SQL query, that is used to retrieve information about all table columns in the function 'GetColumnDefinitions', had the 'unnest' function applied to the array of column-level access privileges from the 'pg_catalog.pg_attribute'. Because of the 'unnest', if there were several aclitems for a column, the result of the query had several rows returned for this column. But gpbackup treated all these rows as results for separate columns, causing duplication in the metadata. Fix: 'unnest' is removed in the query, 'attacl' is returned as is. Thus, for each column, there is only one row in the result of the query. Now, the field 'Privileges' in the 'ColumnDefinition' struct contains all column-level access privileges in a slice of strings ('pq.StringArray'). And later, in 'getColumnACL', this slice, where each string contains a separate aclitem, is iterated and each item is parsed as before. Plus, the 'Kind' field is removed from the 'ColumnDefinition' struct.
- Loading branch information
Showing
8 changed files
with
54 additions
and
39 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
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