Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
1,2c1,3
< CREATE TYPE check_parent_table AS (parent_table text, count bigint);
< CREATE TABLE part_config (
---
> CREATE SCHEMA partman;
> CREATE TYPE partman.check_parent_table AS (parent_table text, count bigint);
> CREATE TABLE partman.part_config (
21,22c22,23
< CREATE INDEX part_config_type_idx ON @extschema@.part_config (type);
< SELECT pg_catalog.pg_extension_config_dump('part_config', '');
---
> CREATE INDEX part_config_type_idx ON partman.part_config (type);
> -- SELECT pg_catalog.pg_extension_config_dump('part_config', '');
26,27c27,28
< CREATE TABLE part_config_sub (
< sub_parent text PRIMARY KEY REFERENCES @extschema@.part_config (parent_table) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED
---
> CREATE TABLE partman.part_config_sub (
> sub_parent text PRIMARY KEY REFERENCES partman.part_config (parent_table) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED
47c48
< CREATE FUNCTION check_partition_type (p_type text) RETURNS boolean
---
> CREATE FUNCTION partman.check_partition_type (p_type text) RETURNS boolean
58c59
< ALTER TABLE @extschema@.part_config
---
> ALTER TABLE partman.part_config
60c61
< CHECK (@extschema@.check_partition_type(type));
---
> CHECK (partman.check_partition_type(type));
62c63
< ALTER TABLE @extschema@.part_config_sub
---
> ALTER TABLE partman.part_config_sub
64c65
< CHECK (@extschema@.check_partition_type(sub_type));
---
> CHECK (partman.check_partition_type(sub_type));
69c70
< CREATE FUNCTION check_subpart_sameconfig(text) RETURNS boolean
---
> CREATE FUNCTION partman.check_subpart_sameconfig(text) RETURNS boolean
98c99
< FROM @extschema@.part_config_sub a
---
> FROM partman.part_config_sub a
102c103
< ALTER TABLE @extschema@.part_config_sub
---
> ALTER TABLE partman.part_config_sub
104c105
< CHECK (check_subpart_sameconfig(sub_parent));
---
> CHECK (partman.check_subpart_sameconfig(sub_parent));
110c111
< CREATE FUNCTION apply_constraints(p_parent_table text, p_child_table text DEFAULT NULL, p_analyze boolean DEFAULT FALSE, p_debug boolean DEFAULT FALSE) RETURNS void
---
> CREATE FUNCTION partman.apply_constraints(p_parent_table text, p_child_table text DEFAULT NULL, p_analyze boolean DEFAULT FALSE, p_debug boolean DEFAULT FALSE) RETURNS void
155c156
< FROM @extschema@.part_config
---
> FROM partman.part_config
166c167
< SELECT show_partitions INTO v_last_partition FROM @extschema@.show_partitions(p_parent_table, 'DESC') LIMIT 1;
---
> SELECT show_partitions INTO v_last_partition FROM partman.show_partitions(p_parent_table, 'DESC') LIMIT 1;
172c173
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
199c200
< v_child_table := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, v_partition_suffix, TRUE);
---
> v_child_table := partman.check_name_length(v_parent_tablename, v_parent_schema, v_partition_suffix, TRUE);
255c256
< v_constraint_name := @extschema@.check_name_length('partmanconstr_'||v_child_tablename, p_suffix := '_'||v_col);
---
> v_constraint_name := partman.check_name_length('partmanconstr_'||v_child_tablename, p_suffix := '_'||v_col);
321c322
< CREATE FUNCTION apply_foreign_keys(p_parent_table text, p_child_table text DEFAULT NULL, p_debug boolean DEFAULT false) RETURNS void
---
> CREATE FUNCTION partman.apply_foreign_keys(p_parent_table text, p_child_table text DEFAULT NULL, p_debug boolean DEFAULT false) RETURNS void
340c341
< SELECT jobmon INTO v_jobmon FROM @extschema@.part_config WHERE parent_table = p_parent_table;
---
> SELECT jobmon INTO v_jobmon FROM partman.part_config WHERE parent_table = p_parent_table;
346c347
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
490c491
< CREATE FUNCTION check_name_length (p_object_name text, p_object_schema text DEFAULT NULL, p_suffix text DEFAULT NULL, p_table_partition boolean DEFAULT FALSE) RETURNS text
---
> CREATE FUNCTION partman.check_name_length (p_object_name text, p_object_schema text DEFAULT NULL, p_suffix text DEFAULT NULL, p_table_partition boolean DEFAULT FALSE) RETURNS text
526c527
< CREATE FUNCTION check_parent() RETURNS SETOF @extschema@.check_parent_table
---
> CREATE FUNCTION partman.check_parent() RETURNS SETOF partman.check_parent_table
534c535
< v_trouble @extschema@.check_parent_table%rowtype;
---
> v_trouble partman.check_parent_table%rowtype;
539c540
< SELECT DISTINCT parent_table FROM @extschema@.part_config
---
> SELECT DISTINCT parent_table FROM partman.part_config
563c564
< CREATE FUNCTION check_subpartition_limits(p_parent_table text, p_type text, OUT sub_min text, OUT sub_max text) RETURNS record
---
> CREATE FUNCTION partman.check_subpartition_limits(p_parent_table text, p_type text, OUT sub_min text, OUT sub_max text) RETURNS record
600c601
< JOIN @extschema@.part_config p ON p.parent_table = n.nspname||'.'||c.relname
---
> JOIN partman.part_config p ON p.parent_table = n.nspname||'.'||c.relname
625c626
< JOIN @extschema@.part_config p ON p.parent_table = n.nspname||'.'||c.relname
---
> JOIN partman.part_config p ON p.parent_table = n.nspname||'.'||c.relname
666c667
< CREATE FUNCTION check_version(p_check_version text) RETURNS boolean
---
> CREATE FUNCTION partman.check_version(p_check_version text) RETURNS boolean
699c700
< CREATE FUNCTION create_function_id(p_parent_table text) RETURNS void
---
> CREATE FUNCTION partman.create_function_id(p_parent_table text) RETURNS void
748c749
< FROM @extschema@.part_config
---
> FROM partman.part_config
756c757
< SELECT show_partitions INTO v_last_partition FROM @extschema@.show_partitions(p_parent_table, 'DESC') LIMIT 1;
---
> SELECT show_partitions INTO v_last_partition FROM partman.show_partitions(p_parent_table, 'DESC') LIMIT 1;
762c763
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
772c773
< v_function_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
---
> v_function_name := partman.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
788c789
< JOIN @extschema@.part_config p ON p.parent_table = n.nspname||'.'||c.relname
---
> JOIN partman.part_config p ON p.parent_table = n.nspname||'.'||c.relname
801c802
< SELECT show_partitions FROM @extschema@.show_partitions(v_top_parent, 'DESC')
---
> SELECT show_partitions FROM partman.show_partitions(v_top_parent, 'DESC')
813c814
< v_current_partition_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, v_current_partition_id::text, TRUE);
---
> v_current_partition_name := partman.check_name_length(v_parent_tablename, v_parent_schema, v_current_partition_id::text, TRUE);
840,841c841,842
< v_prev_partition_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, v_prev_partition_id::text, TRUE);
< v_next_partition_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, v_next_partition_id::text, TRUE);
---
> v_prev_partition_name := partman.check_name_length(v_parent_tablename, v_parent_schema, v_prev_partition_id::text, TRUE);
> v_next_partition_name := partman.check_name_length(v_parent_tablename, v_parent_schema, v_next_partition_id::text, TRUE);
874c875
< v_partition_created := @extschema@.create_partition_id('||quote_literal(p_parent_table)||', ARRAY[v_next_partition_id]);
---
> v_partition_created := partman.create_partition_id('||quote_literal(p_parent_table)||', ARRAY[v_next_partition_id]);
876,877c877,878
< PERFORM @extschema@.create_function_id('||quote_literal(p_parent_table)||');
< PERFORM @extschema@.apply_constraints('||quote_literal(p_parent_table)||');
---
> PERFORM partman.create_function_id('||quote_literal(p_parent_table)||');
> PERFORM partman.apply_constraints('||quote_literal(p_parent_table)||');
910c911
< v_current_partition_name := @extschema@.check_name_length('''||v_parent_tablename||''', '''||v_parent_schema||''', v_current_partition_id::text, TRUE);
---
> v_current_partition_name := partman.check_name_length('''||v_parent_tablename||''', '''||v_parent_schema||''', v_current_partition_id::text, TRUE);
928c929
< v_partition_created := @extschema@.create_partition_id('||quote_literal(p_parent_table)||', ARRAY[v_next_partition_id]);
---
> v_partition_created := partman.create_partition_id('||quote_literal(p_parent_table)||', ARRAY[v_next_partition_id]);
930,931c931,932
< PERFORM @extschema@.create_function_id('||quote_literal(p_parent_table)||');
< PERFORM @extschema@.apply_constraints('||quote_literal(p_parent_table)||');
---
> PERFORM partman.create_function_id('||quote_literal(p_parent_table)||');
> PERFORM partman.apply_constraints('||quote_literal(p_parent_table)||');
978c979
< CREATE FUNCTION create_function_time(p_parent_table text) RETURNS void
---
> CREATE FUNCTION partman.create_function_time(p_parent_table text) RETURNS void
1021c1022
< FROM @extschema@.part_config
---
> FROM partman.part_config
1033c1034
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
1044c1045
< v_function_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
---
> v_function_name := partman.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
1069c1070
< v_current_partition_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, to_char(v_current_partition_timestamp, v_datetime_string), TRUE);
---
> v_current_partition_name := partman.check_name_length(v_parent_tablename, v_parent_schema, to_char(v_current_partition_timestamp, v_datetime_string), TRUE);
1089,1090c1090,1091
< v_prev_partition_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, to_char(v_prev_partition_timestamp, v_datetime_string), TRUE);
< v_next_partition_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, to_char(v_next_partition_timestamp, v_datetime_string), TRUE);
---
> v_prev_partition_name := partman.check_name_length(v_parent_tablename, v_parent_schema, to_char(v_prev_partition_timestamp, v_datetime_string), TRUE);
> v_next_partition_name := partman.check_name_length(v_parent_tablename, v_parent_schema, to_char(v_next_partition_timestamp, v_datetime_string), TRUE);
1156c1157
< v_partition_name := @extschema@.check_name_length('''||v_parent_tablename||''', '''||v_parent_schema||''', to_char(v_partition_timestamp, '||quote_literal(v_datetime_string)||'), TRUE);
---
> v_partition_name := partman.check_name_length('''||v_parent_tablename||''', '''||v_parent_schema||''', to_char(v_partition_timestamp, '||quote_literal(v_datetime_string)||'), TRUE);
1183c1184
< FROM @extschema@.custom_time_partitions
---
> FROM partman.custom_time_partitions
1231c1232
< CREATE FUNCTION create_parent(
---
> CREATE FUNCTION partman.create_parent(
1296c1297
< IF NOT @extschema@.check_partition_type(p_type) THEN
---
> IF NOT partman.check_partition_type(p_type) THEN
1300c1301
< IF p_type = 'time-custom' AND @extschema@.check_version('9.2.0') IS FALSE THEN
---
> IF p_type = 'time-custom' AND partman.check_version('9.2.0') IS FALSE THEN
1310c1311
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
1356c1357
< FROM @extschema@.part_config_sub a
---
> FROM partman.part_config_sub a
1359c1360
< INSERT INTO @extschema@.part_config_sub (
---
> INSERT INTO partman.part_config_sub (
1482c1483
< INSERT INTO @extschema@.part_config (
---
> INSERT INTO partman.part_config (
1504c1505
< v_last_partition_created := @extschema@.create_partition_time(p_parent_table, v_partition_time_array, false);
---
> v_last_partition_created := partman.create_partition_time(p_parent_table, v_partition_time_array, false);
1520c1521
< JOIN @extschema@.part_config p ON p.parent_table = n.nspname||'.'||c.relname;
---
> JOIN partman.part_config p ON p.parent_table = n.nspname||'.'||c.relname;
1538c1539
< v_last_partition_created := @extschema@.create_partition_time(p_parent_table, v_partition_time_array, false);
---
> v_last_partition_created := partman.create_partition_time(p_parent_table, v_partition_time_array, false);
1569c1570
< JOIN @extschema@.part_config p ON p.parent_table = n.nspname||'.'||c.relname
---
> JOIN partman.part_config p ON p.parent_table = n.nspname||'.'||c.relname
1594c1595
< INSERT INTO @extschema@.part_config (
---
> INSERT INTO partman.part_config (
1614c1615
< v_last_partition_created := @extschema@.create_partition_id(p_parent_table, v_partition_id_array, false);
---
> v_last_partition_created := partman.create_partition_id(p_parent_table, v_partition_id_array, false);
1629c1630
< JOIN @extschema@.part_config p ON p.parent_table = n.nspname||'.'||c.relname
---
> JOIN partman.part_config p ON p.parent_table = n.nspname||'.'||c.relname
1648c1649
< v_last_partition_created := @extschema@.create_partition_id(p_parent_table, v_partition_id_array, false);
---
> v_last_partition_created := partman.create_partition_id(p_parent_table, v_partition_id_array, false);
1660c1661
< PERFORM @extschema@.create_function_time(p_parent_table);
---
> PERFORM partman.create_function_time(p_parent_table);
1665c1666
< PERFORM @extschema@.create_function_id(p_parent_table);
---
> PERFORM partman.create_function_id(p_parent_table);
1674c1675
< PERFORM @extschema@.create_trigger(p_parent_table);
---
> PERFORM partman.create_trigger(p_parent_table);
1710c1711
< CREATE FUNCTION create_partition_id(p_parent_table text, p_partition_ids bigint[], p_analyze boolean DEFAULT true) RETURNS boolean
---
> CREATE FUNCTION partman.create_partition_id(p_parent_table text, p_partition_ids bigint[], p_analyze boolean DEFAULT true) RETURNS boolean
1753c1754
< FROM @extschema@.part_config
---
> FROM partman.part_config
1765c1766
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
1770c1771
< SELECT sub_min::bigint, sub_max::bigint INTO v_sub_id_min, v_sub_id_max FROM @extschema@.check_subpartition_limits(p_parent_table, 'id');
---
> SELECT sub_min::bigint, sub_max::bigint INTO v_sub_id_min, v_sub_id_max FROM partman.check_subpartition_limits(p_parent_table, 'id');
1786c1787
< v_partition_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, v_id::text, TRUE);
---
> v_partition_name := partman.check_name_length(v_parent_tablename, v_parent_schema, v_id::text, TRUE);
1846c1847
< PERFORM @extschema@.apply_foreign_keys(quote_ident(v_parent_schema)||'.'||quote_ident(v_parent_tablename), v_partition_name);
---
> PERFORM partman.apply_foreign_keys(quote_ident(v_parent_schema)||'.'||quote_ident(v_parent_tablename), v_partition_name);
1869c1870
< FROM @extschema@.part_config_sub
---
> FROM partman.part_config_sub
1875c1876
< v_sql := format('SELECT @extschema@.create_parent(
---
> v_sql := format('SELECT partman.create_parent(
1896c1897
< UPDATE @extschema@.part_config SET
---
> UPDATE partman.part_config SET
1960c1961
< CREATE FUNCTION create_partition_time (p_parent_table text, p_partition_times timestamp[], p_analyze boolean DEFAULT true)
---
> CREATE FUNCTION partman.create_partition_time (p_parent_table text, p_partition_times timestamp[], p_analyze boolean DEFAULT true)
2015c2016
< FROM @extschema@.part_config
---
> FROM partman.part_config
2027c2028
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
2032c2033
< SELECT sub_min::timestamp, sub_max::timestamp INTO v_sub_timestamp_min, v_sub_timestamp_max FROM @extschema@.check_subpartition_limits(p_parent_table, 'time');
---
> SELECT sub_min::timestamp, sub_max::timestamp INTO v_sub_timestamp_min, v_sub_timestamp_max FROM partman.check_subpartition_limits(p_parent_table, 'time');
2085c2086
< v_partition_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, v_partition_suffix, TRUE);
---
> v_partition_name := partman.check_name_length(v_parent_tablename, v_parent_schema, v_partition_suffix, TRUE);
2119c2120
< INSERT INTO @extschema@.custom_time_partitions (parent_table, child_table, partition_range)
---
> INSERT INTO partman.custom_time_partitions (parent_table, child_table, partition_range)
2150c2151
< PERFORM @extschema@.apply_foreign_keys(quote_ident(v_parent_schema)||'.'||quote_ident(v_parent_tablename), v_partition_name);
---
> PERFORM partman.apply_foreign_keys(quote_ident(v_parent_schema)||'.'||quote_ident(v_parent_tablename), v_partition_name);
2173c2174
< FROM @extschema@.part_config_sub
---
> FROM partman.part_config_sub
2179c2180
< v_sql := format('SELECT @extschema@.create_parent(
---
> v_sql := format('SELECT partman.create_parent(
2200c2201
< UPDATE @extschema@.part_config SET
---
> UPDATE partman.part_config SET
2270c2271
< CREATE FUNCTION create_sub_parent(
---
> CREATE FUNCTION partman.create_sub_parent(
2296c2297
< SELECT use_run_maintenance INTO v_run_maint FROM @extschema@.part_config WHERE parent_table = p_top_parent;
---
> SELECT use_run_maintenance INTO v_run_maint FROM partman.part_config WHERE parent_table = p_top_parent;
2298c2299
< RAISE EXCEPTION 'Cannot subpartition a table that is not managed by pg_partman already. Given top parent table not found in @extschema@.part_config: %', p_top_parent;
---
> RAISE EXCEPTION 'Cannot subpartition a table that is not managed by pg_partman already. Given top parent table not found in partman.part_config: %', p_top_parent;
2305c2306
< SELECT show_partitions AS child_table FROM @extschema@.show_partitions(p_top_parent)
---
> SELECT show_partitions AS child_table FROM partman.show_partitions(p_top_parent)
2308c2309
< v_sql := format('SELECT @extschema@.create_parent(
---
> v_sql := format('SELECT partman.create_parent(
2335c2336
< INSERT INTO @extschema@.part_config_sub (
---
> INSERT INTO partman.part_config_sub (
2364c2365
< CREATE FUNCTION create_trigger(p_parent_table text) RETURNS void
---
> CREATE FUNCTION partman.create_trigger(p_parent_table text) RETURNS void
2379c2380
< v_trig_name := @extschema@.check_name_length(p_object_name := v_parent_tablename, p_suffix := '_part_trig');
---
> v_trig_name := partman.check_name_length(p_object_name := v_parent_tablename, p_suffix := '_part_trig');
2381c2382
< v_function_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
---
> v_function_name := partman.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
2392c2393
< CREATE FUNCTION drop_constraints(p_parent_table text, p_child_table text, p_debug boolean DEFAULT false) RETURNS void
---
> CREATE FUNCTION partman.drop_constraints(p_parent_table text, p_child_table text, p_debug boolean DEFAULT false) RETURNS void
2414c2415
< FROM @extschema@.part_config
---
> FROM partman.part_config
2425c2426
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
2497c2498
< CREATE FUNCTION drop_partition_id(p_parent_table text, p_retention bigint DEFAULT NULL, p_keep_table boolean DEFAULT NULL, p_keep_index boolean DEFAULT NULL, p_retention_schema text DEFAULT NULL) RETURNS int
---
> CREATE FUNCTION partman.drop_partition_id(p_parent_table text, p_retention bigint DEFAULT NULL, p_keep_table boolean DEFAULT NULL, p_keep_index boolean DEFAULT NULL, p_retention_schema text DEFAULT NULL) RETURNS int
2548c2549
< FROM @extschema@.part_config
---
> FROM partman.part_config
2571c2572
< FROM @extschema@.part_config
---
> FROM partman.part_config
2585c2586
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
2606c2607
< SELECT show_partitions FROM @extschema@.show_partitions(p_parent_table, 'DESC')
---
> SELECT show_partitions FROM partman.show_partitions(p_parent_table, 'DESC')
2673c2674
< DELETE FROM @extschema@.part_config WHERE parent_table = v_child_table;
---
> DELETE FROM partman.part_config WHERE parent_table = v_child_table;
2709c2710
< CREATE FUNCTION drop_partition_time(p_parent_table text, p_retention interval DEFAULT NULL, p_keep_table boolean DEFAULT NULL, p_keep_index boolean DEFAULT NULL, p_retention_schema text DEFAULT NULL) RETURNS int
---
> CREATE FUNCTION partman.drop_partition_time(p_parent_table text, p_retention interval DEFAULT NULL, p_keep_table boolean DEFAULT NULL, p_keep_index boolean DEFAULT NULL, p_retention_schema text DEFAULT NULL) RETURNS int
2763c2764
< FROM @extschema@.part_config
---
> FROM partman.part_config
2788c2789
< FROM @extschema@.part_config
---
> FROM partman.part_config
2802c2803
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
2850c2851
< DELETE FROM @extschema@.custom_time_partitions WHERE parent_table = p_parent_table AND child_table = v_child_table;
---
> DELETE FROM partman.custom_time_partitions WHERE parent_table = p_parent_table AND child_table = v_child_table;
2899c2900
< DELETE FROM @extschema@.part_config WHERE parent_table = v_child_table;
---
> DELETE FROM partman.part_config WHERE parent_table = v_child_table;
2935c2936
< CREATE FUNCTION partition_data_id(p_parent_table text, p_batch_count int DEFAULT 1, p_batch_interval int DEFAULT NULL, p_lock_wait numeric DEFAULT 0, p_order text DEFAULT 'ASC') RETURNS bigint
---
> CREATE FUNCTION partman.partition_data_id(p_parent_table text, p_batch_count int DEFAULT 1, p_batch_interval int DEFAULT NULL, p_lock_wait numeric DEFAULT 0, p_order text DEFAULT 'ASC') RETURNS bigint
2964c2965
< FROM @extschema@.part_config
---
> FROM partman.part_config
3032c3033
< PERFORM @extschema@.create_partition_id(p_parent_table, v_partition_id);
---
> PERFORM partman.create_partition_id(p_parent_table, v_partition_id);
3034c3035
< v_current_partition_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, v_min_partition_id::text, TRUE);
---
> v_current_partition_name := partman.check_name_length(v_parent_tablename, v_parent_schema, v_min_partition_id::text, TRUE);
3050c3051
< PERFORM @extschema@.create_function_id(p_parent_table);
---
> PERFORM partman.create_function_id(p_parent_table);
3061c3062
< CREATE FUNCTION partition_data_time(p_parent_table text, p_batch_count int DEFAULT 1, p_batch_interval interval DEFAULT NULL, p_lock_wait numeric DEFAULT 0, p_order text DEFAULT 'ASC') RETURNS bigint
---
> CREATE FUNCTION partman.partition_data_time(p_parent_table text, p_batch_count int DEFAULT 1, p_batch_interval interval DEFAULT NULL, p_lock_wait numeric DEFAULT 0, p_order text DEFAULT 'ASC') RETURNS bigint
3098c3099
< FROM @extschema@.part_config
---
> FROM partman.part_config
3109c3110
< SELECT show_partitions INTO v_last_partition FROM @extschema@.show_partitions(p_parent_table, 'DESC') LIMIT 1;
---
> SELECT show_partitions INTO v_last_partition FROM partman.show_partitions(p_parent_table, 'DESC') LIMIT 1;
3209c3210
< PERFORM @extschema@.create_partition_time(p_parent_table, v_partition_timestamp);
---
> PERFORM partman.create_partition_time(p_parent_table, v_partition_timestamp);
3235c3236
< v_current_partition_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, v_partition_suffix, TRUE);
---
> v_current_partition_name := partman.check_name_length(v_parent_tablename, v_parent_schema, v_partition_suffix, TRUE);
3251c3252
< PERFORM @extschema@.create_function_time(p_parent_table);
---
> PERFORM partman.create_function_time(p_parent_table);
3262c3263
< CREATE FUNCTION reapply_privileges(p_parent_table text) RETURNS void
---
> CREATE FUNCTION partman.reapply_privileges(p_parent_table text) RETURNS void
3287c3288
< SELECT jobmon INTO v_jobmon FROM @extschema@.part_config WHERE parent_table = p_parent_table;
---
> SELECT jobmon INTO v_jobmon FROM partman.part_config WHERE parent_table = p_parent_table;
3296c3297
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
3396c3397
< CREATE FUNCTION run_maintenance(p_parent_table text DEFAULT NULL, p_analyze boolean DEFAULT true, p_jobmon boolean DEFAULT true) RETURNS void
---
> CREATE FUNCTION partman.run_maintenance(p_parent_table text DEFAULT NULL, p_analyze boolean DEFAULT true, p_jobmon boolean DEFAULT true) RETURNS void
3449c3450
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
3465c3466
< FROM @extschema@.part_config';
---
> FROM partman.part_config';
3478c3479
< SELECT show_partitions INTO v_last_partition FROM @extschema@.show_partitions(v_row.parent_table, 'DESC') LIMIT 1;
---
> SELECT show_partitions INTO v_last_partition FROM partman.show_partitions(v_row.parent_table, 'DESC') LIMIT 1;
3504c3505
< SELECT child_table INTO v_current_partition FROM @extschema@.custom_time_partitions
---
> SELECT child_table INTO v_current_partition FROM partman.custom_time_partitions
3515c3516
< SELECT sub_min::timestamp, sub_max::timestamp INTO v_sub_timestamp_min, v_sub_timestamp_max FROM @extschema@.check_subpartition_limits(p_parent_table, 'time');
---
> SELECT sub_min::timestamp, sub_max::timestamp INTO v_sub_timestamp_min, v_sub_timestamp_max FROM partman.check_subpartition_limits(p_parent_table, 'time');
3559c3560
< v_last_partition_created := @extschema@.create_partition_time(v_row.parent_table, ARRAY[v_next_partition_timestamp], p_analyze);
---
> v_last_partition_created := partman.create_partition_time(v_row.parent_table, ARRAY[v_next_partition_timestamp], p_analyze);
3562c3563
< PERFORM @extschema@.create_function_time(v_row.parent_table);
---
> PERFORM partman.create_function_time(v_row.parent_table);
3566c3567
< PERFORM @extschema@.apply_constraints(v_row.parent_table);
---
> PERFORM partman.apply_constraints(v_row.parent_table);
3575c3576
< SELECT show_partitions FROM @extschema@.show_partitions(v_row.parent_table, 'DESC')
---
> SELECT show_partitions FROM partman.show_partitions(v_row.parent_table, 'DESC')
3586c3587
< SELECT sub_min::bigint, sub_max::bigint INTO v_sub_id_min, v_sub_id_max FROM @extschema@.check_subpartition_limits(p_parent_table, 'id');
---
> SELECT sub_min::bigint, sub_max::bigint INTO v_sub_id_min, v_sub_id_max FROM partman.check_subpartition_limits(p_parent_table, 'id');
3599c3600
< v_last_partition_created := @extschema@.create_partition_id(v_row.parent_table, ARRAY[v_next_partition_id], p_analyze);
---
> v_last_partition_created := partman.create_partition_id(v_row.parent_table, ARRAY[v_next_partition_id], p_analyze);
3601,3602c3602,3603
< PERFORM @extschema@.create_function_id(v_row.parent_table);
< PERFORM @extschema@.apply_constraints(v_row.parent_table);
---
> PERFORM partman.create_function_id(v_row.parent_table);
> PERFORM partman.apply_constraints(v_row.parent_table);
3613c3614
< SELECT parent_table FROM @extschema@.part_config WHERE retention IS NOT NULL AND undo_in_progress = false AND
---
> SELECT parent_table FROM partman.part_config WHERE retention IS NOT NULL AND undo_in_progress = false AND
3617c3618
< v_drop_count := v_drop_count + @extschema@.drop_partition_time(v_row.parent_table);
---
> v_drop_count := v_drop_count + partman.drop_partition_time(v_row.parent_table);
3622c3623
< v_drop_count := v_drop_count + @extschema@.drop_partition_time(v_row.parent_table);
---
> v_drop_count := v_drop_count + partman.drop_partition_time(v_row.parent_table);
3627c3628
< SELECT parent_table FROM @extschema@.part_config WHERE retention IS NOT NULL AND undo_in_progress = false AND (type = 'id-static' OR type = 'id-dynamic')
---
> SELECT parent_table FROM partman.part_config WHERE retention IS NOT NULL AND undo_in_progress = false AND (type = 'id-static' OR type = 'id-dynamic')
3630c3631
< v_drop_count := v_drop_count + @extschema@.drop_partition_id(v_row.parent_table);
---
> v_drop_count := v_drop_count + partman.drop_partition_id(v_row.parent_table);
3635c3636
< v_drop_count := v_drop_count + @extschema@.drop_partition_id(v_row.parent_table);
---
> v_drop_count := v_drop_count + partman.drop_partition_id(v_row.parent_table);
3669c3670
< CREATE FUNCTION show_partitions (p_parent_table text, p_order text DEFAULT 'ASC') RETURNS SETOF text
---
> CREATE FUNCTION partman.show_partitions (p_parent_table text, p_order text DEFAULT 'ASC') RETURNS SETOF text
3690c3691
< FROM @extschema@.part_config
---
> FROM partman.part_config
3723c3724
< CREATE FUNCTION undo_partition(p_parent_table text, p_batch_count int DEFAULT 1, p_keep_table boolean DEFAULT true, p_jobmon boolean DEFAULT true, p_lock_wait numeric DEFAULT 0) RETURNS bigint
---
> CREATE FUNCTION partman.undo_partition(p_parent_table text, p_batch_count int DEFAULT 1, p_keep_table boolean DEFAULT true, p_jobmon boolean DEFAULT true, p_lock_wait numeric DEFAULT 0) RETURNS bigint
3760c3761
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
3770c3771
< UPDATE @extschema@.part_config SET undo_in_progress = true WHERE parent_table = p_parent_table;
---
> UPDATE partman.part_config SET undo_in_progress = true WHERE parent_table = p_parent_table;
3773,3774c3774,3775
< v_trig_name := @extschema@.check_name_length(p_object_name := v_parent_tablename, p_suffix := '_part_trig');
< v_function_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
---
> v_trig_name := partman.check_name_length(p_object_name := v_parent_tablename, p_suffix := '_part_trig');
> v_function_name := partman.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
3906c3907
< DELETE FROM @extschema@.part_config WHERE parent_table = p_parent_table;
---
> DELETE FROM partman.part_config WHERE parent_table = p_parent_table;
3946c3947
< CREATE FUNCTION undo_partition_id(p_parent_table text, p_batch_count int DEFAULT 1, p_batch_interval bigint DEFAULT NULL, p_keep_table boolean DEFAULT true, p_lock_wait numeric DEFAULT 0) RETURNS bigint
---
> CREATE FUNCTION partman.undo_partition_id(p_parent_table text, p_batch_count int DEFAULT 1, p_batch_interval bigint DEFAULT NULL, p_keep_table boolean DEFAULT true, p_lock_wait numeric DEFAULT 0) RETURNS bigint
3992c3993
< FROM @extschema@.part_config
---
> FROM partman.part_config
4004c4005
< SELECT show_partitions AS child_table FROM @extschema@.show_partitions(p_parent_table)
---
> SELECT show_partitions AS child_table FROM partman.show_partitions(p_parent_table)
4018c4019
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
4032c4033
< UPDATE @extschema@.part_config SET undo_in_progress = true WHERE parent_table = p_parent_table;
---
> UPDATE partman.part_config SET undo_in_progress = true WHERE parent_table = p_parent_table;
4035,4036c4036,4037
< v_trig_name := @extschema@.check_name_length(p_object_name := v_parent_tablename, p_suffix := '_part_trig');
< v_function_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
---
> v_trig_name := partman.check_name_length(p_object_name := v_parent_tablename, p_suffix := '_part_trig');
> v_function_name := partman.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
4172c4173
< DELETE FROM @extschema@.part_config WHERE parent_table = p_parent_table;
---
> DELETE FROM partman.part_config WHERE parent_table = p_parent_table;
4212c4213
< CREATE FUNCTION undo_partition_time(p_parent_table text, p_batch_count int DEFAULT 1, p_batch_interval interval DEFAULT NULL, p_keep_table boolean DEFAULT true, p_lock_wait numeric DEFAULT 0) RETURNS bigint
---
> CREATE FUNCTION partman.undo_partition_time(p_parent_table text, p_batch_count int DEFAULT 1, p_batch_interval interval DEFAULT NULL, p_keep_table boolean DEFAULT true, p_lock_wait numeric DEFAULT 0) RETURNS bigint
4260c4261
< FROM @extschema@.part_config
---
> FROM partman.part_config
4272c4273
< SELECT show_partitions AS child_table FROM @extschema@.show_partitions(p_parent_table)
---
> SELECT show_partitions AS child_table FROM partman.show_partitions(p_parent_table)
4286c4287
< EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||''',''false'')';
---
> EXECUTE 'SELECT set_config(''search_path'',''partman,'||v_jobmon_schema||''',''false'')';
4300c4301
< UPDATE @extschema@.part_config SET undo_in_progress = true WHERE parent_table = p_parent_table;
---
> UPDATE partman.part_config SET undo_in_progress = true WHERE parent_table = p_parent_table;
4303,4304c4304,4305
< v_trig_name := @extschema@.check_name_length(p_object_name := v_parent_tablename, p_suffix := '_part_trig');
< v_function_name := @extschema@.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
---
> v_trig_name := partman.check_name_length(p_object_name := v_parent_tablename, p_suffix := '_part_trig');
> v_function_name := partman.check_name_length(v_parent_tablename, v_parent_schema, '_part_trig_func', FALSE);
4391c4392
< DELETE FROM @extschema@.custom_time_partitions WHERE parent_table = p_parent_table AND child_table = v_child_table;
---
> DELETE FROM partman.custom_time_partitions WHERE parent_table = p_parent_table AND child_table = v_child_table;
4443c4444
< DELETE FROM @extschema@.part_config WHERE parent_table = p_parent_table;
---
> DELETE FROM partman.part_config WHERE parent_table = p_parent_table;
4479c4480
< CREATE TABLE custom_time_partitions (
---
> CREATE TABLE partman.custom_time_partitions (
4484c4485
< CREATE INDEX custom_time_partitions_partition_range_idx ON custom_time_partitions USING gist (partition_range);
---
> CREATE INDEX custom_time_partitions_partition_range_idx ON partman.custom_time_partitions USING gist (partition_range);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.