Skip to content

Commit

Permalink
Fix ERRORDATA_STACK cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
robozmey committed Nov 26, 2024
1 parent 90bf691 commit 3aae248
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/backend/utils/misc/try_cast.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ try_cast(PG_FUNCTION_ARGS)

Datum funcId = PG_GETARG_DATUM(1);

Datum res = 0;

PG_TRY();
{
Datum res = OidFunctionCall1(funcId, value);

PG_RETURN_DATUM(res);
res = OidFunctionCall1(funcId, value);
}
PG_CATCH();
{
PG_RETURN_NULL();
fcinfo->isnull = true;

FlushErrorState();
}
PG_END_TRY();

PG_RETURN_DATUM(res);
}

0 comments on commit 3aae248

Please sign in to comment.