@@ -272,7 +272,7 @@ func readDatabaseRolePriviges(txn *sql.Tx, db *DBConnection, d *schema.ResourceD
272
272
var privileges pq.ByteaArray
273
273
//cockroachdb does not support aclexplode
274
274
if ! db .featureSupported (fetureAclExplode ) {
275
- query = fmt .Sprintf (`with a as (show grants on database %s for %s) select array_agg(privilege_type) from a` , dbName , role )
275
+ query = fmt .Sprintf (`with a as (show grants on database %s for %s) select array_agg(privilege_type) from a where grantee='%s' ` , dbName , role , role )
276
276
if err := txn .QueryRow (query ).Scan (& privileges ); err != nil {
277
277
return fmt .Errorf ("could not read privileges for database %s: %w" , dbName , err )
278
278
}
@@ -301,7 +301,7 @@ func readSchemaRolePriviges(txn *sql.Tx, db *DBConnection, d *schema.ResourceDat
301
301
dbName = "\" " + dbName + "\" "
302
302
}
303
303
if ! db .featureSupported (fetureAclExplode ) {
304
- query = fmt .Sprintf (`with a as ( show grants on schema %s for %s) select array_agg(privilege_type) from a;` , dbName , role )
304
+ query = fmt .Sprintf (`with a as ( show grants on schema %s for %s) select array_agg(privilege_type) from a where grantee='%s' ;` , dbName , role , role )
305
305
if err := txn .QueryRow (query ).Scan (& privileges ); err != nil {
306
306
return fmt .Errorf ("could not read privileges for database %s: %w" , dbName , err )
307
307
}
0 commit comments