*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/*
* 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))
/*
* 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))
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-40');
ERROR: type "real" value out of range: underflow
-- bad input
+INSERT INTO FLOAT4_TBL(f1) VALUES ('');
+ERROR: invalid input syntax for type real: ""
INSERT INTO FLOAT4_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type real: " "
INSERT INTO FLOAT4_TBL(f1) VALUES ('xyz');
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-40');
ERROR: type "real" value out of range: underflow
-- bad input
+INSERT INTO FLOAT4_TBL(f1) VALUES ('');
+ERROR: invalid input syntax for type real: ""
INSERT INTO FLOAT4_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type real: " "
INSERT INTO FLOAT4_TBL(f1) VALUES ('xyz');
SELECT '-10e-400'::float8;
ERROR: "-10e-400" is out of range for type double precision
-- bad input
+INSERT INTO FLOAT8_TBL(f1) VALUES ('');
+ERROR: invalid input syntax for type double precision: ""
INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type double precision: " "
INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
SELECT '-10e-400'::float8;
ERROR: "-10e-400" is out of range for type double precision
-- bad input
+INSERT INTO FLOAT8_TBL(f1) VALUES ('');
+ERROR: invalid input syntax for type double precision: ""
INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type double precision: " "
INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
(1 row)
-- bad input
+INSERT INTO FLOAT8_TBL(f1) VALUES ('');
+ERROR: invalid input syntax for type double precision: ""
INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type double precision: " "
INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
(1 row)
-- bad input
+INSERT INTO FLOAT8_TBL(f1) VALUES ('');
+ERROR: invalid input syntax for type double precision: ""
INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type double precision: " "
INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
SELECT '-10e-400'::float8;
ERROR: "-10e-400" is out of range for type double precision
-- bad input
+INSERT INTO FLOAT8_TBL(f1) VALUES ('');
+ERROR: invalid input syntax for type double precision: ""
INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
ERROR: invalid input syntax for type double precision: " "
INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
-- leading/trailing hard tab is also allowed
INSERT INTO OID_TBL(f1) VALUES (' 15 ');
-- bad inputs
+INSERT INTO OID_TBL(f1) VALUES ('');
+ERROR: invalid input syntax for type oid: ""
+INSERT INTO OID_TBL(f1) VALUES (' ');
+ERROR: invalid input syntax for type oid: " "
INSERT INTO OID_TBL(f1) VALUES ('asdfasd');
ERROR: invalid input syntax for type oid: "asdfasd"
INSERT INTO OID_TBL(f1) VALUES ('99asdfasd');
ERROR: invalid input syntax for type oid: " 5d"
INSERT INTO OID_TBL(f1) VALUES ('5 5');
ERROR: invalid input syntax for type oid: "5 5"
-INSERT INTO OID_TBL(f1) VALUES (' ');
-ERROR: invalid input syntax for type oid: " "
INSERT INTO OID_TBL(f1) VALUES (' - 500');
ERROR: invalid input syntax for type oid: " - 500"
INSERT INTO OID_TBL(f1) VALUES ('32958209582039852935');
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-40');
-- bad input
+INSERT INTO FLOAT4_TBL(f1) VALUES ('');
INSERT INTO FLOAT4_TBL(f1) VALUES (' ');
INSERT INTO FLOAT4_TBL(f1) VALUES ('xyz');
INSERT INTO FLOAT4_TBL(f1) VALUES ('5.0.0');
SELECT '-10e-400'::float8;
-- bad input
+INSERT INTO FLOAT8_TBL(f1) VALUES ('');
INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
INSERT INTO OID_TBL(f1) VALUES (' 15 ');
-- bad inputs
-
+INSERT INTO OID_TBL(f1) VALUES ('');
+INSERT INTO OID_TBL(f1) VALUES (' ');
INSERT INTO OID_TBL(f1) VALUES ('asdfasd');
INSERT INTO OID_TBL(f1) VALUES ('99asdfasd');
INSERT INTO OID_TBL(f1) VALUES ('5 d');
INSERT INTO OID_TBL(f1) VALUES (' 5d');
INSERT INTO OID_TBL(f1) VALUES ('5 5');
-INSERT INTO OID_TBL(f1) VALUES (' ');
INSERT INTO OID_TBL(f1) VALUES (' - 500');
INSERT INTO OID_TBL(f1) VALUES ('32958209582039852935');
INSERT INTO OID_TBL(f1) VALUES ('-23582358720398502385');