Skip to content

Commit

Permalink
migration script from 1.2 to 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
zilder committed Feb 13, 2017
1 parent 369b49d commit b718cbd
Show file tree
Hide file tree
Showing 4 changed files with 916 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ regression.out
*.gcda
*.gcno
*.gcov
pg_pathman--*.sql
pg_pathman--1.3.sql
12 changes: 6 additions & 6 deletions init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION @extschema@.show_partition_list()
RETURNS TABLE (
parent REGCLASS,
"partition" REGCLASS,
partition REGCLASS,
parttype INT4,
partattr TEXT,
range_min TEXT,
Expand Down Expand Up @@ -643,21 +643,21 @@ SET pg_pathman.enable_partitionfilter = off; /* ensures that PartitionFilter is
*/
CREATE OR REPLACE FUNCTION @extschema@.copy_foreign_keys(
parent_relid REGCLASS,
partition_relid REGCLASS)
partition REGCLASS)
RETURNS VOID AS
$$
DECLARE
rec RECORD;

BEGIN
PERFORM @extschema@.validate_relname(parent_relid);
PERFORM @extschema@.validate_relname(partition_relid);
PERFORM @extschema@.validate_relname(partition);

FOR rec IN (SELECT oid as conid FROM pg_catalog.pg_constraint
WHERE conrelid = parent_relid AND contype = 'f')
LOOP
EXECUTE format('ALTER TABLE %s ADD %s',
partition_relid::TEXT,
partition::TEXT,
pg_catalog.pg_get_constraintdef(rec.conid));
END LOOP;
END
Expand Down Expand Up @@ -880,7 +880,7 @@ LANGUAGE C STRICT;
*/
CREATE OR REPLACE FUNCTION @extschema@.invoke_on_partition_created_callback(
parent_relid REGCLASS,
"partition" REGCLASS,
partition REGCLASS,
init_callback REGPROCEDURE,
start_value ANYELEMENT,
end_value ANYELEMENT)
Expand All @@ -892,7 +892,7 @@ LANGUAGE C;
*/
CREATE OR REPLACE FUNCTION @extschema@.invoke_on_partition_created_callback(
parent_relid REGCLASS,
"partition" REGCLASS,
partition REGCLASS,
init_callback REGPROCEDURE)
RETURNS VOID AS 'pg_pathman', 'invoke_on_partition_created_callback'
LANGUAGE C;
Loading

0 comments on commit b718cbd

Please sign in to comment.