From 5dad5eddf2867c7376c9139630cc46b9f3003dee Mon Sep 17 00:00:00 2001 From: Tanzeel Khan <140405735+tanscorpio7@users.noreply.github.com> Date: Fri, 10 Nov 2023 15:52:27 +0530 Subject: [PATCH] fix conversion of varchar to binary varbinary and vice versa (#248) Release syscache reference when returning not null nodes from string literal hook to avoid cache reference leak Engine PR: #248 Extension PR: babelfish-for-postgresql/babelfish_extensions#1957 Task: 1940 Signed-off-by: Tanzeel Khan --- src/backend/parser/parse_coerce.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index b69d2bcc83e..b9058e9c76c 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -334,9 +334,11 @@ coerce_type(ParseState *pstate, Node *node, targetTypeMod, baseTypeMod, newcon, DatumGetCString(con->constvalue), ccontext, cformat, location); - if (result) /* runtimer error function returned */ + if (result) + { + ReleaseSysCache(baseType); return result; - + } /* * If the result is NULL, the newcon should be already updated properly. * Keep advancing the code.