From 8e439159448f6eb50c3f295b55a477d671000ade Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 30 Mar 2020 18:33:29 +0200 Subject: [PATCH] Restore 2.3.0 schema files These were changed during the reverts, but we should keep them as they were at the time of release. --- pglogical--2.2.2--2.3.0.sql | 41 +++++++++++++++++++++++++++++++++++++ pglogical--2.3.0.sql | 16 +++++++++++---- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/pglogical--2.2.2--2.3.0.sql b/pglogical--2.2.2--2.3.0.sql index b6f02fd..e65808f 100644 --- a/pglogical--2.2.2--2.3.0.sql +++ b/pglogical--2.2.2--2.3.0.sql @@ -9,3 +9,44 @@ RETURNS oid STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_create_s DROP FUNCTION pglogical.create_subscription(subscription_name name, provider_dsn text, replication_sets text[], synchronize_structure boolean, synchronize_data boolean, forward_origins text[], apply_delay interval); + +ALTER TABLE pglogical.replication_set_table + ADD COLUMN set_nsptarget name NOT NULL + , ADD COLUMN set_reltarget name NOT NULL; +ALTER TABLE pglogical.replication_set_seq + ADD COLUMN set_nsptarget name NOT NULL + , ADD COLUMN set_seqtarget name NOT NULL; +DROP FUNCTION pglogical.show_repset_table_info(regclass, text[]); +CREATE FUNCTION pglogical.show_repset_table_info(relation regclass, repsets text[], OUT relid oid, OUT nspname text, + OUT relname text, OUT att_list text[], OUT has_row_filter boolean, OUT nsptarget text, OUT reltarget text) +RETURNS record STRICT STABLE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_show_repset_table_info'; + +CREATE FUNCTION pglogical.show_repset_table_info_by_target(nsptarget name, reltarget name, repsets text[], OUT relid oid, OUT nspname text, + OUT relname text, OUT att_list text[], OUT has_row_filter boolean, OUT nsptarget text, OUT reltarget text) +RETURNS SETOF record STRICT STABLE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_show_repset_table_info_by_target'; + +UPDATE pglogical.replication_set_table + SET set_nsptarget = n.nspname + , set_reltarget = c.relname +FROM pg_class c + JOIN pg_namespace n ON n.oid = c.relnamespace +WHERE c.oid = set_reloid; + +UPDATE pglogical.replication_set_seq + SET set_nsptarget = n.nspname + , set_seqtarget = c.relname +FROM pg_class c + JOIN pg_namespace n ON n.oid = c.relnamespace +WHERE c.oid = set_seqoid; + +-- a VACUUM FULL of the table above would be nice here. + +DROP FUNCTION pglogical.replication_set_add_table(name, regclass, boolean, + text[], text); +CREATE FUNCTION pglogical.replication_set_add_table(set_name name, relation regclass, synchronize_data boolean DEFAULT false, + columns text[] DEFAULT NULL, row_filter text DEFAULT NULL, nsptarget name DEFAULT NULL, reltarget name DEFAULT NULL) +RETURNS boolean CALLED ON NULL INPUT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_replication_set_add_table'; + +DROP FUNCTION pglogical.replication_set_add_sequence(name, regclass, boolean); +CREATE FUNCTION pglogical.replication_set_add_sequence(set_name name, relation regclass, synchronize_data boolean DEFAULT false, nsptarget name DEFAULT NULL, reltarget name DEFAULT NULL) +RETURNS boolean VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_replication_set_add_sequence'; diff --git a/pglogical--2.3.0.sql b/pglogical--2.3.0.sql index 52c1dbe..5ef62fa 100644 --- a/pglogical--2.3.0.sql +++ b/pglogical--2.3.0.sql @@ -97,12 +97,16 @@ CREATE TABLE pglogical.replication_set_table ( set_reloid regclass NOT NULL, set_att_list text[], set_row_filter pg_node_tree, + set_nsptarget name NOT NULL, + set_reltarget name NOT NULL, PRIMARY KEY(set_id, set_reloid) ) WITH (user_catalog_table=true); CREATE TABLE pglogical.replication_set_seq ( set_id oid NOT NULL, set_seqoid regclass NOT NULL, + set_nsptarget name NOT NULL, + set_seqtarget name NOT NULL, PRIMARY KEY(set_id, set_seqoid) ) WITH (user_catalog_table=true); @@ -168,15 +172,15 @@ CREATE FUNCTION pglogical.drop_replication_set(set_name name, ifexists boolean D RETURNS boolean STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_drop_replication_set'; CREATE FUNCTION pglogical.replication_set_add_table(set_name name, relation regclass, synchronize_data boolean DEFAULT false, - columns text[] DEFAULT NULL, row_filter text DEFAULT NULL) + columns text[] DEFAULT NULL, row_filter text DEFAULT NULL, nsptarget name DEFAULT NULL, reltarget name DEFAULT NULL) RETURNS boolean CALLED ON NULL INPUT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_replication_set_add_table'; CREATE FUNCTION pglogical.replication_set_add_all_tables(set_name name, schema_names text[], synchronize_data boolean DEFAULT false) RETURNS boolean STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_replication_set_add_all_tables'; CREATE FUNCTION pglogical.replication_set_remove_table(set_name name, relation regclass) RETURNS boolean STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_replication_set_remove_table'; -CREATE FUNCTION pglogical.replication_set_add_sequence(set_name name, relation regclass, synchronize_data boolean DEFAULT false) -RETURNS boolean STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_replication_set_add_sequence'; +CREATE FUNCTION pglogical.replication_set_add_sequence(set_name name, relation regclass, synchronize_data boolean DEFAULT false, nsptarget name DEFAULT NULL, reltarget name DEFAULT NULL) +RETURNS boolean VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_replication_set_add_sequence'; CREATE FUNCTION pglogical.replication_set_add_all_sequences(set_name name, schema_names text[], synchronize_data boolean DEFAULT false) RETURNS boolean STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_replication_set_add_all_sequences'; CREATE FUNCTION pglogical.replication_set_remove_sequence(set_name name, relation regclass) @@ -196,9 +200,13 @@ CREATE FUNCTION pglogical.table_data_filtered(reltyp anyelement, relation regcla RETURNS SETOF anyelement CALLED ON NULL INPUT STABLE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_table_data_filtered'; CREATE FUNCTION pglogical.show_repset_table_info(relation regclass, repsets text[], OUT relid oid, OUT nspname text, - OUT relname text, OUT att_list text[], OUT has_row_filter boolean) + OUT relname text, OUT att_list text[], OUT has_row_filter boolean, OUT nsptarget text, OUT reltarget text) RETURNS record STRICT STABLE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_show_repset_table_info'; +CREATE FUNCTION pglogical.show_repset_table_info_by_target(nsptarget name, reltarget name, repsets text[], OUT relid oid, OUT nspname text, + OUT relname text, OUT att_list text[], OUT has_row_filter boolean, OUT nsptarget text, OUT reltarget text) +RETURNS SETOF record STRICT STABLE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_show_repset_table_info_by_target'; + CREATE FUNCTION pglogical.show_subscription_table(subscription_name name, relation regclass, OUT nspname text, OUT relname text, OUT status text) RETURNS record STRICT STABLE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_show_subscription_table';