Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Revoke pg_stat_statements_reset() permissions
authorMichael Paquier <michael@paquier.xyz>
Tue, 25 Sep 2018 00:55:44 +0000 (09:55 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 25 Sep 2018 00:55:44 +0000 (09:55 +0900)
Commit 25fff40 has granted execute permission of the function
pg_stat_statements_reset() to default role "pg_read_all_stats", but this
role is meant to read statistics, and not to reset them.  The
permissions on this function are revoked from "pg_read_all_stats".  The
version of pg_stat_statements is bumped up in consequence.

Author: Haribabu Kommi
Reviewed-by: Michael Paquier, Amit Kapila
Discussion: https://postgr.es/m/CAJrrPGf5fCnKqXObpwGN9nMyD--tzOf-7LFCJiz59Z1wJ5qj9A@mail.gmail.com

contrib/pg_stat_statements/Makefile
contrib/pg_stat_statements/pg_stat_statements--1.5--1.6.sql [new file with mode: 0644]
contrib/pg_stat_statements/pg_stat_statements.control

index 39b368b70eb5dadc1abbf9e2df48936ce8493f3e..14a50380dcb0e63109286075fbf81368572034bc 100644 (file)
@@ -4,9 +4,10 @@ MODULE_big = pg_stat_statements
 OBJS = pg_stat_statements.o $(WIN32RES)
 
 EXTENSION = pg_stat_statements
-DATA = pg_stat_statements--1.4.sql pg_stat_statements--1.4--1.5.sql \
-   pg_stat_statements--1.3--1.4.sql pg_stat_statements--1.2--1.3.sql \
-   pg_stat_statements--1.1--1.2.sql pg_stat_statements--1.0--1.1.sql \
+DATA = pg_stat_statements--1.4.sql pg_stat_statements--1.5--1.6.sql \
+   pg_stat_statements--1.4--1.5.sql pg_stat_statements--1.3--1.4.sql \
+   pg_stat_statements--1.2--1.3.sql pg_stat_statements--1.1--1.2.sql \
+   pg_stat_statements--1.0--1.1.sql \
    pg_stat_statements--unpackaged--1.0.sql
 PGFILEDESC = "pg_stat_statements - execution statistics of SQL statements"
 
diff --git a/contrib/pg_stat_statements/pg_stat_statements--1.5--1.6.sql b/contrib/pg_stat_statements/pg_stat_statements--1.5--1.6.sql
new file mode 100644 (file)
index 0000000..4f8c7f7
--- /dev/null
@@ -0,0 +1,7 @@
+/* contrib/pg_stat_statements/pg_stat_statements--1.5--1.6.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION pg_stat_statements UPDATE TO '1.6'" to load this file. \quit
+
+-- Execution is only allowed for superusers, fixing issue with 1.5.
+REVOKE EXECUTE ON FUNCTION pg_stat_statements_reset() FROM pg_read_all_stats;
index 193fcdfafa03265680e8f345cda3d8b8af82e1f8..617038b4c05dab3d047f68e8457dfd7128d56f28 100644 (file)
@@ -1,5 +1,5 @@
 # pg_stat_statements extension
 comment = 'track execution statistics of all SQL statements executed'
-default_version = '1.5'
+default_version = '1.6'
 module_pathname = '$libdir/pg_stat_statements'
 relocatable = true