The postgresql_privs module does not currently work with issuing standard grants/revokes on foreign tables. As far as postgres is concerned, the way that grants are handled here is identical to regular tables. Interestingly, using postgreql_privs to create default_privsdoes work for foreign tables that exist in a schema.
The issue is purely because the get_table_acls function when querying pg_class is not considering foreign tables at all relkind = 'f', thus the acls for the foreign table never attempt to get generated.
MacOS 14.6.1 and AWX 21.8.0
This is reproducible on managed databases where we are connecting via host/port, so the OS details are not particularly relevant.
STEPS TO REPRODUCE
- name: Grant a single privilege on foreign table
postgresql_privs:
state: "present"
roles: "user_to_grant"
privs: "INSERT"
objs: "foreign_table1"
db: "db_name"
EXPECTED RESULTS
Expect to see a grant issued for the specified table
The query for the grant is correctly generated, but never executed, hence the "changed": false because the get_table_acls function is excluding it from consideration
SUMMARY
The
postgresql_privs
module does not currently work with issuing standard grants/revokes on foreign tables. As far as postgres is concerned, the way that grants are handled here is identical to regular tables. Interestingly, usingpostgreql_privs
to createdefault_privs
does work for foreign tables that exist in a schema.The issue is purely because the
get_table_acls
function when queryingpg_class
is not considering foreign tables at allrelkind = 'f'
, thus the acls for the foreign table never attempt to get generated.ISSUE TYPE
COMPONENT NAME
postgresql_privs
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
MacOS 14.6.1 and AWX 21.8.0 This is reproducible on managed databases where we are connecting via host/port, so the OS details are not particularly relevant.
STEPS TO REPRODUCE
EXPECTED RESULTS
Expect to see a grant issued for the specified table
ACTUAL RESULTS
The query for the grant is correctly generated, but never executed, hence the
"changed": false
because theget_table_acls
function is excluding it from consideration