\set VERBOSITY terse CREATE EXTENSION pg_pathman; CREATE SCHEMA fkeys; /* Check primary keys generation */ CREATE TABLE fkeys.test_ref(comment TEXT UNIQUE); INSERT INTO fkeys.test_ref VALUES('test'); CREATE TABLE fkeys.test_fkey( id INT NOT NULL, comment TEXT, FOREIGN KEY (comment) REFERENCES fkeys.test_ref(comment)); INSERT INTO fkeys.test_fkey SELECT generate_series(1, 1000), 'test'; SELECT create_range_partitions('fkeys.test_fkey', 'id', 1, 100); NOTICE: sequence "test_fkey_seq" does not exist, skipping create_range_partitions ------------------------- 10 (1 row) INSERT INTO fkeys.test_fkey VALUES(1, 'wrong'); ERROR: insert or update on table "test_fkey_1" violates foreign key constraint "test_fkey_1_comment_fkey" INSERT INTO fkeys.test_fkey VALUES(1, 'test'); SELECT drop_partitions('fkeys.test_fkey'); NOTICE: function fkeys.test_fkey_upd_trig_func() does not exist, skipping NOTICE: 101 rows copied from fkeys.test_fkey_1 NOTICE: 100 rows copied from fkeys.test_fkey_2 NOTICE: 100 rows copied from fkeys.test_fkey_3 NOTICE: 100 rows copied from fkeys.test_fkey_4 NOTICE: 100 rows copied from fkeys.test_fkey_5 NOTICE: 100 rows copied from fkeys.test_fkey_6 NOTICE: 100 rows copied from fkeys.test_fkey_7 NOTICE: 100 rows copied from fkeys.test_fkey_8 NOTICE: 100 rows copied from fkeys.test_fkey_9 NOTICE: 100 rows copied from fkeys.test_fkey_10 drop_partitions ----------------- 10 (1 row) SELECT create_hash_partitions('fkeys.test_fkey', 'id', 10); create_hash_partitions ------------------------ 10 (1 row) INSERT INTO fkeys.test_fkey VALUES(1, 'wrong'); ERROR: insert or update on table "test_fkey_0" violates foreign key constraint "test_fkey_0_comment_fkey" INSERT INTO fkeys.test_fkey VALUES(1, 'test'); SELECT drop_partitions('fkeys.test_fkey'); NOTICE: function fkeys.test_fkey_upd_trig_func() does not exist, skipping NOTICE: 100 rows copied from fkeys.test_fkey_0 NOTICE: 90 rows copied from fkeys.test_fkey_1 NOTICE: 90 rows copied from fkeys.test_fkey_2 NOTICE: 116 rows copied from fkeys.test_fkey_3 NOTICE: 101 rows copied from fkeys.test_fkey_4 NOTICE: 90 rows copied from fkeys.test_fkey_5 NOTICE: 95 rows copied from fkeys.test_fkey_6 NOTICE: 118 rows copied from fkeys.test_fkey_7 NOTICE: 108 rows copied from fkeys.test_fkey_8 NOTICE: 94 rows copied from fkeys.test_fkey_9 drop_partitions ----------------- 10 (1 row) DROP SCHEMA fkeys CASCADE; NOTICE: drop cascades to 3 other objects DROP EXTENSION pg_pathman CASCADE;