diff --git a/src/backend/distributed/deparser/deparse_function_stmts.c b/src/backend/distributed/deparser/deparse_function_stmts.c index f0b61db18..d58faabfb 100644 --- a/src/backend/distributed/deparser/deparse_function_stmts.c +++ b/src/backend/distributed/deparser/deparse_function_stmts.c @@ -59,6 +59,7 @@ static void AppendDefElemParallel(StringInfo buf, DefElem *def); static void AppendDefElemCost(StringInfo buf, DefElem *def); static void AppendDefElemRows(StringInfo buf, DefElem *def); static void AppendDefElemSet(StringInfo buf, DefElem *def); +static void AppendDefElemSupport(StringInfo buf, DefElem *def); static void AppendVarSetValue(StringInfo buf, VariableSetStmt *setStmt); static void AppendRenameFunctionStmt(StringInfo buf, RenameStmt *stmt); @@ -179,6 +180,10 @@ AppendDefElem(StringInfo buf, DefElem *def) { AppendDefElemSet(buf, def); } + else if (strcmp(def->defname, "support") == 0) + { + AppendDefElemSupport(buf, def); + } } @@ -282,6 +287,16 @@ AppendDefElemSet(StringInfo buf, DefElem *def) } +/* + * AppendDefElemSupport appends a string representing the DefElem to a buffer + */ +static void +AppendDefElemSupport(StringInfo buf, DefElem *def) +{ + appendStringInfo(buf, " SUPPORT %s", defGetString(def)); +} + + /* * AppendVariableSet appends a string representing the VariableSetStmt to a buffer */ diff --git a/src/test/regress/expected/function_propagation.out b/src/test/regress/expected/function_propagation.out index ab230a8a1..297199a98 100644 --- a/src/test/regress/expected/function_propagation.out +++ b/src/test/regress/expected/function_propagation.out @@ -1290,6 +1290,14 @@ WARNING: "function pg_temp_xxx.temp_func(bigint)" has dependency on unsupported DETAIL: "function pg_temp_xxx.temp_func(bigint)" will be created only locally SELECT create_distributed_function('pg_temp.temp_func(BIGINT)'); ERROR: "function pg_temp_xxx.temp_func(bigint)" has dependency on unsupported object "schema pg_temp_xxx" +-- Show that support functions are supported +CREATE FUNCTION func_with_support(int, int) RETURNS bool + LANGUAGE internal STRICT IMMUTABLE PARALLEL SAFE + AS $$int4eq$$ SUPPORT generate_series_int8_support; +CREATE FUNCTION func_with_support_2(int, int) RETURNS bool + LANGUAGE internal STRICT IMMUTABLE PARALLEL SAFE + AS $$int4eq$$; +ALTER FUNCTION func_with_support_2(int, int) SUPPORT generate_series_int8_support; RESET search_path; SET client_min_messages TO WARNING; DROP SCHEMA function_propagation_schema CASCADE; diff --git a/src/test/regress/sql/function_propagation.sql b/src/test/regress/sql/function_propagation.sql index 575f6a985..eab7927e4 100644 --- a/src/test/regress/sql/function_propagation.sql +++ b/src/test/regress/sql/function_propagation.sql @@ -842,6 +842,17 @@ $$ LANGUAGE SQL STABLE; SELECT create_distributed_function('pg_temp.temp_func(BIGINT)'); +-- Show that support functions are supported +CREATE FUNCTION func_with_support(int, int) RETURNS bool + LANGUAGE internal STRICT IMMUTABLE PARALLEL SAFE + AS $$int4eq$$ SUPPORT generate_series_int8_support; + +CREATE FUNCTION func_with_support_2(int, int) RETURNS bool + LANGUAGE internal STRICT IMMUTABLE PARALLEL SAFE + AS $$int4eq$$; + +ALTER FUNCTION func_with_support_2(int, int) SUPPORT generate_series_int8_support; + RESET search_path; SET client_min_messages TO WARNING; DROP SCHEMA function_propagation_schema CASCADE;