Skip to content

Commit

Permalink
Fix pg_dump error on powa_module_config
Browse files Browse the repository at this point in the history
powa_modules are used for cluster-wide pg_stat datasources and do not support
custom datasources.

powa_modules and powa_module_functions got it right and don't have the usual
"added_manually" column used to distinguish custom rows, but
powa_module_functions had a wrong reference to this column.  Also,
powa_module_config was incorrectly created with an added_manually column, and
dump was configure using it but the extension install script was incorrectly
marking some of the init-time data to be custom.

To fix, get rid of any mention of that column in either the table structure of
the dump config.

Thanks to github user guruguruguru for the report.
  • Loading branch information
rjuju committed Dec 17, 2024
1 parent b6d8d6e commit 65b6d4b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions powa--5.0.0--5.0.1dev.sql
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "ALTER EXTENSION powa" to load this file. \quit

ALTER TABLE @[email protected]_module_config DROP COLUMN added_manually;

SELECT pg_catalog.pg_extension_config_dump('@[email protected]_module_config','');
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_module_functions','');
11 changes: 5 additions & 6 deletions powa--5.0.1dev.sql
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,16 @@ CREATE TABLE @[email protected]_module_config (
srvid integer NOT NULL,
module text NOT NULL,
enabled bool NOT NULL default true,
added_manually boolean NOT NULL default true,
PRIMARY KEY (srvid, module),
FOREIGN KEY (srvid) REFERENCES @[email protected]_servers(id)
MATCH FULL ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (module) REFERENCES @[email protected]_modules(module)
MATCH FULL ON UPDATE CASCADE ON DELETE CASCADE
);

INSERT INTO @[email protected]_module_config (srvid, module, added_manually) VALUES
(0, 'pg_database', false),
(0, 'pg_role', false);
INSERT INTO @[email protected]_module_config (srvid, module) VALUES
(0, 'pg_database'),
(0, 'pg_role');

CREATE TABLE @[email protected]_module_functions (
module text NOT NULL,
Expand Down Expand Up @@ -3166,8 +3165,8 @@ SELECT pg_catalog.pg_extension_config_dump('@[email protected]_all_tables_history_
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_extensions','WHERE added_manually');
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_extension_functions','WHERE added_manually');
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_extension_config','WHERE added_manually');
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_module_functions','WHERE added_manually');
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_module_config','WHERE added_manually');
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_module_functions','');
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_module_config','');
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_catalog_databases','');
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_catalog_roles','');
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_catalog_class','');
Expand Down

0 comments on commit 65b6d4b

Please sign in to comment.