diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-12-14 17:50:24 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-12-14 17:50:24 -0500 |
commit | 47f3f97fcdee28e3eb70cd2ebfd7b4899570b018 (patch) | |
tree | 443f2edbb1c19fe1925f87f30e0edf66bc557b30 /src/backend/utils/adt/tid.c | |
parent | 332741e73980401895e027eb697bb472860036fb (diff) |
Convert a few more datatype input functions to report errors softly.
Convert assorted internal-ish datatypes, namely aclitemin,
int2vectorin, oidin, oidvectorin, pg_lsn_in, pg_snapshot_in,
and tidin to the new style.
(Some others you might expect to find in this group, such as
cidin and xidin, need no changes because they never throw
errors at all. That seems a little cheesy ... but it is not in
the charter of this patch series to add new error conditions.)
Amul Sul, minor mods by me
Discussion: https://postgr.es/m/CAAJ_b97KeDWUdpTKGOaFYPv0OicjOu6EW+QYWj-Ywrgj_aEy1g@mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/tid.c')
-rw-r--r-- | src/backend/utils/adt/tid.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c index 83ac589f957..4dc1b327bf3 100644 --- a/src/backend/utils/adt/tid.c +++ b/src/backend/utils/adt/tid.c @@ -57,6 +57,7 @@ Datum tidin(PG_FUNCTION_ARGS) { char *str = PG_GETARG_CSTRING(0); + Node *escontext = fcinfo->context; char *p, *coord[NTIDARGS]; int i; @@ -71,7 +72,7 @@ tidin(PG_FUNCTION_ARGS) coord[i++] = p + 1; if (i < NTIDARGS) - ereport(ERROR, + ereturn(escontext, (Datum) 0, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s: \"%s\"", "tid", str))); @@ -79,7 +80,7 @@ tidin(PG_FUNCTION_ARGS) errno = 0; cvt = strtoul(coord[0], &badp, 10); if (errno || *badp != DELIM) - ereport(ERROR, + ereturn(escontext, (Datum) 0, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s: \"%s\"", "tid", str))); @@ -93,7 +94,7 @@ tidin(PG_FUNCTION_ARGS) #if SIZEOF_LONG > 4 if (cvt != (unsigned long) blockNumber && cvt != (unsigned long) ((int32) blockNumber)) - ereport(ERROR, + ereturn(escontext, (Datum) 0, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s: \"%s\"", "tid", str))); @@ -102,7 +103,7 @@ tidin(PG_FUNCTION_ARGS) cvt = strtoul(coord[1], &badp, 10); if (errno || *badp != RDELIM || cvt > USHRT_MAX) - ereport(ERROR, + ereturn(escontext, (Datum) 0, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s: \"%s\"", "tid", str))); |