Not able to "CREATE EXTENSION pg_stat_statements" in Azure Database for PostgreSQL flexible server

Manish Kumar Singh 1 Reputation point
2022-09-22T09:17:44.647+00:00

Not able to "CREATE EXTENSION pg_stat_statements" in Azure Database for PostgreSQL flexible server, please suggest how can we enable it
we are getting following error

dummy_database=> CREATE EXTENSION pg_stat_statements;  
ERROR:  permission denied to create extension "pg_stat_statements"  
HINT:  Must be superuser to create this extension.  

user cannot be SUPERUSER, in Azure Database for PostgreSQL
we have the pg_stat_statements extension available

dummy_database=> SELECT * FROM pg_available_extensions;  
             name             | default_version | installed_version |                                                       comment  
------------------------------+-----------------+-------------------+--------------------------------------------------------------------------------------------------------------------  
-  
 plv8                         | 3.0.0           |                   | PL/JavaScript (v8) trusted procedural language  
 pg_cron                      | 1.4-1           |                   | Job scheduler for PostgreSQL  
 sslinfo                      | 1.2             |                   | information about SSL certificates  
 pg_trgm                      | 1.5             |                   | text similarity measurement and index searching based on trigrams  
 dict_xsyn                    | 1.0             |                   | text search dictionary template for extended synonym processing  
 pg_repack                    | 1.4.7           |                   | Reorganize tables in PostgreSQL databases with minimal locks  
 bloom                        | 1.0             |                   | bloom access method - signature file based index  
 pglogical                    | 2.4.1           |                   | PostgreSQL Logical Replication  
 lo                           | 1.1             |                   | Large Object maintenance  
 address_standardizer_data_us | 3.2.0           |                   | Address Standardizer US dataset example  
 pg_buffercache               | 1.3             |                   | examine the shared buffer cache  
 azure                        | 1.0             |                   | azure extension for PostgreSQL service  
 autoinc                      | 1.0             |                   | functions for autoincrementing fields  
 btree_gin                    | 1.3             |                   | support for indexing common datatypes in GIN  
 pg_visibility                | 1.2             |                   | examine the visibility map (VM) and page-level visibility info  
 pglogical_origin             | 1.0.0           |                   | Dummy extension for compatibility when upgrading from Postgres 9.4  
 pgstattuple                  | 1.5             |                   | show tuple-level statistics  
 fuzzystrmatch                | 1.1             | 1.1               | determine similarities and distance between strings  
 cube                         | 1.4             |                   | data type for multidimensional cubes  
 ltree                        | 1.2             |                   | data type for hierarchical tree-like structures  
 postgis_tiger_geocoder       | 3.2.0           |                   | PostGIS tiger geocoder and reverse geocoder  
 intarray                     | 1.3             |                   | functions, operators, and index support for 1-D arrays of integers  
 dict_int                     | 1.0             |                   | text search dictionary template for integers  
 unaccent                     | 1.1             |                   | text search dictionary that removes accents  
 pgaudit                      | 1.5             |                   | provides auditing functionality  
 file_fdw                     | 1.0             |                   | foreign-data wrapper for flat file access  
 pgms_wait_sampling           | 1.0             |                   | PG Microsoft Wait Sampling  
 pgrowlocks                   | 1.2             |                   | show row-level locking information  
 pgcrypto                     | 1.3             |                   | cryptographic functions  
 earthdistance                | 1.1             |                   | calculate great-circle distances on the surface of the Earth  
 amcheck                      | 1.2             |                   | functions for verifying relation integrity  
 pg_stat_statements           | 1.8             |                   | track planning and execution statistics of all SQL statements executed  
 hypopg                       | 1.3.1           |                   | Hypothetical indexes for PostgreSQL  
 adminpack                    | 2.1             |                   | administrative functions for PostgreSQL  
 pgrouting                    | 3.3.0           |                   | pgRouting Extension  
 tablefunc                    | 1.0             |                   | functions that manipulate whole tables, including crosstab  
 plpgsql                      | 1.0             | 1.0               | PL/pgSQL procedural language  
 citus_columnar               | 11.0-1          |                   | Citus Columnar extension  
 isn                          | 1.2             |                   | data types for international product numbering standards  
 hstore                       | 1.7             |                   | data type for storing sets of (key, value) pairs  
 seg                          | 1.3             |                   | data type for representing line segments or floating-point intervals  
 plcoffee                     | 3.0.0           |                   | PL/CoffeeScript (v8) trusted procedural language  
 pg_partman                   | 4.5.0           |                   | Extension to manage partitioned tables by time or ID  
 postgis_raster               | 3.2.0           |                   | PostGIS raster types and functions  
 tsm_system_time              | 1.0             |                   | TABLESAMPLE method which accepts time in milliseconds as a limit  
 timescaledb                  | 2.5.1           |                   | Enables scalable inserts and complex queries for time-series data  
 insert_username              | 1.0             |                   | functions for tracking who changed a table  
 tcn                          | 1.0             |                   | Triggered change notifications  
 pgms_stats                   | 1.0             |                   | PG Microsoft Stats  
 postgres_fdw                 | 1.0             |                   | foreign-data wrapper for remote PostgreSQL servers  
 pg_freespacemap              | 1.2             |                   | examine the free space map (FSM)  
 pg_prewarm                   | 1.2             |                   | prewarm relation data  
 refint                       | 1.0             |                   | functions for implementing referential integrity (obsolete)  
 moddatetime                  | 1.0             |                   | functions for tracking last modification time  
 plls                         | 3.0.0           |                   | PL/LiveScript (v8) trusted procedural language  
 pageinspect                  | 1.8             |                   | inspect the contents of database pages at a low level  
 pgtap                        | 1.2.0           |                   | Unit testing for PostgreSQL  
 xml2                         | 1.1             |                   | XPath querying and XSLT  
 address_standardizer         | 3.2.0           |                   | Used to parse an address into constituent elements. Generally used to support geocoding address normalization step.  
 dblink                       | 1.2             |                   | connect to other PostgreSQL databases from within a database  
 postgis_sfcgal               | 3.2.0           |                   | PostGIS SFCGAL functions  
 intagg                       | 1.1             |                   | integer aggregator and enumerator (obsolete)  
 tsm_system_rows              | 1.0             |                   | TABLESAMPLE method which accepts number of rows as a limit  
 btree_gist                   | 1.5             |                   | support for indexing common datatypes in GiST  
 postgis                      | 3.2.0           |                   | PostGIS geometry and geography spatial types and functions  
 postgis_topology             | 3.2.0           |                   | PostGIS topology spatial types and functions  
 citext                       | 1.6             |                   | data type for case-insensitive character strings  
 pgaadauth                    | 1.0             |                   | Azure Active Directory Authentication  
 orafce                       | 3.18            |                   | Functions and operators that emulate a subset of functions and packages from the Oracle RDBMS  
 pg_qs                        | 2.2             |                   | Query Store  
 uuid-ossp                    | 1.1             |                   | generate universally unique identifiers (UUIDs)  
 azure_blobcopy               | 1.0             |                   | PostgreSQL Azure Blob Copy Utility  
(72 rows)  
Azure Database for PostgreSQL
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 27,717 Reputation points Microsoft Employee
    2022-09-22T11:42:33.117+00:00

    Hi, @Manish Kumar Singh Welcome to the Microsoft Q&A Platform, and thanks for your query.
    As we understand you are facing a permission issue while CREATE EXTENSION pg_stat_statements.
    Please make sure you have added pg_stat_statements under the server parameter by searching for azure.extensions as shown below.
    243883-image.png

    Please let me know if you need any more details.

    Regards
    Geetha

    Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer.

    2 people found this answer helpful.