postgres.git / summary / log / commit / refs
commit dc68b9ec305fdf831b98a1d80b09753939fa4c59
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Mon Dec 05 04:13:53 2005 +0000
First released in: 8.2.0, 7.3.12, 7.4.10, 8.0.5, 8.1.1
Add regression test to see if the min/max values of int8 convert correctly.
src/test/regress/expected/int8-exp-three-digits.out | 17 +++++++++++++++++
src/test/regress/expected/int8.out | 17 +++++++++++++++++
src/test/regress/sql/int8.sql | 6 ++++++
3 files changed, 40 insertions(+)
diff --git a/src/test/regress/expected/int8-exp-three-digits.out b/src/test/regress/expected/int8-exp-three-digits.out
index ff147792621..e3697f8344f 100644
--- a/src/test/regress/expected/int8-exp-three-digits.out
+++ b/src/test/regress/expected/int8-exp-three-digits.out
@@ -300,3 +300,20 @@ SELECT '' AS to_char_17, to_char(q2, '999999SG9999999999') FROM INT8_TBL;
| 456789-0123456789
(5 rows)
+-- check min/max values
+select '-9223372036854775808'::int8;
+ int8
+----------------------
+ -9223372036854775808
+(1 row)
+
+select '-9223372036854775809'::int8;
+ERROR: value "-9223372036854775809" is out of range for type bigint
+select '9223372036854775807'::int8;
+ int8
+---------------------
+ 9223372036854775807
+(1 row)
+
+select '9223372036854775808'::int8;
+ERROR: value "9223372036854775808" is out of range for type bigint
diff --git a/src/test/regress/expected/int8.out b/src/test/regress/expected/int8.out
index c62d1330741..52cdabab749 100644
--- a/src/test/regress/expected/int8.out
+++ b/src/test/regress/expected/int8.out
@@ -300,3 +300,20 @@ SELECT '' AS to_char_17, to_char(q2, '999999SG9999999999') FROM INT8_TBL;
| 456789-0123456789
(5 rows)
+-- check min/max values
+select '-9223372036854775808'::int8;
+ int8
+----------------------
+ -9223372036854775808
+(1 row)
+
+select '-9223372036854775809'::int8;
+ERROR: value "-9223372036854775809" is out of range for type bigint
+select '9223372036854775807'::int8;
+ int8
+---------------------
+ 9223372036854775807
+(1 row)
+
+select '9223372036854775808'::int8;
+ERROR: value "9223372036854775808" is out of range for type bigint
diff --git a/src/test/regress/sql/int8.sql b/src/test/regress/sql/int8.sql
index 4642c012cdc..8ef92ba3f32 100644
--- a/src/test/regress/sql/int8.sql
+++ b/src/test/regress/sql/int8.sql
@@ -63,3 +63,9 @@ SELECT '' AS to_char_14, to_char(q2, 'FM9999999999999999.999') FROM INT8_TBL;
SELECT '' AS to_char_15, to_char(q2, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9') FROM INT8_TBL;
SELECT '' AS to_char_16, to_char(q2, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM INT8_TBL;
SELECT '' AS to_char_17, to_char(q2, '999999SG9999999999') FROM INT8_TBL;
+
+-- check min/max values
+select '-9223372036854775808'::int8;
+select '-9223372036854775809'::int8;
+select '9223372036854775807'::int8;
+select '9223372036854775808'::int8;
[parent: fcda95d98711]