Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion redshift/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,16 @@ func validatePrivileges(privileges []string, objectType string) bool {
default:
return false
}
case "DATABASE":
switch strings.ToUpper(p) {
case "CREATE", "TEMPORARY":
continue
default:
return false
}
default:
return false
}

}

return true
Expand All @@ -182,3 +190,16 @@ func appendIfTrue(condition bool, item string, list *[]string) {
*list = append(*list, item)
}
}

func setToPgIdentList(identifiers *schema.Set, prefix string) string {
quoted := make([]string, identifiers.Len())
for i, identifier := range identifiers.List() {
if prefix == "" {
quoted[i] = pq.QuoteIdentifier(identifier.(string))
} else {
quoted[i] = fmt.Sprintf("%s.%s", pq.QuoteIdentifier(prefix), pq.QuoteIdentifier(identifier.(string)))
}
}

return strings.Join(quoted, ",")
}
1 change: 1 addition & 0 deletions redshift/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ func Provider() *schema.Provider {
"redshift_schema": redshiftSchema(),
"redshift_privilege": redshiftPrivilege(),
"redshift_default_privileges": redshiftDefaultPrivileges(),
"redshift_grant": redshiftGrant(),
"redshift_database": redshiftDatabase(),
"redshift_datashare": redshiftDatashare(),
"redshift_datashare_privilege": redshiftDatasharePrivilege(),
Expand Down
Loading