Skip to content

Commit

Permalink
Add defaults for try_convert
Browse files Browse the repository at this point in the history
  • Loading branch information
robozmey committed Nov 27, 2024
1 parent 122d627 commit 1301ed7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions contrib/try_convert/try_convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ try_convert_via_io(Datum value, Oid sourceTypeId, Oid targetTypeId, bool *is_nul
}


// NO NULL INPUTS!!!!

Datum
try_convert(PG_FUNCTION_ARGS)
{
Expand Down Expand Up @@ -130,7 +128,11 @@ try_convert(PG_FUNCTION_ARGS)
is_null = fcinfo->isnull;
res = try_convert_via_io(value, sourceTypeId, targetTypeId, &is_null);
}

fcinfo->isnull = is_null;

if (is_null) {
fcinfo->isnull = fcinfo->argnull[1];
res = fcinfo->arg[1];
}

return res;
}

0 comments on commit 1301ed7

Please sign in to comment.