mirror of https://github.com/citusdata/citus.git
Fix foreign_key_to_reference_shard_rebalance test (#7826)
foreign_key_to_reference_shard_rebalance failed because partition of
2024 year does not exist, fixed by add default partition.
Replaces https://github.com/citusdata/citus/pull/7396 by adding a rule
that allows properly testing foreign_key_to_reference_shard_rebalance
via run_test.py.
Closes #7396
Co-authored-by: chuhx <148182736+cstarc1@users.noreply.github.com>
(cherry picked from commit 968ac74cde
)
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
pull/7868/head
parent
39e890d9ce
commit
71d921707d
|
@ -181,6 +181,9 @@ DEPS = {
|
|||
"multi_test_helpers_superuser",
|
||||
],
|
||||
),
|
||||
"foreign_key_to_reference_shard_rebalance": TestDeps(
|
||||
"minimal_schedule", ["remove_coordinator_from_metadata"]
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ select create_distributed_table('partitioned_tbl_with_fkey','x');
|
|||
|
||||
create table partition_1_with_fkey partition of partitioned_tbl_with_fkey for values from ('2022-01-01') to ('2022-12-31');
|
||||
create table partition_2_with_fkey partition of partitioned_tbl_with_fkey for values from ('2023-01-01') to ('2023-12-31');
|
||||
create table partition_3_with_fkey partition of partitioned_tbl_with_fkey for values from ('2024-01-01') to ('2024-12-31');
|
||||
create table partition_3_with_fkey partition of partitioned_tbl_with_fkey DEFAULT;
|
||||
insert into partitioned_tbl_with_fkey (x,y) select s,s%10 from generate_series(1,100) s;
|
||||
ALTER TABLE partitioned_tbl_with_fkey ADD CONSTRAINT fkey_to_ref_tbl FOREIGN KEY (y) REFERENCES ref_table_with_fkey(id);
|
||||
WITH shardid AS (SELECT shardid FROM pg_dist_shard where logicalrelid = 'partitioned_tbl_with_fkey'::regclass ORDER BY shardid LIMIT 1)
|
||||
|
|
|
@ -84,7 +84,7 @@ create table partitioned_tbl_with_fkey (x int, y int, t timestamptz default now(
|
|||
select create_distributed_table('partitioned_tbl_with_fkey','x');
|
||||
create table partition_1_with_fkey partition of partitioned_tbl_with_fkey for values from ('2022-01-01') to ('2022-12-31');
|
||||
create table partition_2_with_fkey partition of partitioned_tbl_with_fkey for values from ('2023-01-01') to ('2023-12-31');
|
||||
create table partition_3_with_fkey partition of partitioned_tbl_with_fkey for values from ('2024-01-01') to ('2024-12-31');
|
||||
create table partition_3_with_fkey partition of partitioned_tbl_with_fkey DEFAULT;
|
||||
insert into partitioned_tbl_with_fkey (x,y) select s,s%10 from generate_series(1,100) s;
|
||||
|
||||
ALTER TABLE partitioned_tbl_with_fkey ADD CONSTRAINT fkey_to_ref_tbl FOREIGN KEY (y) REFERENCES ref_table_with_fkey(id);
|
||||
|
|
Loading…
Reference in New Issue