From 496899ccc2fd1b84bd1a8c8b3a7f0c667e5329f0 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 10 Jun 2016 10:42:01 -0400 Subject: [PATCH] Update pg_stat_statements extension for parallel query. All functions provided by this extension are PARALLEL SAFE. Given the general prohibition against write operations in parallel queries, it is perhaps a bit surprising that pg_stat_statements_reset() is parallel safe. But since it only modifies shared memory, not the database, it's OK. Andreas Karlsson --- contrib/pg_stat_statements/Makefile | 6 +++--- .../pg_stat_statements/pg_stat_statements--1.3--1.4.sql | 7 +++++++ ...tat_statements--1.3.sql => pg_stat_statements--1.4.sql} | 6 +++--- contrib/pg_stat_statements/pg_stat_statements.control | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 contrib/pg_stat_statements/pg_stat_statements--1.3--1.4.sql rename contrib/pg_stat_statements/{pg_stat_statements--1.3.sql => pg_stat_statements--1.4.sql} (90%) diff --git a/contrib/pg_stat_statements/Makefile b/contrib/pg_stat_statements/Makefile index 835ec82fc6..ddcdb10b92 100644 --- a/contrib/pg_stat_statements/Makefile +++ b/contrib/pg_stat_statements/Makefile @@ -4,9 +4,9 @@ MODULE_big = pg_stat_statements OBJS = pg_stat_statements.o $(WIN32RES) EXTENSION = pg_stat_statements -DATA = pg_stat_statements--1.3.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 +DATA = pg_stat_statements--1.4.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" LDFLAGS_SL += $(filter -lm, $(LIBS)) diff --git a/contrib/pg_stat_statements/pg_stat_statements--1.3--1.4.sql b/contrib/pg_stat_statements/pg_stat_statements--1.3--1.4.sql new file mode 100644 index 0000000000..ae70c1f802 --- /dev/null +++ b/contrib/pg_stat_statements/pg_stat_statements--1.3--1.4.sql @@ -0,0 +1,7 @@ +/* contrib/pg_stat_statements/pg_stat_statements--1.3--1.4.sql */ + +-- complain if script is sourced in psql, rather than via ALTER EXTENSION +\echo Use "ALTER EXTENSION pg_stat_statements UPDATE TO '1.4'" to load this file. \quit + +ALTER FUNCTION pg_stat_statements_reset() PARALLEL SAFE; +ALTER FUNCTION pg_stat_statements(boolean) PARALLEL SAFE; diff --git a/contrib/pg_stat_statements/pg_stat_statements--1.3.sql b/contrib/pg_stat_statements/pg_stat_statements--1.4.sql similarity index 90% rename from contrib/pg_stat_statements/pg_stat_statements--1.3.sql rename to contrib/pg_stat_statements/pg_stat_statements--1.4.sql index 92ed0571e9..58cdf600fc 100644 --- a/contrib/pg_stat_statements/pg_stat_statements--1.3.sql +++ b/contrib/pg_stat_statements/pg_stat_statements--1.4.sql @@ -1,4 +1,4 @@ -/* contrib/pg_stat_statements/pg_stat_statements--1.3.sql */ +/* contrib/pg_stat_statements/pg_stat_statements--1.4.sql */ -- complain if script is sourced in psql, rather than via CREATE EXTENSION \echo Use "CREATE EXTENSION pg_stat_statements" to load this file. \quit @@ -7,7 +7,7 @@ CREATE FUNCTION pg_stat_statements_reset() RETURNS void AS 'MODULE_PATHNAME' -LANGUAGE C; +LANGUAGE C PARALLEL SAFE; CREATE FUNCTION pg_stat_statements(IN showtext boolean, OUT userid oid, @@ -36,7 +36,7 @@ CREATE FUNCTION pg_stat_statements(IN showtext boolean, ) RETURNS SETOF record AS 'MODULE_PATHNAME', 'pg_stat_statements_1_3' -LANGUAGE C STRICT VOLATILE; +LANGUAGE C STRICT VOLATILE PARALLEL SAFE; -- Register a view on the function for ease of use. CREATE VIEW pg_stat_statements AS diff --git a/contrib/pg_stat_statements/pg_stat_statements.control b/contrib/pg_stat_statements/pg_stat_statements.control index 53df9789df..24038f56b1 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.control +++ b/contrib/pg_stat_statements/pg_stat_statements.control @@ -1,5 +1,5 @@ # pg_stat_statements extension comment = 'track execution statistics of all SQL statements executed' -default_version = '1.3' +default_version = '1.4' module_pathname = '$libdir/pg_stat_statements' relocatable = true -- 2.40.0