Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4f932ab

Browse files
committed
Fix migration script
1 parent77ab2c4 commit4f932ab

File tree

2 files changed

+17
-54
lines changed

2 files changed

+17
-54
lines changed

‎Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ DATA_built = pg_pathman--$(EXTVERSION).sql
2525
DATA = pg_pathman--1.0--1.1.sql\
2626
pg_pathman--1.1--1.2.sql\
2727
pg_pathman--1.2--1.3.sql\
28-
pg_pathman--1.3--1.4.sql
28+
pg_pathman--1.3--1.4.sql\
29+
pg_pathman--1.4--1.5.sql
2930

3031
PGFILEDESC = "pg_pathman - partitioning tool for PostgreSQL"
3132

‎pg_pathman--1.4--1.5.sql

Lines changed: 15 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,3 @@
1-
/*
2-
* Drop triggers
3-
*/
4-
CREATEOR REPLACE FUNCTION @extschema@.drop_triggers(
5-
parent_relidREGCLASS)
6-
RETURNS VOIDAS $$
7-
DECLARE
8-
triggernameTEXT;
9-
relationOID;
10-
11-
BEGIN
12-
triggername := concat(parent_relid::text,'_upd_trig');
13-
14-
/* Drop trigger for each partition if exists*/
15-
FOR relationIN (SELECTpg_catalog.pg_inherits.inhrelid
16-
FROMpg_catalog.pg_inherits
17-
JOINpg_catalog.pg_triggerON inhrelid= tgrelid
18-
WHERE inhparent= parent_relidAND tgname= triggername)
19-
LOOP
20-
EXECUTE format('DROP TRIGGER IF EXISTS %s ON %s',
21-
triggername,
22-
relation::REGCLASS);
23-
END LOOP;
24-
25-
/* Drop trigger on parent*/
26-
IF EXISTS (SELECT*FROMpg_catalog.pg_trigger
27-
WHERE tgname= triggernameAND tgrelid= parent_relid)
28-
THEN
29-
EXECUTE format('DROP TRIGGER IF EXISTS %s ON %s',
30-
triggername,
31-
parent_relid::TEXT);
32-
END IF;
33-
END
34-
$$ LANGUAGE plpgsql STRICT;
35-
36-
DO $$
37-
DECLARE r record;
38-
BEGIN
39-
FOR rINSELECT parent_relidFROM @extschema@.pathman_config
40-
LOOP
41-
PERFORM @extschema@.drop_triggers(r.parent_relid);+
42-
END LOOP;
43-
END$$;
44-
451
/*
462
* Add new partition
473
*/
@@ -685,8 +641,7 @@ END
685641
$$ LANGUAGE plpgsql
686642
SETpg_pathman.enable_partitionfilter= off;/* ensures that PartitionFilter is OFF*/
687643

688-
-- deprecated
689-
CREATE OR REPLACEFUNCTIONpublic.get_pathman_lib_version()
644+
CREATE FUNCTION @extschema@.pathman_version()
690645
RETURNS CSTRINGAS'pg_pathman','pathman_version'
691646
LANGUAGE C STRICT;
692647

@@ -706,7 +661,8 @@ LANGUAGE sql STRICT;
706661
/*
707662
* Get partitioning key.
708663
*/
709-
CREATEOR REPLACE FUNCTION @extschema@.get_partition_key(
664+
DROPFUNCTION @extschema@.get_partition_key(REGCLASS);
665+
CREATE FUNCTION @extschema@.get_partition_key(
710666
parent_relidREGCLASS)
711667
RETURNSTEXTAS
712668
$$
@@ -719,14 +675,16 @@ LANGUAGE sql STRICT;
719675
/*
720676
* Get partitioning key type.
721677
*/
722-
CREATEOR REPLACE FUNCTION @extschema@.get_partition_key_type(
678+
DROPFUNCTION @extschema@.get_partition_key_type(REGCLASS);
679+
CREATE FUNCTION @extschema@.get_partition_key_type(
723680
parent_relidREGCLASS)
724681
RETURNS REGTYPEAS'pg_pathman','get_partition_key_type_pl'
725682
LANGUAGE C STRICT;
726683

727684
/*
728685
* Get partitioning type.
729686
*/
687+
DROPFUNCTION @extschema@.get_partition_type(REGCLASS);
730688
CREATEOR REPLACE FUNCTION @extschema@.get_partition_type(
731689
parent_relidREGCLASS)
732690
RETURNS INT4AS
@@ -798,7 +756,9 @@ $$ LANGUAGE plpgsql;
798756
/*
799757
* Show all existing concurrent partitioning tasks.
800758
*/
801-
CREATEOR REPLACE FUNCTION @extschema@.show_concurrent_part_tasks()
759+
DROPVIEW @extschema@.pathman_concurrent_part_tasks;
760+
DROPFUNCTION @extschema@.show_concurrent_part_tasks();
761+
CREATE FUNCTION @extschema@.show_concurrent_part_tasks()
802762
RETURNS TABLE (
803763
useridREGROLE,
804764
pidINT,
@@ -809,6 +769,10 @@ RETURNS TABLE (
809769
AS'pg_pathman','show_concurrent_part_tasks_internal'
810770
LANGUAGE C STRICT;
811771

772+
CREATE VIEW @extschema@.pathman_concurrent_part_tasks
773+
ASSELECT*FROM @extschema@.show_concurrent_part_tasks();
774+
GRANTSELECTON @extschema@.pathman_concurrent_part_tasks TO PUBLIC;
775+
812776
/*
813777
* Split RANGE partition in two using a pivot.
814778
*/
@@ -821,13 +785,11 @@ CREATE OR REPLACE FUNCTION @extschema@.split_range_partition(
821785
RETURNS REGCLASSAS'pg_pathman','split_range_partition'
822786
LANGUAGE C;
823787

824-
ALTERTABLEpublic.pathman_concurrent_part_tasks
825-
ALTER COLUMN processedSET TYPEbigint;
826-
827788
DROPFUNCTION @extschema@.build_update_trigger_func_name(regclass);
828789
DROPFUNCTION @extschema@.build_update_trigger_name(regclass);
829790
DROPFUNCTION @extschema@.create_single_update_trigger(regclass, regclass);
830791
DROPFUNCTION @extschema@.create_update_triggers(regclass);
831792
DROPFUNCTION @extschema@.drop_triggers(regclass);
832793
DROPFUNCTION @extschema@.has_update_trigger(regclass);
833-
DROPFUNCTION @extschema@.pathman_update_trigger_func();
794+
DROPFUNCTION @extschema@.pathman_update_trigger_func() CASCADE;
795+
DROPFUNCTION @extschema@.get_pathman_lib_version();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp