CREATE EXTENSION pg_stat_monitor;
SELECT pg_stat_monitor_reset();
 pg_stat_monitor_reset 
-----------------------
 
(1 row)

SELECT 1 AS num;
 num 
-----
   1
(1 row)

SELECT query,application_name FROM pg_stat_monitor ORDER BY query COLLATE "C";
             query              |      application_name       
--------------------------------+-----------------------------
 SELECT 1 AS num                | pg_regress/application_name
 SELECT pg_stat_monitor_reset() | pg_regress/application_name
(2 rows)

SELECT pg_stat_monitor_reset();
 pg_stat_monitor_reset 
-----------------------
 
(1 row)

SELECT 1 AS num;
 num 
-----
   1
(1 row)

SET pg_stat_monitor.pgsm_track_application_names='no';
SELECT 1 AS num;
 num 
-----
   1
(1 row)

SELECT query,application_name FROM pg_stat_monitor ORDER BY query, application_name COLLATE "C";
                         query                         |      application_name       
-------------------------------------------------------+-----------------------------
 SELECT 1 AS num                                       | pg_regress/application_name
 SELECT 1 AS num                                       | 
 SELECT pg_stat_monitor_reset()                        | pg_regress/application_name
 SET pg_stat_monitor.pgsm_track_application_names='no' | 
(4 rows)

SELECT pg_stat_monitor_reset();
 pg_stat_monitor_reset 
-----------------------
 
(1 row)

DROP EXTENSION pg_stat_monitor;
