Affects: 5.2.8.RELEASE
When using PostgreSQL driver 42.2.11 and higher and spring-jdbc version 5.2.8.RELEASE and calling Postgresql function then CallMetaDataContext.actualFunctionReturnName from function metadata is not set.
Related to issue # 25399 there was a split in GenericCallMetaDataProvider:
function?
databaseMetaData.getFunctionColumns (metaDataCatalogName, metaDataSchemaName, metaDataProcedureName, null):
databaseMetaData.getProcedureColumns (metaDataCatalogName, metaDataSchemaName, metaDataProcedureName, null)
And for functions it returns columnType = 4, previously it returned columnType = 5.
Because of this, the condition is not met in CallMetaDataContext.reconcileParameters:
if (meta.isReturnParameter()) {
// DatabaseMetaData.procedureColumnReturn or possibly procedureColumnResult
if (!isFunction() && !isReturnValueRequired() && paramName != null &&
provider.byPassReturnParameter(paramName)) {
if (logger.isDebugEnabled()) {
logger.debug("Bypassing meta-data return parameter for '" + paramName + "'");
}
}
else {
String returnNameToUse =
(StringUtils.hasLength(paramNameToUse) ? paramNameToUse : getFunctionReturnName());
workParams.add(provider.createDefaultOutParameter(returnNameToUse, meta));
if (isFunction()) {
setFunctionReturnName(returnNameToUse);
outParamNames.add(returnNameToUse);
}
if (logger.isDebugEnabled()) {
logger.debug("Added meta-data return parameter for '" + returnNameToUse + "'");
}
}
}
and setFunctionReturnName is not called. It is not executed because isReturnParameter looks like:
public boolean isReturnParameter() {
return (this.parameterType == DatabaseMetaData.procedureColumnReturn ||
this.parameterType == DatabaseMetaData.procedureColumnResult);
}
Only the type of parameters for the procedure are checked.
Because of this, the output parameter for the function is passed in the metadata as returnValue, setFunctionReturnName is not called, and spring uses the default name return, and does not find such a parameter in the results.
Affects: 5.2.8.RELEASE
When using PostgreSQL driver 42.2.11 and higher and spring-jdbc version 5.2.8.RELEASE and calling Postgresql function then
CallMetaDataContext.actualFunctionReturnNamefrom function metadata is not set.Related to issue # 25399 there was a split in GenericCallMetaDataProvider:
And for functions it returns columnType = 4, previously it returned columnType = 5.
Because of this, the condition is not met in
CallMetaDataContext.reconcileParameters:and
setFunctionReturnNameis not called. It is not executed becauseisReturnParameterlooks like:Only the type of parameters for the procedure are checked.
Because of this, the output parameter for the function is passed in the metadata as
returnValue,setFunctionReturnNameis not called, and spring uses the default namereturn, and does not find such a parameter in the results.