\set VERBOSITY terse SET search_path = 'public'; CREATE EXTENSION pg_pathman; CREATE SCHEMA multi; /* Check that multilevel is prohibited */ CREATE TABLE multi.test(key int NOT NULL); SELECT create_hash_partitions('multi.test', 'key', 3); create_hash_partitions ------------------------ 3 (1 row) SELECT create_hash_partitions('multi.test_1', 'key', 3); ERROR: multilevel partitioning is not supported DROP TABLE multi.test CASCADE; NOTICE: drop cascades to 3 other objects /* Attach partitioned subtree to 'abc' */ CREATE TABLE multi.abc (val int NOT NULL); CREATE TABLE multi.def (LIKE multi.abc); SELECT create_hash_partitions('multi.def', 'val', 2); create_hash_partitions ------------------------ 2 (1 row) ALTER TABLE multi.def INHERIT multi.abc; /* * Although multilevel partitioning is not supported, * we must make sure that pg_pathman won't add * duplicate relations to the final plan. */ EXPLAIN (COSTS OFF) TABLE multi.abc; QUERY PLAN ------------------------- Append -> Seq Scan on abc -> Seq Scan on def -> Seq Scan on def_0 -> Seq Scan on def_1 (5 rows) DROP SCHEMA multi CASCADE; NOTICE: drop cascades to 4 other objects DROP EXTENSION pg_pathman;