citus/src/test/regress/expected/upgrade_partition_constrain...

34 lines
1.4 KiB
Plaintext

-- run this test only when old citus version is earlier than 10.0
\set upgrade_test_old_citus_version `echo "$CITUS_OLD_VERSION"`
SELECT substring(:'upgrade_test_old_citus_version', 'v(\d+)\.\d+\.\d+')::int < 10
AS upgrade_test_old_citus_version_lt_10_0;
upgrade_test_old_citus_version_lt_10_0
---------------------------------------------------------------------
t
(1 row)
\gset
\if :upgrade_test_old_citus_version_lt_10_0
\else
\q
\endif
-- test cases for #3970
SET search_path = test_3970;
--5. add a partition
-- This command will fail as the child table has a wrong constraint name
CREATE TABLE part_table_p202009 PARTITION OF part_table FOR VALUES FROM ('2020-09-01 00:00:00') TO ('2020-10-01 00:00:00');
ERROR: child table is missing constraint "ck_01234567890123456789012345678901234567890123_8478db72_xxxxxx"
CONTEXT: while executing command on localhost:xxxxx
-- fix constraint names on partitioned table shards
SELECT fix_pre_citus10_partitioned_table_constraint_names('part_table'::regclass);
fix_pre_citus10_partitioned_table_constraint_names
---------------------------------------------------------------------
(1 row)
--5. add a partition
CREATE TABLE part_table_p202009 PARTITION OF part_table FOR VALUES FROM ('2020-09-01 00:00:00') TO ('2020-10-01 00:00:00');
RESET search_path;
DROP SCHEMA test_3970 CASCADE;
NOTICE: drop cascades to table test_3970.part_table