Convert the function to a distributed function (#5596)

so that when metadata is synced, the table is on the worker
pull/5584/head
Önder Kalacı 2022-01-06 09:32:40 +01:00 committed by GitHub
parent 6d9218540b
commit 8007adda25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -70,6 +70,12 @@ CREATE OR REPLACE FUNCTION square(a INT) RETURNS INT AS $$
BEGIN BEGIN
RETURN a*a; RETURN a*a;
END; $$ LANGUAGE PLPGSQL STABLE; END; $$ LANGUAGE PLPGSQL STABLE;
SELECT create_distributed_function('square(int)');
create_distributed_function
---------------------------------------------------------------------
(1 row)
CREATE TABLE citus_local_table(a int, b int DEFAULT square(10)); CREATE TABLE citus_local_table(a int, b int DEFAULT square(10));
SELECT citus_add_local_table_to_metadata('citus_local_table'); SELECT citus_add_local_table_to_metadata('citus_local_table');
citus_add_local_table_to_metadata citus_add_local_table_to_metadata

View File

@ -278,8 +278,9 @@ test: foreign_key_to_reference_table
test: replicate_reference_tables_to_coordinator test: replicate_reference_tables_to_coordinator
test: turn_mx_off test: turn_mx_off
test: citus_local_tables test: citus_local_tables
test: multi_row_router_insert mixed_relkind_tests test: mixed_relkind_tests
test: turn_mx_on test: turn_mx_on
test: multi_row_router_insert
test: multi_reference_table citus_local_tables_queries test: multi_reference_table citus_local_tables_queries
test: citus_local_table_triggers test: citus_local_table_triggers
test: coordinator_shouldhaveshards test: coordinator_shouldhaveshards

View File

@ -37,7 +37,7 @@ CREATE OR REPLACE FUNCTION square(a INT) RETURNS INT AS $$
BEGIN BEGIN
RETURN a*a; RETURN a*a;
END; $$ LANGUAGE PLPGSQL STABLE; END; $$ LANGUAGE PLPGSQL STABLE;
SELECT create_distributed_function('square(int)');
CREATE TABLE citus_local_table(a int, b int DEFAULT square(10)); CREATE TABLE citus_local_table(a int, b int DEFAULT square(10));
SELECT citus_add_local_table_to_metadata('citus_local_table'); SELECT citus_add_local_table_to_metadata('citus_local_table');