From cacb76d2c6a70383ad5d7c597daa2298e446ac2b Mon Sep 17 00:00:00 2001 From: Onur Tirtir Date: Wed, 27 Jan 2021 12:36:53 +0300 Subject: [PATCH] Not mention citus local tables in error messages (#4579) --- .../commands/create_citus_local_table.c | 31 +++++++------- .../distributed/commands/foreign_constraint.c | 14 +++---- src/backend/distributed/commands/table.c | 4 +- src/backend/distributed/commands/trigger.c | 3 +- .../distributed/operations/delete_protocol.c | 2 +- .../distributed/operations/repair_shards.c | 13 +++--- .../distributed/operations/stage_protocol.c | 7 ++-- .../planner/insert_select_planner.c | 2 +- .../planner/multi_router_planner.c | 12 +++--- .../transaction/relation_access_tracking.c | 2 +- .../distributed/utils/colocation_utils.c | 2 +- .../distributed/utils/shardinterval_utils.c | 4 +- src/test/regress/bin/normalize.sed | 4 +- .../regress/expected/citus_local_tables.out | 28 ++++++------- .../expected/citus_local_tables_queries.out | 2 +- .../citus_local_tables_queries_mx.out | 10 ++--- .../regress/expected/citus_table_triggers.out | 40 +++++++++---------- .../create_citus_local_table_cascade.out | 2 +- .../create_ref_dist_from_citus_local.out | 2 +- .../expected/fkeys_between_local_ref.out | 12 +++--- .../foreign_key_restriction_enforcement.out | 6 +-- .../isolation_create_citus_local_table.out | 2 +- .../regress/expected/multi_foreign_key.out | 8 ++-- .../expected/multi_reference_table.out | 8 ++-- .../expected/ref_citus_local_fkeys.out | 12 +++--- .../multi_alter_table_statements.source | 4 +- .../output/multi_append_table_to_shard.source | 2 +- 27 files changed, 119 insertions(+), 119 deletions(-) diff --git a/src/backend/distributed/commands/create_citus_local_table.c b/src/backend/distributed/commands/create_citus_local_table.c index 87f76289d..4a005775d 100644 --- a/src/backend/distributed/commands/create_citus_local_table.c +++ b/src/backend/distributed/commands/create_citus_local_table.c @@ -92,13 +92,12 @@ create_citus_local_table(PG_FUNCTION_ARGS) * not chained with any reference tables back to postgres tables. * So give a warning to user for that. */ - ereport(WARNING, (errmsg("citus local tables that are not chained with " - "reference tables via foreign keys might be " - "automatically converted back to postgres tables"), + ereport(WARNING, (errmsg("local tables that are added to metadata but not " + "chained with reference tables via foreign keys might " + "be automatically converted back to postgres tables"), errhint("Consider setting " "citus.enable_local_reference_table_foreign_keys " - "to 'off' to disable automatically undistributing " - "citus local tables"))); + "to 'off' to disable this behavior"))); } Oid relationId = PG_GETARG_OID(0); @@ -209,9 +208,9 @@ CreateCitusLocalTable(Oid relationId, bool cascadeViaForeignKeys) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("relation %s is involved in a foreign key " "relationship with another table", qualifiedRelationName), - errhint("Use cascade_via_foreign_keys option to convert " + errhint("Use cascade_via_foreign_keys option to add " "all the relations involved in a foreign key " - "relationship with %s to a citus local table by " + "relationship with %s to citus metadata by " "executing SELECT create_citus_local_table($$%s$$, " "cascade_via_foreign_keys=>true)", qualifiedRelationName, qualifiedRelationName))); @@ -280,7 +279,7 @@ ErrorIfUnsupportedCreateCitusLocalTable(Relation relation) { if (!RelationIsValid(relation)) { - ereport(ERROR, (errmsg("cannot create citus local table, relation does " + ereport(ERROR, (errmsg("cannot add local table to metadata, relation does " "not exist"))); } @@ -319,16 +318,16 @@ ErrorIfUnsupportedCitusLocalTableKind(Oid relationId) if (IsChildTable(relationId) || IsParentTable(relationId)) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot create citus local table \"%s\", citus local " - "tables cannot be involved in inheritance relationships", - relationName))); + errmsg("cannot add local table \"%s\" to metadata, local tables " + "added to metadata cannot be involved in inheritance " + "relationships", relationName))); } if (PartitionTable(relationId)) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot create citus local table \"%s\", citus local " - "tables cannot be partition of other tables", + errmsg("cannot add local table \"%s\" to metadata, local tables " + "added to metadata cannot be partition of other tables ", relationName))); } @@ -336,9 +335,9 @@ ErrorIfUnsupportedCitusLocalTableKind(Oid relationId) if (!(relationKind == RELKIND_RELATION || relationKind == RELKIND_FOREIGN_TABLE)) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot create citus local table \"%s\", only regular " - "tables and foreign tables are supported for citus local " - "table creation", relationName))); + errmsg("cannot add local table \"%s\" to metadata, only regular " + "tables and foreign tables can be added to citus metadata ", + relationName))); } } diff --git a/src/backend/distributed/commands/foreign_constraint.c b/src/backend/distributed/commands/foreign_constraint.c index 2212cdbd4..7a7eb099e 100644 --- a/src/backend/distributed/commands/foreign_constraint.c +++ b/src/backend/distributed/commands/foreign_constraint.c @@ -222,11 +222,11 @@ ErrorIfUnsupportedForeignConstraintExists(Relation relation, char referencingDis ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot create foreign key constraint " "since foreign keys from reference tables " - "and citus local tables to distributed tables " + "and local tables to distributed tables " "are not supported"), - errdetail("Reference tables and citus local tables " + errdetail("Reference tables and local tables " "can only have foreign keys to reference " - "tables and citus local tables"))); + "tables and local tables"))); } /* @@ -335,7 +335,7 @@ EnsureSupportedFKeyBetweenCitusLocalAndRefTable(Form_pg_constraint fKeyConstrain ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot define foreign key constraint, " "foreign keys from reference tables to " - "citus local tables can only be defined " + "local tables can only be defined " "with NO ACTION or RESTRICT behaviors"), errhint(USE_CREATE_REFERENCE_TABLE_HINT, referencedTableName))); @@ -435,10 +435,10 @@ ErrorOutForFKeyBetweenPostgresAndCitusLocalTable(Oid localTableId) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot create foreign key constraint as \"%s\" is " "a postgres local table", localTableName), - errhint("first create a citus local table from the postgres " - "local table using SELECT create_citus_local_table('%s') " + errhint("first add local table to citus metadata " + "by using SELECT create_citus_local_table('%s') " "and execute the ALTER TABLE command to create the " - "foreign key to citus local table", localTableName))); + "foreign key to local table", localTableName))); } diff --git a/src/backend/distributed/commands/table.c b/src/backend/distributed/commands/table.c index 6ef5440b4..93b81b327 100644 --- a/src/backend/distributed/commands/table.c +++ b/src/backend/distributed/commands/table.c @@ -1799,8 +1799,8 @@ ErrorIfCitusLocalTablePartitionCommand(AlterTableCmd *alterTableCmd, Oid parentR ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot execute ATTACH/DETACH PARTITION command as " - "citus local tables cannot be involved in partition " - "relationships with other tables"))); + "local tables added to metadata cannot be involved in " + "partition relationships with other tables"))); } diff --git a/src/backend/distributed/commands/trigger.c b/src/backend/distributed/commands/trigger.c index aa6aa6cae..d965986a3 100644 --- a/src/backend/distributed/commands/trigger.c +++ b/src/backend/distributed/commands/trigger.c @@ -553,7 +553,8 @@ ErrorOutForTriggerIfNotCitusLocalTable(Oid relationId) return; } - ereport(ERROR, (errmsg("triggers are only supported for citus local tables"))); + ereport(ERROR, (errmsg("triggers are only supported for local tables added " + "to metadata"))); } diff --git a/src/backend/distributed/operations/delete_protocol.c b/src/backend/distributed/operations/delete_protocol.c index 845196e7f..eda26ec3d 100644 --- a/src/backend/distributed/operations/delete_protocol.c +++ b/src/backend/distributed/operations/delete_protocol.c @@ -177,7 +177,7 @@ master_apply_delete_command(PG_FUNCTION_ARGS) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot delete from table"), - errdetail("Delete statements on reference and citus " + errdetail("Delete statements on reference and " "local tables are not supported."))); } diff --git a/src/backend/distributed/operations/repair_shards.c b/src/backend/distributed/operations/repair_shards.c index 9046a5824..ee00c6c54 100644 --- a/src/backend/distributed/operations/repair_shards.c +++ b/src/backend/distributed/operations/repair_shards.c @@ -311,9 +311,9 @@ ErrorIfMoveCitusLocalTable(Oid relationId) char *qualifiedRelationName = generate_qualified_relation_name(relationId); ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("table %s is a citus local table, moving shard of " - "a citus local table is currently not supported", - qualifiedRelationName))); + errmsg("table %s is a local table, moving shard of " + "a local table added to metadata is currently " + "not supported", qualifiedRelationName))); } @@ -385,9 +385,10 @@ ErrorIfTableCannotBeReplicated(Oid relationId) if (IsCitusTableTypeCacheEntry(tableEntry, CITUS_LOCAL_TABLE)) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - (errmsg("Table %s is a citus local table. Replicating " - "shard of a citus local table currently is not " - "supported", quote_literal_cstr(relationName))))); + (errmsg("Table %s is a local table. Replicating " + "shard of a local table added to metadata " + "currently is not supported", + quote_literal_cstr(relationName))))); } /* diff --git a/src/backend/distributed/operations/stage_protocol.c b/src/backend/distributed/operations/stage_protocol.c index e3fdd7877..a9f0dcf13 100644 --- a/src/backend/distributed/operations/stage_protocol.c +++ b/src/backend/distributed/operations/stage_protocol.c @@ -153,10 +153,10 @@ master_create_empty_shard(PG_FUNCTION_ARGS) } else if (IsCitusTableType(relationId, CITUS_LOCAL_TABLE)) { - ereport(ERROR, (errmsg("relation \"%s\" is a citus local table", + ereport(ERROR, (errmsg("relation \"%s\" is a local table", relationName), errdetail("We currently don't support creating shards " - "on citus local tables"))); + "on local tables"))); } char replicationModel = TableReplicationModel(relationId); @@ -265,8 +265,7 @@ master_append_table_to_shard(PG_FUNCTION_ARGS) { ereport(ERROR, (errmsg("cannot append to shardId " UINT64_FORMAT, shardId), errdetail("We currently don't support appending to shards " - "in hash-partitioned, reference and citus local " - "tables"))); + "in hash-partitioned, reference and local tables"))); } /* ensure that the shard placement metadata does not change during the append */ diff --git a/src/backend/distributed/planner/insert_select_planner.c b/src/backend/distributed/planner/insert_select_planner.c index f2da9ef90..f07803866 100644 --- a/src/backend/distributed/planner/insert_select_planner.c +++ b/src/backend/distributed/planner/insert_select_planner.c @@ -572,7 +572,7 @@ DistributedInsertSelectSupported(Query *queryTree, RangeTblEntry *insertRte, { return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED, "distributed INSERT ... SELECT cannot insert into a " - "citus local table", + "local table that is added to metadata", NULL, NULL); } diff --git a/src/backend/distributed/planner/multi_router_planner.c b/src/backend/distributed/planner/multi_router_planner.c index 768e9b171..4ad2fae5b 100644 --- a/src/backend/distributed/planner/multi_router_planner.c +++ b/src/backend/distributed/planner/multi_router_planner.c @@ -771,10 +771,10 @@ DeferErrorIfUnsupportedLocalTableJoin(List *rangeTableList) if (ModifiesLocalTableWithRemoteCitusLocalTable(rangeTableList)) { return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED, - "Modifying local tables with citus local tables is " - "supported only from the coordinator.", + "Modifying local tables with remote local tables is " + "not supported.", NULL, - "Consider wrapping citus local table to a CTE, or subquery"); + "Consider wrapping remote local table to a CTE, or subquery"); } return NULL; } @@ -953,7 +953,7 @@ ModifyQuerySupported(Query *queryTree, Query *originalQuery, bool multiShardQuer if (IsCitusTable(rangeTableEntry->relid)) { appendStringInfo(errorMessage, - "citus local table %s cannot be joined with these distributed tables", + "local table %s cannot be joined with these distributed tables", relationName); } else @@ -2879,7 +2879,7 @@ BuildRoutesForInsert(Query *query, DeferredErrorMessage **planningError) } else if (IsCitusTableTypeCacheEntry(cacheEntry, CITUS_LOCAL_TABLE)) { - ereport(ERROR, (errmsg("citus local table cannot have %d shards", + ereport(ERROR, (errmsg("local table cannot have %d shards", shardCount))); } } @@ -3545,7 +3545,7 @@ DeferErrorIfUnsupportedRouterPlannableSelectQuery(Query *query) else if (IsCitusTableType(distributedTableId, CITUS_LOCAL_TABLE)) { hasPostgresOrCitusLocalTable = true; - elog(DEBUG4, "Router planner finds a citus local table"); + elog(DEBUG4, "Router planner finds a local table added to metadata"); continue; } diff --git a/src/backend/distributed/transaction/relation_access_tracking.c b/src/backend/distributed/transaction/relation_access_tracking.c index e59aede8d..2f354cc83 100644 --- a/src/backend/distributed/transaction/relation_access_tracking.c +++ b/src/backend/distributed/transaction/relation_access_tracking.c @@ -772,7 +772,7 @@ CheckConflictingRelationAccesses(Oid relationId, ShardPlacementAccessType access "a parallel operation on a distributed table", relationName), errdetail("When there is a foreign key to a reference " - "table or to a citus local table, Citus needs " + "table or to a local table, Citus needs " "to perform all operations over a single " "connection per node to ensure consistency."), errhint("Try re-running the transaction with " diff --git a/src/backend/distributed/utils/colocation_utils.c b/src/backend/distributed/utils/colocation_utils.c index 2a96e67ec..9ca79aea7 100644 --- a/src/backend/distributed/utils/colocation_utils.c +++ b/src/backend/distributed/utils/colocation_utils.c @@ -244,7 +244,7 @@ MarkTablesColocated(Oid sourceRelationId, Oid targetRelationId) if (IsCitusTableType(sourceRelationId, CITUS_LOCAL_TABLE) || IsCitusTableType(targetRelationId, CITUS_LOCAL_TABLE)) { - ereport(ERROR, (errmsg("citus local tables cannot be colocated with " + ereport(ERROR, (errmsg("local tables cannot be colocated with " "other tables"))); } diff --git a/src/backend/distributed/utils/shardinterval_utils.c b/src/backend/distributed/utils/shardinterval_utils.c index 9a5a01511..6b429e366 100644 --- a/src/backend/distributed/utils/shardinterval_utils.c +++ b/src/backend/distributed/utils/shardinterval_utils.c @@ -228,8 +228,8 @@ ShardIndex(ShardInterval *shardInterval) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("finding index of a given shard is only supported for " - "hash distributed tables, reference tables and citus " - "local tables"))); + "hash distributed tables, reference tables and local " + "tables that are added to citus metadata"))); } /* short-circuit for reference tables */ diff --git a/src/test/regress/bin/normalize.sed b/src/test/regress/bin/normalize.sed index 2a53cfd13..f95ca606d 100644 --- a/src/test/regress/bin/normalize.sed +++ b/src/test/regress/bin/normalize.sed @@ -202,5 +202,5 @@ s/citus_local_table_4_[0-9]+/citus_local_table_4_xxxxxx/g s/ERROR: cannot append to shardId [0-9]+/ERROR: cannot append to shardId xxxxxx/g # hide warning/hint message that we get when executing create_citus_local_table -/citus local tables that are not chained with reference tables via foreign keys might be automatically converted back to postgres tables$/d -/Consider setting citus.enable_local_reference_table_foreign_keys to 'off' to disable automatically undistributing citus local tables$/d +/local tables that are added to metadata but not chained with reference tables via foreign keys might be automatically converted back to postgres tables$/d +/Consider setting citus.enable_local_reference_table_foreign_keys to 'off' to disable this behavior$/d diff --git a/src/test/regress/expected/citus_local_tables.out b/src/test/regress/expected/citus_local_tables.out index 5c50152fa..1e699a61b 100644 --- a/src/test/regress/expected/citus_local_tables.out +++ b/src/test/regress/expected/citus_local_tables.out @@ -111,12 +111,12 @@ CREATE TABLE partitioned_table_1 PARTITION OF partitioned_table FOR VALUES FROM CREATE TABLE partitioned_table_2 PARTITION OF partitioned_table FOR VALUES FROM (10) TO (20); -- cannot create partitioned citus local tables SELECT create_citus_local_table('partitioned_table'); -ERROR: cannot create citus local table "partitioned_table", only regular tables and foreign tables are supported for citus local table creation +ERROR: cannot add local table "partitioned_table" to metadata, only regular tables and foreign tables can be added to citus metadata BEGIN; CREATE TABLE citus_local_table PARTITION OF partitioned_table FOR VALUES FROM (20) TO (30); -- cannot create citus local table as a partition of a local table SELECT create_citus_local_table('citus_local_table'); -ERROR: cannot create citus local table "citus_local_table", citus local tables cannot be partition of other tables +ERROR: cannot add local table "citus_local_table" to metadata, local tables added to metadata cannot be partition of other tables ROLLBACK; BEGIN; CREATE TABLE citus_local_table (a int, b int); @@ -147,16 +147,16 @@ BEGIN; -- cannot attach citus local table to a partitioned distributed table ALTER TABLE partitioned_table ATTACH PARTITION citus_local_table FOR VALUES FROM (20) TO (30); -ERROR: cannot execute ATTACH/DETACH PARTITION command as citus local tables cannot be involved in partition relationships with other tables +ERROR: cannot execute ATTACH/DETACH PARTITION command as local tables added to metadata cannot be involved in partition relationships with other tables ROLLBACK; -- show that we do not support inheritance relationships -- CREATE TABLE parent_table (a int, b text); CREATE TABLE child_table () INHERITS (parent_table); -- both of below should error out SELECT create_citus_local_table('parent_table'); -ERROR: cannot create citus local table "parent_table", citus local tables cannot be involved in inheritance relationships +ERROR: cannot add local table "parent_table" to metadata, local tables added to metadata cannot be involved in inheritance relationships SELECT create_citus_local_table('child_table'); -ERROR: cannot create citus local table "child_table", citus local tables cannot be involved in inheritance relationships +ERROR: cannot add local table "child_table" to metadata, local tables added to metadata cannot be involved in inheritance relationships -- show that we support UNLOGGED tables -- CREATE UNLOGGED TABLE unlogged_table (a int primary key); SELECT create_citus_local_table('unlogged_table'); @@ -298,20 +298,20 @@ SELECT create_reference_table('reference_table'); -- show that colociation of citus local tables are not supported for now -- between citus local tables SELECT update_distributed_table_colocation('citus_local_table_1', colocate_with => 'citus_local_table_2'); -ERROR: citus local tables cannot be colocated with other tables +ERROR: local tables cannot be colocated with other tables -- between citus local tables and reference tables SELECT update_distributed_table_colocation('citus_local_table_1', colocate_with => 'reference_table'); -ERROR: citus local tables cannot be colocated with other tables +ERROR: local tables cannot be colocated with other tables SELECT update_distributed_table_colocation('reference_table', colocate_with => 'citus_local_table_1'); -ERROR: citus local tables cannot be colocated with other tables +ERROR: local tables cannot be colocated with other tables -- between citus local tables and distributed tables SELECT update_distributed_table_colocation('citus_local_table_1', colocate_with => 'distributed_table'); -ERROR: citus local tables cannot be colocated with other tables +ERROR: local tables cannot be colocated with other tables SELECT update_distributed_table_colocation('distributed_table', colocate_with => 'citus_local_table_1'); -ERROR: citus local tables cannot be colocated with other tables +ERROR: local tables cannot be colocated with other tables -- master_create_empty_shard is not supported SELECT master_create_empty_shard('citus_local_table_1'); -ERROR: relation "citus_local_table_1" is a citus local table +ERROR: relation "citus_local_table_1" is a local table -- get_shard_id_for_distribution_column is supported SELECT get_shard_id_for_distribution_column('citus_local_table_1', 'not_checking_this_arg_for_non_dist_tables'); get_shard_id_for_distribution_column @@ -328,7 +328,7 @@ SELECT get_shard_id_for_distribution_column('citus_local_table_1'); -- master_copy_shard_placement is not supported SELECT master_copy_shard_placement(shardid, 'localhost', :master_port, 'localhost', :worker_1_port, true) FROM (SELECT shardid FROM pg_dist_shard WHERE logicalrelid='citus_local_table_1'::regclass) as shardid; -ERROR: Table 'citus_local_table_1' is a citus local table. Replicating shard of a citus local table currently is not supported +ERROR: Table 'citus_local_table_1' is a local table. Replicating shard of a local table added to metadata currently is not supported -- undistribute_table is supported BEGIN; SELECT undistribute_table('citus_local_table_1'); @@ -478,7 +478,7 @@ BEGIN; ROLLBACK; -- between citus local tables and distributed tables ALTER TABLE citus_local_table_1 ADD CONSTRAINT fkey_c_to_dist FOREIGN KEY(a) references distributed_table(a); -ERROR: cannot create foreign key constraint since foreign keys from reference tables and citus local tables to distributed tables are not supported +ERROR: cannot create foreign key constraint since foreign keys from reference tables and local tables to distributed tables are not supported ALTER TABLE distributed_table ADD CONSTRAINT fkey_dist_to_c FOREIGN KEY(a) references citus_local_table_1(a); ERROR: cannot create foreign key constraint since relations are not colocated or not referencing a reference table -- between citus local tables and local tables @@ -699,7 +699,7 @@ ROLLBACK; SELECT update_distributed_table_colocation('citus_local_table_4', colocate_with => 'none'); ERROR: relation citus_local_table_4 should be a hash distributed table SELECT master_create_empty_shard('citus_local_table_4'); -ERROR: relation "citus_local_table_4" is a citus local table +ERROR: relation "citus_local_table_4" is a local table SELECT master_apply_delete_command('DELETE FROM citus_local_table_4'); ERROR: cannot delete from table CREATE TABLE postgres_local_table (a int); diff --git a/src/test/regress/expected/citus_local_tables_queries.out b/src/test/regress/expected/citus_local_tables_queries.out index 581e7437f..a6d48a7b2 100644 --- a/src/test/regress/expected/citus_local_tables_queries.out +++ b/src/test/regress/expected/citus_local_tables_queries.out @@ -893,7 +893,7 @@ UPDATE citus_local_table SET a=5 FROM (SELECT b FROM distributed_table) AS foo WHERE foo.b = citus_local_table.b; -ERROR: citus local table citus_local_table cannot be joined with these distributed tables +ERROR: local table citus_local_table cannot be joined with these distributed tables --------------------------------------------------------------------- -- test different execution paths -- --------------------------------------------------------------------- diff --git a/src/test/regress/expected/citus_local_tables_queries_mx.out b/src/test/regress/expected/citus_local_tables_queries_mx.out index 6bd2dc227..322cd791e 100644 --- a/src/test/regress/expected/citus_local_tables_queries_mx.out +++ b/src/test/regress/expected/citus_local_tables_queries_mx.out @@ -591,21 +591,21 @@ SELECT clear_and_init_test_tables(); DELETE FROM citus_local_table USING postgres_local_table WHERE citus_local_table.b = postgres_local_table.b; -ERROR: Modifying local tables with citus local tables is supported only from the coordinator. +ERROR: Modifying local tables with remote local tables is not supported. UPDATE citus_local_table SET b = 5 FROM postgres_local_table WHERE citus_local_table.a = 3 AND citus_local_table.b = postgres_local_table.b; -ERROR: Modifying local tables with citus local tables is supported only from the coordinator. +ERROR: Modifying local tables with remote local tables is not supported. DELETE FROM postgres_local_table USING citus_local_table WHERE citus_local_table.b = postgres_local_table.b; -ERROR: Modifying local tables with citus local tables is supported only from the coordinator. +ERROR: Modifying local tables with remote local tables is not supported. UPDATE postgres_local_table SET b = 5 FROM citus_local_table WHERE citus_local_table.a = 3 AND citus_local_table.b = postgres_local_table.b; -ERROR: Modifying local tables with citus local tables is supported only from the coordinator. +ERROR: Modifying local tables with remote local tables is not supported. -- no direct joins supported UPDATE distributed_table SET b = 6 @@ -776,7 +776,7 @@ UPDATE citus_local_table SET a=5 FROM (SELECT b FROM distributed_table) AS foo WHERE foo.b = citus_local_table.b; -ERROR: citus local table citus_local_table cannot be joined with these distributed tables +ERROR: local table citus_local_table cannot be joined with these distributed tables --------------------------------------------------------------------- -- test different execution paths -- --------------------------------------------------------------------- diff --git a/src/test/regress/expected/citus_table_triggers.out b/src/test/regress/expected/citus_table_triggers.out index 1691d8b85..541911a36 100644 --- a/src/test/regress/expected/citus_table_triggers.out +++ b/src/test/regress/expected/citus_table_triggers.out @@ -34,11 +34,11 @@ SELECT create_reference_table('reference_table'); CREATE TRIGGER update_value_dist AFTER INSERT ON distributed_table FOR EACH ROW EXECUTE FUNCTION update_value(); -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata CREATE TRIGGER update_value_ref AFTER INSERT ON reference_table FOR EACH ROW EXECUTE FUNCTION update_value(); -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata --------------------------------------------------------------------- -- show that we error out for trigger commands on distributed & reference tables --------------------------------------------------------------------- @@ -56,42 +56,42 @@ SET citus.enable_ddl_propagation to ON; CREATE EXTENSION seg; -- below all should error out ALTER TRIGGER update_value_dist ON distributed_table RENAME TO update_value_dist1; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TRIGGER update_value_dist ON distributed_table DEPENDS ON EXTENSION seg; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata DROP TRIGGER update_value_dist ON distributed_table; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE distributed_table DISABLE TRIGGER ALL; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE distributed_table DISABLE TRIGGER USER; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE distributed_table DISABLE TRIGGER update_value_dist; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE distributed_table ENABLE TRIGGER ALL; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE distributed_table ENABLE TRIGGER USER; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE distributed_table ENABLE TRIGGER update_value_dist; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata -- below all should error out ALTER TRIGGER update_value_ref ON reference_table RENAME TO update_value_ref1; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TRIGGER update_value_ref ON reference_table DEPENDS ON EXTENSION seg; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata DROP TRIGGER update_value_ref ON reference_table; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE reference_table DISABLE TRIGGER ALL; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE reference_table DISABLE TRIGGER USER; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE reference_table DISABLE TRIGGER update_value_ref; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE reference_table ENABLE TRIGGER ALL; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE reference_table ENABLE TRIGGER USER; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata ALTER TABLE reference_table ENABLE TRIGGER update_value_ref; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata --------------------------------------------------------------------- -- show that we do not allow creating citus tables if the -- table has already triggers diff --git a/src/test/regress/expected/create_citus_local_table_cascade.out b/src/test/regress/expected/create_citus_local_table_cascade.out index 68c8a914f..3bc75e5d5 100644 --- a/src/test/regress/expected/create_citus_local_table_cascade.out +++ b/src/test/regress/expected/create_citus_local_table_cascade.out @@ -120,7 +120,7 @@ BEGIN; -- create_citus_local_table(cascade_via_foreign_keys) would fail for -- partitioned_table as create_citus_local_table doesn't support partitioned tables SELECT create_citus_local_table('local_table_2', cascade_via_foreign_keys=>true); -ERROR: cannot create citus local table "partitioned_table", only regular tables and foreign tables are supported for citus local table creation +ERROR: cannot add local table "partitioned_table" to metadata, only regular tables and foreign tables can be added to citus metadata ROLLBACK; BEGIN; DROP TABLE local_table_2; diff --git a/src/test/regress/expected/create_ref_dist_from_citus_local.out b/src/test/regress/expected/create_ref_dist_from_citus_local.out index f46282e16..953b95cf6 100644 --- a/src/test/regress/expected/create_ref_dist_from_citus_local.out +++ b/src/test/regress/expected/create_ref_dist_from_citus_local.out @@ -311,7 +311,7 @@ BEGIN; -- tables are not supported ALTER TABLE citus_local_table_5 ADD CONSTRAINT fkey_12 FOREIGN KEY (col_1) REFERENCES citus_local_table_6(col_1); SELECT create_distributed_table('citus_local_table_6', 'col_1'); -ERROR: cannot create foreign key constraint since foreign keys from reference tables and citus local tables to distributed tables are not supported +ERROR: cannot create foreign key constraint since foreign keys from reference tables and local tables to distributed tables are not supported ROLLBACK; -- have some more tests with foreign keys between citus local -- and reference tables diff --git a/src/test/regress/expected/fkeys_between_local_ref.out b/src/test/regress/expected/fkeys_between_local_ref.out index 9a8722ca2..690432feb 100644 --- a/src/test/regress/expected/fkeys_between_local_ref.out +++ b/src/test/regress/expected/fkeys_between_local_ref.out @@ -102,7 +102,7 @@ ALTER TABLE partitioned_table_1 ADD CONSTRAINT fkey_8 FOREIGN KEY (col_1) REFERE -- now that we attached partitioned table to graph below errors out -- since we cannot create citus local table from partitioned tables ALTER TABLE reference_table_1 ADD CONSTRAINT fkey_9 FOREIGN KEY (col_1) REFERENCES local_table_1(col_1); -ERROR: cannot create citus local table "partitioned_table_1", only regular tables and foreign tables are supported for citus local table creation +ERROR: cannot add local table "partitioned_table_1" to metadata, only regular tables and foreign tables can be added to citus metadata ALTER TABLE partitioned_table_1 DROP CONSTRAINT fkey_8; BEGIN; -- now that we detached partitioned table from graph, succeeds @@ -214,7 +214,7 @@ BEGIN; (1 row) ALTER TABLE reference_table_2 ADD CONSTRAINT fkey_11 FOREIGN KEY (col_1) REFERENCES local_table_2(col_1) ON DELETE CASCADE; -ERROR: cannot define foreign key constraint, foreign keys from reference tables to citus local tables can only be defined with NO ACTION or RESTRICT behaviors +ERROR: cannot define foreign key constraint, foreign keys from reference tables to local tables can only be defined with NO ACTION or RESTRICT behaviors ROLLBACK; BEGIN; SELECT create_reference_table('reference_table_2'); @@ -224,7 +224,7 @@ BEGIN; (1 row) ALTER TABLE reference_table_2 ADD CONSTRAINT fkey_local_to_ref FOREIGN KEY (col_1) REFERENCES local_table_2(col_1) ON UPDATE CASCADE; -ERROR: cannot define foreign key constraint, foreign keys from reference tables to citus local tables can only be defined with NO ACTION or RESTRICT behaviors +ERROR: cannot define foreign key constraint, foreign keys from reference tables to local tables can only be defined with NO ACTION or RESTRICT behaviors ROLLBACK; -- but we support such foreign key behaviors when foreign key is from -- citus local to reference table @@ -304,7 +304,7 @@ SELECT create_distributed_table('distributed_table', 'col_1'); CREATE TABLE local_table_5 ( col_1 INT UNIQUE REFERENCES distributed_table(col_1), FOREIGN KEY (col_1) REFERENCES reference_table_1(col_1)); -ERROR: cannot create foreign key constraint since foreign keys from reference tables and citus local tables to distributed tables are not supported +ERROR: cannot create foreign key constraint since foreign keys from reference tables and local tables to distributed tables are not supported BEGIN; ALTER TABLE distributed_table ADD CONSTRAINT fkey_11 FOREIGN KEY (col_1) REFERENCES reference_table_1(col_1); CREATE TABLE local_table_5 ( @@ -577,7 +577,7 @@ BEGIN; -- errors out as foreign keys from reference tables to citus local tables -- cannot have CASCADE behavior SELECT create_reference_table('local_table_1'); -ERROR: cannot define foreign key constraint, foreign keys from reference tables to citus local tables can only be defined with NO ACTION or RESTRICT behaviors +ERROR: cannot define foreign key constraint, foreign keys from reference tables to local tables can only be defined with NO ACTION or RESTRICT behaviors ROLLBACK; SET citus.enable_local_execution TO OFF; -- show that this errors out as it tries to convert connected relations to citus @@ -623,7 +623,7 @@ ORDER BY tablename; -- this errors out as we don't support creating citus local -- tables from partitioned tables CREATE TABLE part_local_table (col_1 INT REFERENCES reference_table_1(col_1)) PARTITION BY RANGE (col_1); -ERROR: cannot create citus local table "part_local_table", only regular tables and foreign tables are supported for citus local table creation +ERROR: cannot add local table "part_local_table" to metadata, only regular tables and foreign tables can be added to citus metadata -- they fail as col_99 does not exist CREATE TABLE local_table_5 (col_1 INT, FOREIGN KEY (col_99) REFERENCES reference_table_1(col_1)); ERROR: column "col_99" referenced in foreign key constraint does not exist diff --git a/src/test/regress/expected/foreign_key_restriction_enforcement.out b/src/test/regress/expected/foreign_key_restriction_enforcement.out index 79a599f4f..240f0bc5a 100644 --- a/src/test/regress/expected/foreign_key_restriction_enforcement.out +++ b/src/test/regress/expected/foreign_key_restriction_enforcement.out @@ -722,7 +722,7 @@ BEGIN; UPDATE reference_table SET id = 101 WHERE id = 99; ERROR: cannot modify table "reference_table" because there was a parallel operation on a distributed table -DETAIL: When there is a foreign key to a reference table or to a citus local table, Citus needs to perform all operations over a single connection per node to ensure consistency. +DETAIL: When there is a foreign key to a reference table or to a local table, Citus needs to perform all operations over a single connection per node to ensure consistency. HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; BEGIN; @@ -734,7 +734,7 @@ BEGIN; UPDATE transitive_reference_table SET id = 101 WHERE id = 99; ERROR: cannot modify table "transitive_reference_table" because there was a parallel operation on a distributed table -DETAIL: When there is a foreign key to a reference table or to a citus local table, Citus needs to perform all operations over a single connection per node to ensure consistency. +DETAIL: When there is a foreign key to a reference table or to a local table, Citus needs to perform all operations over a single connection per node to ensure consistency. HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; -- case 4.3: SELECT to a dist table is follwed by an unrelated DDL to a reference table @@ -1074,7 +1074,7 @@ BEGIN; UPDATE unrelated_dist_table SET value_1 = 15; UPDATE reference_table SET id = 101 WHERE id = 99; ERROR: cannot modify table "reference_table" because there was a parallel operation on a distributed table -DETAIL: When there is a foreign key to a reference table or to a citus local table, Citus needs to perform all operations over a single connection per node to ensure consistency. +DETAIL: When there is a foreign key to a reference table or to a local table, Citus needs to perform all operations over a single connection per node to ensure consistency. HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" UPDATE on_update_fkey_table SET value_1 = 5 WHERE id != 11; ERROR: current transaction is aborted, commands ignored until end of transaction block diff --git a/src/test/regress/expected/isolation_create_citus_local_table.out b/src/test/regress/expected/isolation_create_citus_local_table.out index 54877d3fa..7140c77c6 100644 --- a/src/test/regress/expected/isolation_create_citus_local_table.out +++ b/src/test/regress/expected/isolation_create_citus_local_table.out @@ -139,7 +139,7 @@ step s1-drop-table: DROP TABLE citus_local_table_1; step s2-create-citus-local-table-1: SELECT create_citus_local_table('citus_local_table_1'); step s1-commit: COMMIT; step s2-create-citus-local-table-1: <... completed> -error in steps s1-commit s2-create-citus-local-table-1: ERROR: cannot create citus local table, relation does not exist +error in steps s1-commit s2-create-citus-local-table-1: ERROR: cannot add local table to metadata, relation does not exist step s2-commit: COMMIT; master_remove_node diff --git a/src/test/regress/expected/multi_foreign_key.out b/src/test/regress/expected/multi_foreign_key.out index b628086ab..4cc52d894 100644 --- a/src/test/regress/expected/multi_foreign_key.out +++ b/src/test/regress/expected/multi_foreign_key.out @@ -835,8 +835,8 @@ SELECT create_distributed_table('referenced_by_reference_table', 'id'); CREATE TABLE reference_table(id int, referencing_column int REFERENCES referenced_by_reference_table(id)); SELECT create_reference_table('reference_table'); -ERROR: cannot create foreign key constraint since foreign keys from reference tables and citus local tables to distributed tables are not supported -DETAIL: Reference tables and citus local tables can only have foreign keys to reference tables and citus local tables +ERROR: cannot create foreign key constraint since foreign keys from reference tables and local tables to distributed tables are not supported +DETAIL: Reference tables and local tables can only have foreign keys to reference tables and local tables -- test foreign key creation on CREATE TABLE from + to reference table DROP TABLE reference_table; CREATE TABLE reference_table(id int PRIMARY KEY, referencing_column int); @@ -886,8 +886,8 @@ SELECT create_reference_table('reference_table'); (1 row) ALTER TABLE reference_table ADD CONSTRAINT fk FOREIGN KEY(referencing_column) REFERENCES referenced_by_reference_table(id); -ERROR: cannot create foreign key constraint since foreign keys from reference tables and citus local tables to distributed tables are not supported -DETAIL: Reference tables and citus local tables can only have foreign keys to reference tables and citus local tables +ERROR: cannot create foreign key constraint since foreign keys from reference tables and local tables to distributed tables are not supported +DETAIL: Reference tables and local tables can only have foreign keys to reference tables and local tables -- test foreign key creation on ALTER TABLE to reference table CREATE TABLE references_to_reference_table(id int, referencing_column int); SELECT create_distributed_table('references_to_reference_table', 'referencing_column'); diff --git a/src/test/regress/expected/multi_reference_table.out b/src/test/regress/expected/multi_reference_table.out index 22ab25eca..34453ede8 100644 --- a/src/test/regress/expected/multi_reference_table.out +++ b/src/test/regress/expected/multi_reference_table.out @@ -1196,8 +1196,8 @@ DEBUG: cannot perform distributed INSERT INTO ... SELECT because the partition DETAIL: The target table's partition column should correspond to a partition column in the subquery. DEBUG: performing repartitioned INSERT ... SELECT RESET client_min_messages; --- some tests for mark_tables_colocated --- should error out +-- some tests for mark_tables_colocated +-- should error out SELECT update_distributed_table_colocation('colocated_table_test_2', colocate_with => 'reference_table_test'); ERROR: relation reference_table_test should be a hash distributed table SELECT update_distributed_table_colocation('reference_table_test', colocate_with => 'reference_table_test_fifth'); @@ -1404,7 +1404,7 @@ ALTER TABLE reference_schema.reference_table_ddl_test RENAME TO reference_table_ -- cannot delete / drop shards from a reference table SELECT master_apply_delete_command('DELETE FROM reference_schema.reference_table_ddl'); ERROR: cannot delete from table -DETAIL: Delete statements on reference and citus local tables are not supported. +DETAIL: Delete statements on reference and local tables are not supported. -- cannot add shards SELECT master_create_empty_shard('reference_schema.reference_table_ddl'); ERROR: relation "reference_schema.reference_table_ddl" is a reference table @@ -1428,7 +1428,7 @@ SELECT master_update_shard_statistics(:a_shard_id); CREATE TABLE append_reference_tmp_table (id INT); SELECT master_append_table_to_shard(:a_shard_id, 'append_reference_tmp_table', 'localhost', :master_port); ERROR: cannot append to shardId xxxxxx -DETAIL: We currently don't support appending to shards in hash-partitioned, reference and citus local tables +DETAIL: We currently don't support appending to shards in hash-partitioned, reference and local tables SELECT master_get_table_ddl_events('reference_schema.reference_table_ddl'); master_get_table_ddl_events --------------------------------------------------------------------- diff --git a/src/test/regress/expected/ref_citus_local_fkeys.out b/src/test/regress/expected/ref_citus_local_fkeys.out index 9f47f4ff7..a0b77bcee 100644 --- a/src/test/regress/expected/ref_citus_local_fkeys.out +++ b/src/test/regress/expected/ref_citus_local_fkeys.out @@ -171,17 +171,17 @@ NOTICE: executing the command locally: SELECT worker_apply_inter_shard_ddl_comm ERROR: insert or update on table "reference_table_1506007" violates foreign key constraint "fkey_ref_to_local_1506007" -- we do not support CASCADE / SET NULL / SET DEFAULT behavior in "ALTER TABLE ADD fkey reference_table (to citus_local_table)" commands ALTER TABLE reference_table ADD CONSTRAINT fkey_ref_to_local FOREIGN KEY(r1) REFERENCES citus_local_table(l1) ON DELETE CASCADE; -ERROR: cannot define foreign key constraint, foreign keys from reference tables to citus local tables can only be defined with NO ACTION or RESTRICT behaviors +ERROR: cannot define foreign key constraint, foreign keys from reference tables to local tables can only be defined with NO ACTION or RESTRICT behaviors ALTER TABLE reference_table ADD CONSTRAINT fkey_ref_to_local FOREIGN KEY(r1) REFERENCES citus_local_table(l1) ON DELETE SET NULL; -ERROR: cannot define foreign key constraint, foreign keys from reference tables to citus local tables can only be defined with NO ACTION or RESTRICT behaviors +ERROR: cannot define foreign key constraint, foreign keys from reference tables to local tables can only be defined with NO ACTION or RESTRICT behaviors ALTER TABLE reference_table ADD CONSTRAINT fkey_ref_to_local FOREIGN KEY(r1) REFERENCES citus_local_table(l1) ON DELETE SET DEFAULT; -ERROR: cannot define foreign key constraint, foreign keys from reference tables to citus local tables can only be defined with NO ACTION or RESTRICT behaviors +ERROR: cannot define foreign key constraint, foreign keys from reference tables to local tables can only be defined with NO ACTION or RESTRICT behaviors ALTER TABLE reference_table ADD CONSTRAINT fkey_ref_to_local FOREIGN KEY(r1) REFERENCES citus_local_table(l1) ON UPDATE CASCADE; -ERROR: cannot define foreign key constraint, foreign keys from reference tables to citus local tables can only be defined with NO ACTION or RESTRICT behaviors +ERROR: cannot define foreign key constraint, foreign keys from reference tables to local tables can only be defined with NO ACTION or RESTRICT behaviors ALTER TABLE reference_table ADD CONSTRAINT fkey_ref_to_local FOREIGN KEY(r1) REFERENCES citus_local_table(l1) ON UPDATE SET NULL; -ERROR: cannot define foreign key constraint, foreign keys from reference tables to citus local tables can only be defined with NO ACTION or RESTRICT behaviors +ERROR: cannot define foreign key constraint, foreign keys from reference tables to local tables can only be defined with NO ACTION or RESTRICT behaviors ALTER TABLE reference_table ADD CONSTRAINT fkey_ref_to_local FOREIGN KEY(r1) REFERENCES citus_local_table(l1) ON UPDATE SET DEFAULT; -ERROR: cannot define foreign key constraint, foreign keys from reference tables to citus local tables can only be defined with NO ACTION or RESTRICT behaviors +ERROR: cannot define foreign key constraint, foreign keys from reference tables to local tables can only be defined with NO ACTION or RESTRICT behaviors INSERT INTO citus_local_table VALUES (3); NOTICE: executing the command locally: INSERT INTO ref_citus_local_fkeys.citus_local_table_1506006 (l1) VALUES (3) -- .. but we allow such foreign keys with RESTRICT behavior diff --git a/src/test/regress/output/multi_alter_table_statements.source b/src/test/regress/output/multi_alter_table_statements.source index d3d88f953..37b3ba1a9 100644 --- a/src/test/regress/output/multi_alter_table_statements.source +++ b/src/test/regress/output/multi_alter_table_statements.source @@ -999,7 +999,7 @@ SELECT value, count(*) FROM trigger_table GROUP BY value ORDER BY value; (1 row) ALTER TABLE trigger_table DISABLE TRIGGER ALL; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata INSERT INTO trigger_table VALUES (1, 'trigger disabled'); SELECT value, count(*) FROM trigger_table GROUP BY value ORDER BY value; value | count @@ -1008,7 +1008,7 @@ SELECT value, count(*) FROM trigger_table GROUP BY value ORDER BY value; (1 row) ALTER TABLE trigger_table ENABLE TRIGGER ALL; -ERROR: triggers are only supported for citus local tables +ERROR: triggers are only supported for local tables added to metadata INSERT INTO trigger_table VALUES (1, 'trigger disabled'); SELECT value, count(*) FROM trigger_table GROUP BY value ORDER BY value; value | count diff --git a/src/test/regress/output/multi_append_table_to_shard.source b/src/test/regress/output/multi_append_table_to_shard.source index c218bd9a3..7bd7af759 100644 --- a/src/test/regress/output/multi_append_table_to_shard.source +++ b/src/test/regress/output/multi_append_table_to_shard.source @@ -82,7 +82,7 @@ FROM pg_dist_shard WHERE 'multi_append_table_to_shard_right_reference_hash'::regclass::oid = logicalrelid; ERROR: cannot append to shardId 230001 -DETAIL: We currently don't support appending to shards in hash-partitioned, reference and citus local tables +DETAIL: We currently don't support appending to shards in hash-partitioned, reference and local tables -- Clean up after test SELECT master_apply_delete_command('DELETE FROM multi_append_table_to_shard_left'); master_apply_delete_command