Introduces macros for functions that now have include_out_arguments argument

New macros: FuncnameGetCandidates_compat and expand_function_arguments_compat

The functions (the ones without _compat) now have a new bool include_out_arguments parameter
These new macros give us the ability to use this new parameter for PG14 and it doesn't give the parameter for previous versions
Existing include_out_arguments parameters are set to 'false' to keep current behavior

Relevant PG commit:
e56bce5d43789cce95d099554ae9593ada92b3b7
pull/5209/head
Halil Ozan Akgul 2021-08-12 13:16:42 +03:00 committed by Sait Talha Nisanci
parent 347ae2928f
commit ebf1b7e23f
5 changed files with 22 additions and 10 deletions

View File

@ -1808,8 +1808,8 @@ GenerateBackupNameForProcCollision(const ObjectAddress *address)
List *newProcName = list_make2(namespace, makeString(newName));
/* don't need to rename if the input arguments don't match */
FuncCandidateList clist = FuncnameGetCandidates(newProcName, numargs, NIL, false,
false, true);
FuncCandidateList clist = FuncnameGetCandidates_compat(newProcName, numargs, NIL,
false, false, false, true);
for (; clist; clist = clist->next)
{
if (memcmp(clist->args, argtypes, sizeof(Oid) * numargs) == 0)

View File

@ -3585,8 +3585,8 @@ static Oid
CitusFunctionOidWithSignature(char *functionName, int numargs, Oid *argtypes)
{
List *aggregateName = list_make2(makeString("pg_catalog"), makeString(functionName));
FuncCandidateList clist = FuncnameGetCandidates(aggregateName, numargs, NIL, false,
false, true);
FuncCandidateList clist = FuncnameGetCandidates_compat(aggregateName, numargs, NIL,
false, false, false, true);
for (; clist; clist = clist->next)
{

View File

@ -12,6 +12,7 @@
#include "distributed/insert_select_planner.h"
#include "distributed/metadata_cache.h"
#include "distributed/multi_router_planner.h"
#include "distributed/version_compat.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
@ -526,8 +527,9 @@ FixFunctionArgumentsWalker(Node *expr, void *context)
elog(ERROR, "cache lookup failed for function %u", funcExpr->funcid);
}
funcExpr->args = expand_function_arguments(funcExpr->args,
funcExpr->funcresulttype, func_tuple);
funcExpr->args = expand_function_arguments_compat(funcExpr->args, false,
funcExpr->funcresulttype,
func_tuple);
ReleaseSysCache(func_tuple);
}

View File

@ -45,10 +45,14 @@ FunctionOidExtended(const char *schemaName, const char *functionName, int argume
const bool findVariadics = false;
const bool findDefaults = false;
FuncCandidateList functionList = FuncnameGetCandidates(qualifiedFunctionNameList,
argumentCount,
argumentList, findVariadics,
findDefaults, true);
FuncCandidateList functionList = FuncnameGetCandidates_compat(
qualifiedFunctionNameList,
argumentCount,
argumentList,
findVariadics,
findDefaults,
false,
true);
if (functionList == NULL)
{

View File

@ -40,6 +40,9 @@
/* for MemoryContextMethods->stats */
#define stats_compat(a, b, c, d, e) stats(a, b, c, d, e)
#define FuncnameGetCandidates_compat(a, b, c, d, e, f, g) \
FuncnameGetCandidates(a, b, c, d, e, f, g)
#define expand_function_arguments_compat(a, b, c, d) expand_function_arguments(a, b, c, d)
#else
#define AlterTableStmtObjType(a) ((a)->relkind)
#define F_NEXTVAL_COMPAT F_NEXTVAL_OID
@ -50,6 +53,9 @@
/* for MemoryContextMethods->stats */
#define stats_compat(a, b, c, d, e) stats(a, b, c, d)
#define FuncnameGetCandidates_compat(a, b, c, d, e, f, g) \
FuncnameGetCandidates(a, b, c, d, e, g)
#define expand_function_arguments_compat(a, b, c, d) expand_function_arguments(a, c, d)
#endif
#if PG_VERSION_NUM >= PG_VERSION_13