summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/float.c
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2005-02-11 04:09:05 +0000
committerNeil Conway <neilc@samurai.com>2005-02-11 04:09:05 +0000
commit975e27377aadcabab6504155c091d27ea2fa4c53 (patch)
treecbf5435f931969d09543401af0c1d8bb5dcb3d56 /src/backend/utils/adt/float.c
parent4db84f0880716ece570db2debf99b773bfb82dd3 (diff)
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.
Diffstat (limited to 'src/backend/utils/adt/float.c')
-rw-r--r--src/backend/utils/adt/float.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index 4804445c32b..e51babfebfb 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.112 2004/12/31 22:01:21 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.113 2005/02/11 04:08:58 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -267,21 +267,12 @@ float4in(PG_FUNCTION_ARGS)
/*
* Check for an empty-string input to begin with, to avoid the
* vagaries of strtod() on different platforms.
- *
- * In releases prior to 8.0, we accepted an empty string as valid input
- * (yielding a float4 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 (*num == '\0')
- {
- ereport(WARNING,
- (errcode(ERRCODE_WARNING_DEPRECATED_FEATURE),
- errmsg("deprecated input syntax for type real: \"\""),
- errdetail("This input will be rejected in "
- "a future release of PostgreSQL.")));
- PG_RETURN_FLOAT4((float4) 0.0);
- }
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
+ errmsg("invalid input syntax for type real: \"%s\"",
+ orig_num)));
/* skip leading whitespace */
while (*num != '\0' && isspace((unsigned char) *num))
@@ -444,21 +435,12 @@ float8in(PG_FUNCTION_ARGS)
/*
* Check for an empty-string input to begin with, to avoid the
* vagaries of strtod() on different platforms.
- *
- * In releases prior to 8.0, we accepted an empty string as valid input
- * (yielding a float8 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 (*num == '\0')
- {
- ereport(WARNING,
- (errcode(ERRCODE_WARNING_DEPRECATED_FEATURE),
- errmsg("deprecated input syntax for type double precision: \"\""),
- errdetail("This input will be rejected in "
- "a future release of PostgreSQL.")));
- PG_RETURN_FLOAT8(0.0);
- }
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
+ errmsg("invalid input syntax for type double precision: \"%s\"",
+ orig_num)));
/* skip leading whitespace */
while (*num != '\0' && isspace((unsigned char) *num))