From 760ae8f7c7fa2c1c5c8b4981eebbfc4088be4d8d Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 19 Oct 2020 11:13:45 +0200 Subject: [PATCH] Make procedure OUT parameters work with JDBC The JDBC driver sends OUT parameters with type void. This makes sense when calling a function, so that the parameters are ignored in ParseFuncOrColumn(). For a procedure call we want to treat them as unknown. --- src/backend/parser/parse_param.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/backend/parser/parse_param.c b/src/backend/parser/parse_param.c index 17a96abfa8..93c9d82d01 100644 --- a/src/backend/parser/parse_param.c +++ b/src/backend/parser/parse_param.c @@ -163,6 +163,15 @@ variable_paramref_hook(ParseState *pstate, ParamRef *pref) if (*pptype == InvalidOid) *pptype = UNKNOWNOID; + /* + * If the argument is of type void and it's procedure call, interpret it + * as unknown. This allows the JDBC driver to not have to distinguish + * function and procedure calls. See also another component of this hack + * in ParseFuncOrColumn(). + */ + if (*pptype == VOIDOID && pstate->p_expr_kind == EXPR_KIND_CALL_ARGUMENT) + *pptype = UNKNOWNOID; + param = makeNode(Param); param->paramkind = PARAM_EXTERN; param->paramid = paramno; -- 2.28.0