Add support for deparsing ALTER FUNCION ... SUPPORT ... commands

pull/5849/head
Burak Velioglu 2022-03-22 18:06:10 +03:00
parent 0ba334626b
commit db9f0d926c
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
3 changed files with 34 additions and 0 deletions

View File

@ -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
*/

View File

@ -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;

View File

@ -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;