My question is with respect to Azure Database for Postgres Flexible server (version PG16).
I tried to create extension on current database (logged into database as db owner) however I see an error stating "ERROR: Only members of "azure_pg_admin" are allowed to use CREATE EXTENSION"
Where as for uuid-ossp extenstion Azure documentation states “This module is considered “trusted”, that is, it can be installed by non-superusers who have CREATE privilege on the current database.
Question : Why do we need to assign azure_pg_admin role to a database owner to create extenstion on his own database? These extensions are already part of available extension list.
m_event_db=> select version();
version
PostgreSQL 16.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 11.2.0, 64-bit
(1 row)
m_event_db=>
m_event_db=> \du;
List of roles
Role name | Attributes |
Member of
----------------------------+------------------------------------------------------------+----------------------------------------------------------------------------------------------
azure_pg_admin | Cannot login | {pg_read_all_data,pg_monitor,pg_read_all_settings,pg_read_all_stats,pg_stat_scan_tables,pg_signal_backend,pg_checkpoint,pg_create_subscription}
azuresu | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
dbadmin | Create role, Create DB, Bypass RLS | {pg_read_all_settings,pg_read_all_stats,pg_stat_scan_tables,azure_pg_admin,m_event_db,m_event_db}
m_event_db | | {pg_stat_scan_tables}
m_event_db=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges
------------------------+----------------------------+----------+------------+------------+------------+-----------------+-----------------------------------------------------------
azure_maintenance | azuresu | UTF8 | en_US.utf8 | en_US.utf8 | | libc |
azure_sys | azuresu | UTF8 | en_US.utf8 | en_US.utf8 | | libc |
m_event_db | m_event_db | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =Tc/m_event_db +
| | | | | | | m_event_db=CTc/m_event_db
postgres | azure_pg_admin | UTF8 | en_US.utf8 | en_US.utf8 | | libc |
template0 | azure_pg_admin | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/azure_pg_admin +
| | | | | | | azure_pg_admin=CTc/azure_pg_admin
template1 | azure_pg_admin | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/azure_pg_admin +
| | | | | | | azure_pg_admin=CTc/azure_pg_admin
m_event_db=> SELECT * FROM pg_extension;
oid | extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition
-------+-------------+----------+--------------+----------------+------------+-----------+--------------
14258 | plpgsql | 10 | 11 | f | 1.0 | |
25901 | uuid-ossp | 10 | 2200 | t | 1.1 | |
25912 | pgstattuple | 10 | 2200 | t | 1.5 | |
(3 rows)
m_event_db=> SELECT * FROM pg_available_extensions WHERE name = 'uuid-ossp';
name | default_version | installed_version | comment
-----------+-----------------+-------------------+-------------------------------------------------
uuid-ossp | 1.1 | 1.1 | generate universally unique identifiers (UUIDs)
(1 row)
m_event_db=> SELECT * FROM pg_available_extensions WHERE name = 'pgstattuple';
name | default_version | installed_version | comment
-------------+-----------------+-------------------+-----------------------------
pgstattuple | 1.5 | 1.5 | show tuple-level statistics
(1 row)
m_event_db=> CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
ERROR: Only members of "azure_pg_admin" are allowed to use CREATE EXTENSION
m_event_db=> CREATE EXTENSION IF NOT EXISTS pgstattuple;
ERROR: Only members of "azure_pg_admin" are allowed to use CREATE EXTENSION
m_event_db=>