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
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 replaced with the 'array_to_string' function in the query. 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, separated by a comma. And later, in 'getColumnACL', this string with privileges is split into a slice of strings, each string containing separate aclitem, which is then parsed as before.
- Loading branch information
Showing
4 changed files
with
34 additions
and
10 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