From 40564ad64b1c50fcbcaa806e80549f52cf0e34b8 Mon Sep 17 00:00:00 2001 From: Ivan Kovmir Date: Mon, 27 Jan 2025 10:39:56 +0100 Subject: [PATCH 1/4] Fix config reload crash for <=14 SysLoggerMain() does not have shared memory acess, therefore crashes on attempts to access it. --- pg_show_plans.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pg_show_plans.c b/pg_show_plans.c index d591ef9..f41f998 100644 --- a/pg_show_plans.c +++ b/pg_show_plans.c @@ -159,7 +159,11 @@ _PG_init(void) NULL, &start_enabled, true, +#if PG_VERSION_NUM >= 150000 PGC_USERSET, +#else + PGC_POSTMASTER, +#endif 0, NULL, set_state, show_state); DefineCustomIntVariable("pg_show_plans.max_plan_length", @@ -183,7 +187,11 @@ _PG_init(void) &plan_format, EXPLAIN_FORMAT_TEXT, plan_formats, +#if PG_VERSION_NUM >= 150000 PGC_USERSET, +#else + PGC_POSTMASTER, +#endif 0, NULL, prop_format_to_shmem, show_format); From b17fdf2cdbfe4af50293b9eb53d4039793218c1e Mon Sep 17 00:00:00 2001 From: Ivan Kovmir Date: Mon, 27 Jan 2025 11:04:22 +0100 Subject: [PATCH 2/4] Fix regression tests for <=14 --- expected/formats_2.out | 57 ++++++++++++++++++++++++++++++++++++ expected/pg_show_plans_1.out | 42 ++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 expected/formats_2.out create mode 100644 expected/pg_show_plans_1.out diff --git a/expected/formats_2.out b/expected/formats_2.out new file mode 100644 index 0000000..f27ecdc --- /dev/null +++ b/expected/formats_2.out @@ -0,0 +1,57 @@ +-- explain output on PG12/13 is missing "Async Capable" +select setting::int < 140000 as pg12_13 from pg_settings where name = 'server_version_num'; + pg12_13 +--------- + f +(1 row) + +-- json output +set pg_show_plans.plan_format = 'json'; +ERROR: parameter "pg_show_plans.plan_format" cannot be changed without restarting the server +show pg_show_plans.plan_format; + pg_show_plans.plan_format +--------------------------- + text +(1 row) + +select * from nest(); + level | plan +-------+------ +(0 rows) + +-- yaml output +set pg_show_plans.plan_format = 'yaml'; +ERROR: parameter "pg_show_plans.plan_format" cannot be changed without restarting the server +show pg_show_plans.plan_format; + pg_show_plans.plan_format +--------------------------- + text +(1 row) + +select * from nest(); + level | plan +-------+------ +(0 rows) + +-- xml output +set pg_show_plans.plan_format = 'xml'; +ERROR: parameter "pg_show_plans.plan_format" cannot be changed without restarting the server +show pg_show_plans.plan_format; + pg_show_plans.plan_format +--------------------------- + text +(1 row) + +select * from nest(); + level | plan +-------+------ +(0 rows) + +-- check plan format after reconnect +\c +show pg_show_plans.plan_format; + pg_show_plans.plan_format +--------------------------- + text +(1 row) + diff --git a/expected/pg_show_plans_1.out b/expected/pg_show_plans_1.out new file mode 100644 index 0000000..73fcea4 --- /dev/null +++ b/expected/pg_show_plans_1.out @@ -0,0 +1,42 @@ +create extension pg_show_plans; +show pg_show_plans.is_enabled; + pg_show_plans.is_enabled +-------------------------- + off +(1 row) + +show pg_show_plans.max_plan_length; + pg_show_plans.max_plan_length +------------------------------- + 16384 +(1 row) + +create function nest() + returns table (level int, plan text) + language plpgsql +as $$ + begin + return query + select pg_show_plans.level, pg_show_plans.plan from pg_show_plans + where pg_show_plans.level >= 0; + end; +$$; +-- text output +set pg_show_plans.plan_format = 'text'; +ERROR: parameter "pg_show_plans.plan_format" cannot be changed without restarting the server +show pg_show_plans.plan_format; + pg_show_plans.plan_format +--------------------------- + text +(1 row) + +select level, plan from pg_show_plans; + level | plan +-------+------ +(0 rows) + +select * from nest(); + level | plan +-------+------ +(0 rows) + From eb3e6286348acf4798559739164f018e8704dcb3 Mon Sep 17 00:00:00 2001 From: Ivan Kovmir Date: Tue, 11 Feb 2025 10:18:12 +0100 Subject: [PATCH 3/4] Revert "Fix regression tests for <=14" This reverts commit b17fdf2cdbfe4af50293b9eb53d4039793218c1e. --- expected/formats_2.out | 57 ------------------------------------ expected/pg_show_plans_1.out | 42 -------------------------- 2 files changed, 99 deletions(-) delete mode 100644 expected/formats_2.out delete mode 100644 expected/pg_show_plans_1.out diff --git a/expected/formats_2.out b/expected/formats_2.out deleted file mode 100644 index f27ecdc..0000000 --- a/expected/formats_2.out +++ /dev/null @@ -1,57 +0,0 @@ --- explain output on PG12/13 is missing "Async Capable" -select setting::int < 140000 as pg12_13 from pg_settings where name = 'server_version_num'; - pg12_13 ---------- - f -(1 row) - --- json output -set pg_show_plans.plan_format = 'json'; -ERROR: parameter "pg_show_plans.plan_format" cannot be changed without restarting the server -show pg_show_plans.plan_format; - pg_show_plans.plan_format ---------------------------- - text -(1 row) - -select * from nest(); - level | plan --------+------ -(0 rows) - --- yaml output -set pg_show_plans.plan_format = 'yaml'; -ERROR: parameter "pg_show_plans.plan_format" cannot be changed without restarting the server -show pg_show_plans.plan_format; - pg_show_plans.plan_format ---------------------------- - text -(1 row) - -select * from nest(); - level | plan --------+------ -(0 rows) - --- xml output -set pg_show_plans.plan_format = 'xml'; -ERROR: parameter "pg_show_plans.plan_format" cannot be changed without restarting the server -show pg_show_plans.plan_format; - pg_show_plans.plan_format ---------------------------- - text -(1 row) - -select * from nest(); - level | plan --------+------ -(0 rows) - --- check plan format after reconnect -\c -show pg_show_plans.plan_format; - pg_show_plans.plan_format ---------------------------- - text -(1 row) - diff --git a/expected/pg_show_plans_1.out b/expected/pg_show_plans_1.out deleted file mode 100644 index 73fcea4..0000000 --- a/expected/pg_show_plans_1.out +++ /dev/null @@ -1,42 +0,0 @@ -create extension pg_show_plans; -show pg_show_plans.is_enabled; - pg_show_plans.is_enabled --------------------------- - off -(1 row) - -show pg_show_plans.max_plan_length; - pg_show_plans.max_plan_length -------------------------------- - 16384 -(1 row) - -create function nest() - returns table (level int, plan text) - language plpgsql -as $$ - begin - return query - select pg_show_plans.level, pg_show_plans.plan from pg_show_plans - where pg_show_plans.level >= 0; - end; -$$; --- text output -set pg_show_plans.plan_format = 'text'; -ERROR: parameter "pg_show_plans.plan_format" cannot be changed without restarting the server -show pg_show_plans.plan_format; - pg_show_plans.plan_format ---------------------------- - text -(1 row) - -select level, plan from pg_show_plans; - level | plan --------+------ -(0 rows) - -select * from nest(); - level | plan --------+------ -(0 rows) - From 5c9c12f0911c3aff0a25d5fcbb56780f370a243f Mon Sep 17 00:00:00 2001 From: Ivan Kovmir Date: Tue, 11 Feb 2025 10:18:39 +0100 Subject: [PATCH 4/4] Disable CI for <=14 --- .github/workflows/installcheck.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/installcheck.yml b/.github/workflows/installcheck.yml index 71d2c09..aa35197 100644 --- a/.github/workflows/installcheck.yml +++ b/.github/workflows/installcheck.yml @@ -19,8 +19,6 @@ jobs: - 17 - 16 - 15 - - 14 - - 13 env: PGVERSION: ${{ matrix.pgversion }}