mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 02:37:31 +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:
@@ -17,6 +17,8 @@ ERROR: type "real" value out of range: underflow
|
||||
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');
|
||||
|
||||
@@ -17,6 +17,8 @@ ERROR: type "real" value out of range: underflow
|
||||
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');
|
||||
|
||||
@@ -17,6 +17,8 @@ ERROR: "10e-400" is out of range for type double precision
|
||||
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');
|
||||
|
||||
@@ -17,6 +17,8 @@ ERROR: "10e-400" is out of range for type double precision
|
||||
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');
|
||||
|
||||
@@ -25,6 +25,8 @@ SELECT '-10e-400'::float8;
|
||||
(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');
|
||||
|
||||
@@ -25,6 +25,8 @@ SELECT '-10e-400'::float8;
|
||||
(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');
|
||||
|
||||
@@ -17,6 +17,8 @@ ERROR: "10e-400" is out of range for type double precision
|
||||
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');
|
||||
|
||||
@@ -12,6 +12,10 @@ INSERT INTO OID_TBL(f1) VALUES (' 10 ');
|
||||
-- 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');
|
||||
@@ -22,8 +26,6 @@ INSERT INTO OID_TBL(f1) VALUES (' 5d');
|
||||
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');
|
||||
|
||||
@@ -17,6 +17,7 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-40');
|
||||
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');
|
||||
|
||||
@@ -17,6 +17,7 @@ SELECT '10e-400'::float8;
|
||||
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');
|
||||
|
||||
@@ -15,13 +15,13 @@ INSERT INTO OID_TBL(f1) VALUES (' 10 ');
|
||||
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');
|
||||
|
||||
Reference in New Issue
Block a user