Skip to content

Commit

Permalink
Merge pull request #14 from Riskified/DEV-87880-fix-pg_auth_members
Browse files Browse the repository at this point in the history
fix readGrantRole
  • Loading branch information
TomaBere authored Apr 21, 2024
2 parents a968f52 + c8b1aea commit 989f0f5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion postgresql/resource_postgresql_grant_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ func readGrantRole(db *DBConnection, d *schema.ResourceData) error {
&grantRoleName,
&withAdminOption,
}

var query string
if db.dbType == dbTypeCockroachdb {
query = fmt.Sprintf(` with a as (show grants on role %s for %s) select member as role , role_name as grant_role, is_admin as with_admin_option from a;
query = fmt.Sprintf(` with a as (show grants on role "%s" for "%s") select member as role , role_name as grant_role, is_admin as with_admin_option from a;
`, d.Get("grant_role"), d.Get("role"))
if err := db.QueryRow(query).Scan(values...); err != nil {
return fmt.Errorf("Error to show grants on role %s for %s :%w ", d.Get("grant_role"), d.Get("role"), err)
Expand Down

0 comments on commit 989f0f5

Please sign in to comment.