aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-03-15 16:20:52 +0000
committerBruce Momjian <bruce@momjian.us>2004-03-15 16:20:52 +0000
commitf744c0f76018d7d9acac560c584a29e3eb828a45 (patch)
treea5271fc5e3fb747b568479479d7de9dfdba53710 /src
parent3947f653f9cde924a430cc2044f6a1ab7e4d74ff (diff)
downloadpostgresql-f744c0f76018d7d9acac560c584a29e3eb828a45.tar.gz
postgresql-f744c0f76018d7d9acac560c584a29e3eb828a45.zip
float8-small-is-zero and float8-exp-three-digits will likely need
similar changes. Claudio Natoli
Diffstat (limited to 'src')
-rw-r--r--src/test/regress/expected/float4-exp-three-digits.out67
-rw-r--r--src/test/regress/expected/float8-exp-three-digits-win32.out76
-rw-r--r--src/test/regress/resultmap1
3 files changed, 144 insertions, 0 deletions
diff --git a/src/test/regress/expected/float4-exp-three-digits.out b/src/test/regress/expected/float4-exp-three-digits.out
index 9999939c7e5..01fabddcc57 100644
--- a/src/test/regress/expected/float4-exp-three-digits.out
+++ b/src/test/regress/expected/float4-exp-three-digits.out
@@ -16,6 +16,73 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-40');
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 ('xyz');
+ERROR: invalid input syntax for type real: "xyz"
+INSERT INTO FLOAT4_TBL(f1) VALUES ('5.0.0');
+ERROR: invalid input syntax for type real: "5.0.0"
+INSERT INTO FLOAT4_TBL(f1) VALUES ('5 . 0');
+ERROR: invalid input syntax for type real: "5 . 0"
+INSERT INTO FLOAT4_TBL(f1) VALUES ('5. 0');
+ERROR: invalid input syntax for type real: "5. 0"
+INSERT INTO FLOAT4_TBL(f1) VALUES (' - 3.0');
+ERROR: invalid input syntax for type real: " - 3.0"
+INSERT INTO FLOAT4_TBL(f1) VALUES ('123 5');
+ERROR: invalid input syntax for type real: "123 5"
+-- special inputs
+SELECT 'NaN'::float4;
+ float4
+--------
+ NaN
+(1 row)
+
+SELECT 'nan'::float4;
+ float4
+--------
+ NaN
+(1 row)
+
+SELECT ' NAN '::float4;
+ float4
+--------
+ NaN
+(1 row)
+
+SELECT 'infinity'::float4;
+ float4
+----------
+ Infinity
+(1 row)
+
+SELECT ' -INFINiTY '::float4;
+ float4
+-----------
+ -Infinity
+(1 row)
+
+-- bad special inputs
+SELECT 'N A N'::float4;
+ERROR: invalid input syntax for type real: "N A N"
+SELECT 'NaN x'::float4;
+ERROR: invalid input syntax for type real: "NaN x"
+SELECT ' INFINITY x'::float4;
+ERROR: invalid input syntax for type real: " INFINITY x"
+SELECT 'Infinity'::float4 + 100.0;
+ERROR: type "double precision" value out of range: overflow
+SELECT 'Infinity'::float4 / 'Infinity'::float4;
+ ?column?
+----------
+ NaN
+(1 row)
+
+SELECT 'nan'::float4 / 'nan'::float4;
+ ?column?
+----------
+ NaN
+(1 row)
+
SELECT '' AS five, FLOAT4_TBL.*;
five | f1
------+--------------
diff --git a/src/test/regress/expected/float8-exp-three-digits-win32.out b/src/test/regress/expected/float8-exp-three-digits-win32.out
index 209aa39d72f..db72898ba71 100644
--- a/src/test/regress/expected/float8-exp-three-digits-win32.out
+++ b/src/test/regress/expected/float8-exp-three-digits-win32.out
@@ -7,6 +7,82 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30');
INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84');
INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200');
INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
+-- test for underflow and overflow
+INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
+ERROR: "10e400" is out of range for type double precision
+INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
+ERROR: "-10e400" is out of range for type double precision
+INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
+ERROR: "10e-400" is out of range for type double precision
+INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
+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 ('xyz');
+ERROR: invalid input syntax for type double precision: "xyz"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
+ERROR: invalid input syntax for type double precision: "5.0.0"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
+ERROR: invalid input syntax for type double precision: "5 . 0"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0');
+ERROR: invalid input syntax for type double precision: "5. 0"
+INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3');
+ERROR: invalid input syntax for type double precision: " - 3"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5');
+ERROR: invalid input syntax for type double precision: "123 5"
+-- special inputs
+SELECT 'NaN'::float8;
+ float8
+--------
+ NaN
+(1 row)
+
+SELECT 'nan'::float8;
+ float8
+--------
+ NaN
+(1 row)
+
+SELECT ' NAN '::float8;
+ float8
+--------
+ NaN
+(1 row)
+
+SELECT 'infinity'::float8;
+ float8
+----------
+ Infinity
+(1 row)
+
+SELECT ' -INFINiTY '::float8;
+ float8
+-----------
+ -Infinity
+(1 row)
+
+-- bad special inputs
+SELECT 'N A N'::float8;
+ERROR: invalid input syntax for type double precision: "N A N"
+SELECT 'NaN x'::float8;
+ERROR: invalid input syntax for type double precision: "NaN x"
+SELECT ' INFINITY x'::float8;
+ERROR: invalid input syntax for type double precision: " INFINITY x"
+SELECT 'Infinity'::float8 + 100.0;
+ERROR: type "double precision" value out of range: overflow
+SELECT 'Infinity'::float8 / 'Infinity'::float8;
+ ?column?
+----------
+ NaN
+(1 row)
+
+SELECT 'nan'::float8 / 'nan'::float8;
+ ?column?
+----------
+ NaN
+(1 row)
+
SELECT '' AS five, FLOAT8_TBL.*;
five | f1
------+----------------------
diff --git a/src/test/regress/resultmap b/src/test/regress/resultmap
index 940e052ae88..c9e9439898d 100644
--- a/src/test/regress/resultmap
+++ b/src/test/regress/resultmap
@@ -25,6 +25,7 @@ horology/sparc-sun-solaris=horology-solaris-1947
horology/sparc-sun-sunos4.*=horology-no-DST-before-1970
horology/.*-sysv5=horology-solaris-1947
horology/.*-sco=horology-solaris-1947
+horology/win32=horology-no-DST-before-1970
int8/.*-qnx=int8-exp-three-digits
int8/win32=int8-exp-three-digits-win32
tinterval/.*-aix4=tinterval-solaris-1947