1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-20 05:03:10 +03:00

Adjust input routines for float4, float8 and oid to reject the empty string

as valid input (it was previously treated as 0). This input was deprecated
in 8.0 (and a warning was emitted). Regression tests updated.
This commit is contained in:
Neil Conway
2005-02-11 04:09:05 +00:00
parent 4db84f0880
commit 975e27377a
13 changed files with 36 additions and 43 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.60 2004/12/31 22:01:22 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.61 2005/02/11 04:08:58 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -33,18 +33,11 @@ oidin_subr(const char *funcname, const char *s, char **endloc)
char *endptr;
Oid result;
/*
* In releases prior to 8.0, we accepted an empty string as valid
* input (yielding an OID of 0). In 8.0, we accept empty strings, but
* emit a warning noting that the feature is deprecated. In 8.1+, the
* warning should be replaced by an error.
*/
if (*s == '\0')
ereport(WARNING,
(errcode(ERRCODE_WARNING_DEPRECATED_FEATURE),
errmsg("deprecated input syntax for type oid: \"\""),
errdetail("This input will be rejected in "
"a future release of PostgreSQL.")));
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("invalid input syntax for type oid: \"%s\"",
s)));
errno = 0;
cvt = strtoul(s, &endptr, 10);