diff --git a/src/backend/distributed/commands/citus_add_local_table_to_metadata.c b/src/backend/distributed/commands/citus_add_local_table_to_metadata.c index 882b663ed..4ed28709e 100644 --- a/src/backend/distributed/commands/citus_add_local_table_to_metadata.c +++ b/src/backend/distributed/commands/citus_add_local_table_to_metadata.c @@ -448,6 +448,15 @@ ErrorIfAddingPartitionTableToMetadata(Oid relationId) } +/* + * SetAutoConverted is the setter function for variable autoConverted. + */ +void SetAutoConverted(bool autoConvertedValue) +{ + autoConverted = autoConvertedValue; +} + + /* * ErrorIfUnsupportedCreateCitusLocalTable errors out if we cannot create the * citus local table from the relation. diff --git a/src/backend/distributed/commands/table.c b/src/backend/distributed/commands/table.c index 8ea36fdeb..5138d0483 100644 --- a/src/backend/distributed/commands/table.c +++ b/src/backend/distributed/commands/table.c @@ -1289,7 +1289,9 @@ ConvertPostgresLocalTablesToCitusLocalTables(AlterTableStmt *alterTableStatement } else { + SetAutoConverted(true); CreateCitusLocalTable(relationId, cascade); + SetAutoConverted(false); } } PG_CATCH(); diff --git a/src/include/distributed/commands.h b/src/include/distributed/commands.h index ba8ee6d31..e91c256b7 100644 --- a/src/include/distributed/commands.h +++ b/src/include/distributed/commands.h @@ -533,6 +533,7 @@ extern void ExecuteForeignKeyCreateCommandList(List *ddlCommandList, bool skip_validation); /* create_citus_local_table.c */ +extern void SetAutoConverted(bool autoConvertedValue); extern void CreateCitusLocalTable(Oid relationId, bool cascadeViaForeignKeys); extern List * GetExplicitIndexOidList(Oid relationId); diff --git a/src/test/regress/sql/citus_local_tables.sql b/src/test/regress/sql/citus_local_tables.sql index 730fc0d10..f0da8fb98 100644 --- a/src/test/regress/sql/citus_local_tables.sql +++ b/src/test/regress/sql/citus_local_tables.sql @@ -317,7 +317,7 @@ BEGIN; SET client_min_messages TO ERROR; SELECT remove_local_tables_from_metadata(); - -- should not see any citus local tables + -- should see only local_table_3, since it's the only one that is converted by the user SELECT logicalrelid::regclass::text FROM pg_dist_partition, pg_tables WHERE tablename=logicalrelid::regclass::text AND schemaname='citus_local_tables_test_schema' AND