Skip to content

Commit c23cf63

Browse files
committed
Fix Error granting role pg_database_owner to postgres: pq: role pg_database_owner cannot have explicit members
1 parent 1ef7dd0 commit c23cf63

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

postgresql/resource_postgresql_schema.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,14 @@ func resourcePostgreSQLSchemaCreate(db *DBConnection, d *schema.ResourceData) er
136136
}
137137
rolesToGrant = append(rolesToGrant, dbOwner)
138138

139-
schemaOwner := d.Get("owner").(string)
139+
owners := []string{}
140+
owners = append(owners, d.Get("owner").(string))
141+
owners, err = resolveOwners(txn, owners)
142+
if err != nil {
143+
return err
144+
}
145+
schemaOwner := owners[0]
146+
140147
if schemaOwner != "" && schemaOwner != dbOwner {
141148
rolesToGrant = append(rolesToGrant, schemaOwner)
142149

0 commit comments

Comments
 (0)