Skip to content

Commit

Permalink
Merge pull request #47 from brainly/remove-cascade-from-user-and-grou…
Browse files Browse the repository at this point in the history
…p-drop

Remove CASCADE from ALTER DEFAULT when dropping users and groups
  • Loading branch information
winglot authored Jan 26, 2022
2 parents 8210799 + 460bb1e commit 886e389
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion redshift/resource_redshift_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func resourceRedshiftGroupDelete(db *DBConnection, d *schema.ResourceData) error
if _, err := tx.Exec(fmt.Sprintf("REVOKE ALL ON ALL TABLES IN SCHEMA %s FROM GROUP %s", pq.QuoteIdentifier(schemaName), pq.QuoteIdentifier(groupName))); err != nil {
return err
}
if _, err := tx.Exec(fmt.Sprintf("ALTER DEFAULT PRIVILEGES IN SCHEMA %s REVOKE ALL ON TABLES FROM GROUP %s CASCADE", pq.QuoteIdentifier(schemaName), pq.QuoteIdentifier(groupName))); err != nil {
if _, err := tx.Exec(fmt.Sprintf("ALTER DEFAULT PRIVILEGES IN SCHEMA %s REVOKE ALL ON TABLES FROM GROUP %s", pq.QuoteIdentifier(schemaName), pq.QuoteIdentifier(groupName))); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion redshift/resource_redshift_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func resourceRedshiftUserDelete(db *DBConnection, d *schema.ResourceData) error
return err
}

if _, err := tx.Exec(fmt.Sprintf("ALTER DEFAULT PRIVILEGES IN SCHEMA %s REVOKE ALL ON TABLES FROM %s CASCADE", pq.QuoteIdentifier(schemaName), pq.QuoteIdentifier(userName))); err != nil {
if _, err := tx.Exec(fmt.Sprintf("ALTER DEFAULT PRIVILEGES IN SCHEMA %s REVOKE ALL ON TABLES FROM %s", pq.QuoteIdentifier(schemaName), pq.QuoteIdentifier(userName))); err != nil {
return err
}

Expand Down

0 comments on commit 886e389

Please sign in to comment.