mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
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
This commit is contained in:
@@ -285,7 +285,7 @@ buf_finalize(StringInfo buf)
|
||||
* parse snapshot from cstring
|
||||
*/
|
||||
static pg_snapshot *
|
||||
parse_snapshot(const char *str)
|
||||
parse_snapshot(const char *str, Node *escontext)
|
||||
{
|
||||
FullTransactionId xmin;
|
||||
FullTransactionId xmax;
|
||||
@@ -341,11 +341,10 @@ parse_snapshot(const char *str)
|
||||
return buf_finalize(buf);
|
||||
|
||||
bad_format:
|
||||
ereport(ERROR,
|
||||
ereturn(escontext, NULL,
|
||||
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
|
||||
errmsg("invalid input syntax for type %s: \"%s\"",
|
||||
"pg_snapshot", str_start)));
|
||||
return NULL; /* keep compiler quiet */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -447,7 +446,7 @@ pg_snapshot_in(PG_FUNCTION_ARGS)
|
||||
char *str = PG_GETARG_CSTRING(0);
|
||||
pg_snapshot *snap;
|
||||
|
||||
snap = parse_snapshot(str);
|
||||
snap = parse_snapshot(str, fcinfo->context);
|
||||
|
||||
PG_RETURN_POINTER(snap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user