diff --git a/contrib/try_convert/try_convert.c b/contrib/try_convert/try_convert.c index 5268a65747..4d922594f9 100644 --- a/contrib/try_convert/try_convert.c +++ b/contrib/try_convert/try_convert.c @@ -57,7 +57,7 @@ try_convert_from_pg_cast(Datum value, Oid sourceTypeId, Oid targetTypeId, bool * { ReleaseSysCache(tuple); - is_null = true; + *is_null = true; FlushErrorState(); /// TODO replace } PG_END_TRY(); @@ -101,7 +101,7 @@ try_convert_via_io(Datum value, Oid sourceTypeId, Oid targetTypeId, bool *is_nul } PG_CATCH(); { - is_null = true; + *is_null = true; FlushErrorState(); /// TODO replace } @@ -129,21 +129,10 @@ try_convert(PG_FUNCTION_ARGS) if (sourceTypeId == targetTypeId) return fcinfo->arg[0]; - Oid infunc; - bool typisvarlena; - - getTypeInputInfo(targetTypeId, &infunc, &typisvarlena); Datum res = 0; bool is_null = fcinfo->isnull; - res = try_convert_from_pg_cast(fcinfo->arg[0], sourceTypeId, targetTypeId, &is_null); - - if (!is_null) - return res; - - is_null = fcinfo->isnull; - if (TypeCategory(sourceTypeId) == TYPCATEGORY_STRING || TypeCategory(targetTypeId) == TYPCATEGORY_STRING) res = try_convert_via_io(fcinfo->arg[0], sourceTypeId, targetTypeId, &is_null); diff --git a/src/backend/utils/misc/try_cast.c b/src/backend/utils/misc/try_cast.c index 002e652051..94784ea4be 100644 --- a/src/backend/utils/misc/try_cast.c +++ b/src/backend/utils/misc/try_cast.c @@ -27,7 +27,7 @@ try_cast(PG_FUNCTION_ARGS) { fcinfo->isnull = true; - FlushErrorState(); + FlushErrorState(); /// TODO replace } PG_END_TRY();