@@ -77,9 +77,6 @@ SELECT pg_catalog.pg_extension_config_dump('@extschema@.pathman_config', '');
7777SELECT pg_catalog .pg_extension_config_dump (' @extschema@.pathman_config_params' , ' ' );
7878
7979
80- CREATE OR REPLACE FUNCTION @extschema@.invalidate_relcache(relid OID )
81- RETURNS VOID AS ' pg_pathman' LANGUAGE C STRICT;
82-
8380CREATE OR REPLACE FUNCTION @extschema@.partitions_count(relation REGCLASS)
8481RETURNS INT AS
8582$$
150147$$
151148LANGUAGE plpgsql;
152149
150+ /*
151+ * Show all existing parents and partitions.
152+ */
153+ CREATE OR REPLACE FUNCTION @extschema@.show_partition_list()
154+ RETURNS TABLE (
155+ parent REGCLASS,
156+ partition REGCLASS,
157+ parttype INT4,
158+ partattr TEXT ,
159+ range_min TEXT ,
160+ range_max TEXT )
161+ AS ' pg_pathman' , ' show_partition_list_internal' LANGUAGE C STRICT;
162+
163+ /*
164+ * View for show_partition_list().
165+ */
166+ CREATE OR REPLACE VIEW @extschema@.pathman_partition_list
167+ AS SELECT * FROM @extschema@.show_partition_list();
168+
153169/*
154170 * Show all existing concurrent partitioning tasks.
155171 */
@@ -160,8 +176,8 @@ RETURNS TABLE (
160176 dbid OID ,
161177 relid REGCLASS,
162178 processed INT ,
163- status TEXT
164- ) AS ' pg_pathman' , ' show_concurrent_part_tasks_internal' LANGUAGE C STRICT;
179+ status TEXT )
180+ AS ' pg_pathman' , ' show_concurrent_part_tasks_internal' LANGUAGE C STRICT;
165181
166182/*
167183 * View for show_concurrent_part_tasks().
348364LANGUAGE plpgsql;
349365
350366/*
351- * Returns relname without quotes or something
367+ * Returns relname without quotes or something.
352368 */
353369CREATE OR REPLACE FUNCTION @extschema@.get_plain_schema_and_relname(
354370 cls REGCLASS,
366382LANGUAGE plpgsql STRICT;
367383
368384/*
369- * Returns schema-qualified name for table
385+ * Returns the schema-qualified name of table.
370386 */
371387CREATE OR REPLACE FUNCTION @extschema@.get_schema_qualified_name(
372388 cls REGCLASS,
385401LANGUAGE plpgsql STRICT;
386402
387403/*
388- * Validates relation name. It must be schema qualified
404+ * Validates relation name. It must be schema qualified.
389405 */
390406CREATE OR REPLACE FUNCTION @extschema@.validate_relname(
391407 cls REGCLASS)
407423LANGUAGE plpgsql;
408424
409425/*
410- * Check if two relations have equal structures
426+ * Check if two relations have equal structures.
411427 */
412428CREATE OR REPLACE FUNCTION @extschema@.validate_relations_equality(
413429 relation1 OID , relation2 OID )
439455LANGUAGE plpgsql;
440456
441457/*
442- * DDL trigger that deletes entry from pathman_config table
458+ * DDL trigger that deletes entry from pathman_config table.
443459 */
444460CREATE OR REPLACE FUNCTION @extschema@.pathman_ddl_trigger_func()
445461RETURNS event_trigger AS
472488LANGUAGE plpgsql;
473489
474490/*
475- * Drop trigger
491+ * Drop triggers.
476492 */
477493CREATE OR REPLACE FUNCTION @extschema@.drop_triggers(
478494 parent_relid REGCLASS)
485501$$ LANGUAGE plpgsql STRICT;
486502
487503/*
488- * Drop partitions
489- * If delete_data set to TRUE then partitions will be dropped with all the data
504+ * Drop partitions. If delete_data set to TRUE, partitions
505+ * will be dropped with all the data.
490506 */
491507CREATE OR REPLACE FUNCTION @extschema@.drop_partitions(
492508 parent_relid REGCLASS,
@@ -578,16 +594,6 @@ ON sql_drop
578594EXECUTE PROCEDURE @extschema@.pathman_ddl_trigger_func();
579595
580596
581- /*
582- * Attach a previously partitioned table
583- */
584- CREATE OR REPLACE FUNCTION @extschema@.add_to_pathman_config(
585- parent_relid REGCLASS,
586- attname TEXT ,
587- range_interval TEXT DEFAULT NULL )
588- RETURNS BOOLEAN AS ' pg_pathman' , ' add_to_pathman_config'
589- LANGUAGE C;
590-
591597
592598CREATE OR REPLACE FUNCTION @extschema@.on_create_partitions(
593599 relid REGCLASS)
@@ -619,40 +625,41 @@ CREATE OR REPLACE FUNCTION @extschema@.get_base_type(REGTYPE)
619625RETURNS REGTYPE AS ' pg_pathman' , ' get_base_type_pl'
620626LANGUAGE C STRICT;
621627
622-
623628/*
624- * Checks if attribute is nullable
629+ * Returns attribute type name for relation.
625630 */
626- CREATE OR REPLACE FUNCTION @extschema@.is_attribute_nullable (
631+ CREATE OR REPLACE FUNCTION @extschema@.get_attribute_type (
627632 REGCLASS, TEXT )
628- RETURNS BOOLEAN AS ' pg_pathman' , ' is_attribute_nullable '
633+ RETURNS REGTYPE AS ' pg_pathman' , ' get_attribute_type_pl '
629634LANGUAGE C STRICT;
630635
631636/*
632- * Check if regclass is date or timestamp
637+ * Return tablespace name for specified relation.
633638 */
634- CREATE OR REPLACE FUNCTION @extschema@.is_date_type(
635- typid REGTYPE)
636- RETURNS BOOLEAN AS ' pg_pathman' , ' is_date_type'
639+ CREATE OR REPLACE FUNCTION @extschema@.get_rel_tablespace_name(relation REGCLASS)
640+ RETURNS TEXT AS ' pg_pathman' , ' get_rel_tablespace_name'
637641LANGUAGE C STRICT;
638642
643+
639644/*
640- * Returns attribute type name for relation
645+ * Checks if attribute is nullable
641646 */
642- CREATE OR REPLACE FUNCTION @extschema@.get_attribute_type (
647+ CREATE OR REPLACE FUNCTION @extschema@.is_attribute_nullable (
643648 REGCLASS, TEXT )
644- RETURNS REGTYPE AS ' pg_pathman' , ' get_attribute_type_pl '
649+ RETURNS BOOLEAN AS ' pg_pathman' , ' is_attribute_nullable '
645650LANGUAGE C STRICT;
646651
647652/*
648- * Get parent of pg_pathman's partition .
653+ * Check if regclass is date or timestamp .
649654 */
650- CREATE OR REPLACE FUNCTION @extschema@.get_parent_of_partition(REGCLASS)
651- RETURNS REGCLASS AS ' pg_pathman' , ' get_parent_of_partition_pl'
655+ CREATE OR REPLACE FUNCTION @extschema@.is_date_type(
656+ typid REGTYPE)
657+ RETURNS BOOLEAN AS ' pg_pathman' , ' is_date_type'
652658LANGUAGE C STRICT;
653659
660+
654661/*
655- * Build check constraint name for a specified relation's column
662+ * Build check constraint name for a specified relation's column.
656663 */
657664CREATE OR REPLACE FUNCTION @extschema@.build_check_constraint_name(
658665 REGCLASS, INT2)
@@ -679,7 +686,22 @@ LANGUAGE C STRICT;
679686
680687
681688/*
682- * Lock partitioned relation to restrict concurrent modification of partitioning scheme.
689+ * Attach a previously partitioned table.
690+ */
691+ CREATE OR REPLACE FUNCTION @extschema@.add_to_pathman_config(
692+ parent_relid REGCLASS,
693+ attname TEXT ,
694+ range_interval TEXT DEFAULT NULL )
695+ RETURNS BOOLEAN AS ' pg_pathman' , ' add_to_pathman_config'
696+ LANGUAGE C;
697+
698+ CREATE OR REPLACE FUNCTION @extschema@.invalidate_relcache(relid OID )
699+ RETURNS VOID AS ' pg_pathman' LANGUAGE C STRICT;
700+
701+
702+ /*
703+ * Lock partitioned relation to restrict concurrent
704+ * modification of partitioning scheme.
683705 */
684706 CREATE OR REPLACE FUNCTION @extschema@.lock_partitioned_relation(
685707 REGCLASS)
@@ -702,18 +724,12 @@ CREATE OR REPLACE FUNCTION @extschema@.debug_capture()
702724RETURNS VOID AS ' pg_pathman' , ' debug_capture'
703725LANGUAGE C STRICT;
704726
705- /*
706- * Return tablespace name for specified relation.
707- */
708- CREATE OR REPLACE FUNCTION @extschema@.get_rel_tablespace_name(relation REGCLASS)
709- RETURNS TEXT AS ' pg_pathman' , ' get_rel_tablespace_name'
710- LANGUAGE C STRICT;
711-
712727/*
713728 * Checks that callback function meets specific requirements. Particularly it
714729 * must have the only JSONB argument and VOID return type.
715730 */
716- CREATE OR REPLACE FUNCTION @extschema@.validate_on_partition_created_callback(callback REGPROC)
731+ CREATE OR REPLACE FUNCTION @extschema@.validate_on_partition_created_callback(
732+ callback REGPROC)
717733RETURNS VOID AS ' pg_pathman' , ' validate_on_part_init_callback_pl'
718734LANGUAGE C STRICT;
719735
0 commit comments