-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression in allowed foreign keys on distributed tables (#6550)
DESCRIPTION: Fix regression in allowed foreign keys on distributed tables In commit eadc88a we changed how we skip foreign key validation. The goal was to skip it in more cases. However, one change had the unintended regression of introducing failures when trying to create certain foreign keys. This reverts that part of the change. The way of skipping validation of foreign keys that was introduced in eadc88a was skipping validation during execution. The reason that this caused this regression was because some foreign key validation queries already fail during planning. In those cases it never gets to the execution step where it would later be skipped. Fixes #6543 (cherry picked from commit 7a7880a)
- Loading branch information
Showing
7 changed files
with
73 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CREATE SCHEMA issue_6543; | ||
SET search_path TO issue_6543; | ||
SET citus.shard_count TO 4; | ||
SET citus.shard_replication_factor TO 1; | ||
SET citus.next_shard_id TO 67322500; | ||
CREATE TABLE event ( | ||
tenant_id varchar, | ||
id bigint, | ||
primary key (tenant_id, id) | ||
); | ||
CREATE TABLE page ( | ||
tenant_id varchar, | ||
id int, | ||
primary key (tenant_id, id) | ||
); | ||
SELECT create_distributed_table('event', 'tenant_id'); | ||
create_distributed_table | ||
--------------------------------------------------------------------- | ||
|
||
(1 row) | ||
|
||
SELECT create_distributed_table('page', 'tenant_id', colocate_with => 'event'); | ||
create_distributed_table | ||
--------------------------------------------------------------------- | ||
|
||
(1 row) | ||
|
||
alter table page add constraint fk21 foreign key (tenant_id, id) references event; | ||
SET client_min_messages TO WARNING; | ||
DROP SCHEMA issue_6543 CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
CREATE SCHEMA issue_6543; | ||
SET search_path TO issue_6543; | ||
SET citus.shard_count TO 4; | ||
SET citus.shard_replication_factor TO 1; | ||
SET citus.next_shard_id TO 67322500; | ||
|
||
CREATE TABLE event ( | ||
tenant_id varchar, | ||
id bigint, | ||
primary key (tenant_id, id) | ||
); | ||
|
||
CREATE TABLE page ( | ||
tenant_id varchar, | ||
id int, | ||
primary key (tenant_id, id) | ||
); | ||
|
||
SELECT create_distributed_table('event', 'tenant_id'); | ||
SELECT create_distributed_table('page', 'tenant_id', colocate_with => 'event'); | ||
alter table page add constraint fk21 foreign key (tenant_id, id) references event; | ||
|
||
SET client_min_messages TO WARNING; | ||
DROP SCHEMA issue_6543 CASCADE; |