Skip to content

Commit 3556ae3

Browse files
committed
A couple of tests for recent commits.
1 parent a53a607 commit 3556ae3

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

Diff for: expected/pathman_basic.out

+58
Original file line numberDiff line numberDiff line change
@@ -1804,6 +1804,64 @@ ORDER BY partition;
18041804

18051805
DROP TABLE test.provided_part_names CASCADE;
18061806
NOTICE: drop cascades to 2 other objects
1807+
-- is pathman (caches, in particular) strong enough to carry out this?
1808+
-- 079797e0d5
1809+
CREATE TABLE test.part_test(val serial);
1810+
INSERT INTO test.part_test SELECT generate_series(1, 30);
1811+
SELECT create_range_partitions('test.part_test', 'val', 1, 10);
1812+
create_range_partitions
1813+
-------------------------
1814+
3
1815+
(1 row)
1816+
1817+
SELECT set_interval('test.part_test', 100);
1818+
set_interval
1819+
--------------
1820+
1821+
(1 row)
1822+
1823+
DELETE FROM pathman_config WHERE partrel = 'test.part_test'::REGCLASS;
1824+
SELECT drop_partitions('test.part_test');
1825+
ERROR: table "test.part_test" has no partitions
1826+
SELECT disable_pathman_for('test.part_test');
1827+
disable_pathman_for
1828+
---------------------
1829+
1830+
(1 row)
1831+
1832+
CREATE TABLE test.wrong_partition (LIKE test.part_test) INHERITS (test.part_test);
1833+
NOTICE: merging column "val" with inherited definition
1834+
SELECT add_to_pathman_config('test.part_test', 'val', '10');
1835+
ERROR: constraint "pathman_wrong_partition_check" of partition "wrong_partition" does not exist
1836+
SELECT add_to_pathman_config('test.part_test', 'val');
1837+
ERROR: wrong constraint format for HASH partition "part_test_1"
1838+
DROP TABLE test.part_test CASCADE;
1839+
NOTICE: drop cascades to 5 other objects
1840+
--
1841+
-- 85fc5ccf121
1842+
CREATE TABLE test.part_test(val serial);
1843+
INSERT INTO test.part_test SELECT generate_series(1, 3000);
1844+
SELECT create_range_partitions('test.part_test', 'val', 1, 10);
1845+
create_range_partitions
1846+
-------------------------
1847+
300
1848+
(1 row)
1849+
1850+
SELECT append_range_partition('test.part_test');
1851+
append_range_partition
1852+
------------------------
1853+
test.part_test_301
1854+
(1 row)
1855+
1856+
DELETE FROM test.part_test;
1857+
SELECT create_single_range_partition('test.part_test', NULL::INT4, NULL); /* not ok */
1858+
ERROR: cannot create partition with range (-inf, +inf)
1859+
DELETE FROM pathman_config WHERE partrel = 'test.part_test'::REGCLASS;
1860+
SELECT create_hash_partitions('test.part_test', 'val', 2, partition_names := ARRAY[]::TEXT[]); /* not ok */
1861+
ERROR: can't partition table "test.part_test" with existing children
1862+
DROP TABLE test.part_test CASCADE;
1863+
NOTICE: drop cascades to 302 other objects
1864+
--
18071865
DROP SCHEMA test CASCADE;
18081866
NOTICE: drop cascades to 28 other objects
18091867
DROP EXTENSION pg_pathman CASCADE;

Diff for: sql/pathman_basic.sql

+30
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,36 @@ ORDER BY partition;
546546

547547
DROP TABLE test.provided_part_names CASCADE;
548548

549+
-- is pathman (caches, in particular) strong enough to carry out this?
550+
551+
-- 079797e0d5
552+
CREATE TABLE test.part_test(val serial);
553+
INSERT INTO test.part_test SELECT generate_series(1, 30);
554+
SELECT create_range_partitions('test.part_test', 'val', 1, 10);
555+
SELECT set_interval('test.part_test', 100);
556+
DELETE FROM pathman_config WHERE partrel = 'test.part_test'::REGCLASS;
557+
SELECT drop_partitions('test.part_test');
558+
SELECT disable_pathman_for('test.part_test');
559+
560+
CREATE TABLE test.wrong_partition (LIKE test.part_test) INHERITS (test.part_test);
561+
SELECT add_to_pathman_config('test.part_test', 'val', '10');
562+
SELECT add_to_pathman_config('test.part_test', 'val');
563+
564+
DROP TABLE test.part_test CASCADE;
565+
--
566+
567+
-- 85fc5ccf121
568+
CREATE TABLE test.part_test(val serial);
569+
INSERT INTO test.part_test SELECT generate_series(1, 3000);
570+
SELECT create_range_partitions('test.part_test', 'val', 1, 10);
571+
SELECT append_range_partition('test.part_test');
572+
DELETE FROM test.part_test;
573+
SELECT create_single_range_partition('test.part_test', NULL::INT4, NULL); /* not ok */
574+
DELETE FROM pathman_config WHERE partrel = 'test.part_test'::REGCLASS;
575+
SELECT create_hash_partitions('test.part_test', 'val', 2, partition_names := ARRAY[]::TEXT[]); /* not ok */
576+
577+
DROP TABLE test.part_test CASCADE;
578+
--
549579

550580
DROP SCHEMA test CASCADE;
551581
DROP EXTENSION pg_pathman CASCADE;

0 commit comments

Comments
 (0)