Merge pull request #936 from citusdata/fix_foreign_constraint_replication_factor_message

Change error message we displayed for foreign constraints if RF > 1
pull/937/head
Burak Yücesoy 2016-11-01 15:57:46 +02:00 committed by GitHub
commit 2cb2e7a352
2 changed files with 9 additions and 5 deletions

View File

@ -563,10 +563,13 @@ ErrorIfNotSupportedForeignConstraint(Relation relation, char distributionMethod,
{ {
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot create foreign key constraint"), errmsg("cannot create foreign key constraint"),
errdetail("Citus cannot create foreign key constrains" errdetail("Citus Community Edition currently supports foreign"
" if replication factor is greater than 1. " "key constraints only for "
"Contact Citus Data for alternative " "\"citus.shard_replication_factor = 1\"."),
"deployment options."))); errhint("Please change \"citus.shard_replication_factor to "
"1\". To learn more about using foreign keys with "
"other replication factors, please contact us at "
"https://citusdata.com/about/contact_us.")));
} }
heapTuple = systable_getnext(scanDescriptor); heapTuple = systable_getnext(scanDescriptor);

View File

@ -63,7 +63,8 @@ DROP TABLE referencing_table;
CREATE TABLE referencing_table(id int, ref_id int, FOREIGN KEY(ref_id) REFERENCES referenced_table(id)); CREATE TABLE referencing_table(id int, ref_id int, FOREIGN KEY(ref_id) REFERENCES referenced_table(id));
SELECT create_distributed_table('referencing_table', 'ref_id', 'hash'); SELECT create_distributed_table('referencing_table', 'ref_id', 'hash');
ERROR: cannot create foreign key constraint ERROR: cannot create foreign key constraint
DETAIL: Citus cannot create foreign key constrains if replication factor is greater than 1. Contact Citus Data for alternative deployment options. DETAIL: Citus Community Edition currently supports foreignkey constraints only for "citus.shard_replication_factor = 1".
HINT: Please change "citus.shard_replication_factor to 1". To learn more about using foreign keys with other replication factors, please contact us at https://citusdata.com/about/contact_us.
DROP TABLE referencing_table; DROP TABLE referencing_table;
DROP TABLE referenced_table; DROP TABLE referenced_table;
-- test foreign constraint with correct conditions -- test foreign constraint with correct conditions