summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane2004-10-04 14:42:48 +0000
committerTom Lane2004-10-04 14:42:48 +0000
commit4171bb869f234281a13bb862d3b1e577bf336242 (patch)
treee8193f7be04ddd942f13811ef9bbe0494d24920d /src/test
parent24201b4bc60e46e8de031fb5911af32bdb412d43 (diff)
Detect overflow in integer arithmetic operators (integer, smallint, and
bigint variants). Clean up some inconsistencies in error message wording. Fix scanint8 to allow trailing whitespace in INT64_MIN case. Update int8-exp-three-digits.out, which seems to have been ignored by the last couple of people to modify the int8 regression test, and remove int8-exp-three-digits-win32.out which is thereby exposed as redundant.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/int2.out43
-rw-r--r--src/test/regress/expected/int4.out82
-rw-r--r--src/test/regress/expected/int8-exp-three-digits-win32.out300
-rw-r--r--src/test/regress/expected/int8-exp-three-digits.out45
-rw-r--r--src/test/regress/expected/int8.out16
-rw-r--r--src/test/regress/expected/subselect.out3
-rw-r--r--src/test/regress/resultmap2
-rw-r--r--src/test/regress/sql/int2.sql9
-rw-r--r--src/test/regress/sql/int4.sql18
-rw-r--r--src/test/regress/sql/int8.sql1
-rw-r--r--src/test/regress/sql/subselect.sql3
11 files changed, 143 insertions, 379 deletions
diff --git a/src/test/regress/expected/int2.out b/src/test/regress/expected/int2.out
index 64e5bf58a8c..f72aeb278ae 100644
--- a/src/test/regress/expected/int2.out
+++ b/src/test/regress/expected/int2.out
@@ -14,7 +14,7 @@ INSERT INTO INT2_TBL(f1) VALUES ('32767');
INSERT INTO INT2_TBL(f1) VALUES ('-32767');
-- bad input values -- should give errors
INSERT INTO INT2_TBL(f1) VALUES ('100000');
-ERROR: value "100000" is out of range for type shortint
+ERROR: value "100000" is out of range for type smallint
INSERT INTO INT2_TBL(f1) VALUES ('asdf');
ERROR: invalid input syntax for integer: "asdf"
INSERT INTO INT2_TBL(f1) VALUES (' ');
@@ -144,14 +144,15 @@ SELECT '' AS three, i.* FROM INT2_TBL i WHERE (i.f1 % int4 '2') = int2 '0';
(3 rows)
SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i;
- five | f1 | x
-------+--------+-------
- | 0 | 0
- | 1234 | 2468
- | -1234 | -2468
- | 32767 | -2
- | -32767 | 2
-(5 rows)
+ERROR: smallint out of range
+SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i
+WHERE abs(f1) < 16384;
+ five | f1 | x
+------+-------+-------
+ | 0 | 0
+ | 1234 | 2468
+ | -1234 | -2468
+(3 rows)
SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT2_TBL i;
five | f1 | x
@@ -164,14 +165,16 @@ SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT2_TBL i;
(5 rows)
SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i;
+ERROR: smallint out of range
+SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i
+WHERE f1 < 32766;
five | f1 | x
------+--------+--------
| 0 | 2
| 1234 | 1236
| -1234 | -1232
- | 32767 | -32767
| -32767 | -32765
-(5 rows)
+(4 rows)
SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT2_TBL i;
five | f1 | x
@@ -184,14 +187,16 @@ SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT2_TBL i;
(5 rows)
SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i;
- five | f1 | x
-------+--------+-------
- | 0 | -2
- | 1234 | 1232
- | -1234 | -1236
- | 32767 | 32765
- | -32767 | 32767
-(5 rows)
+ERROR: smallint out of range
+SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i
+WHERE f1 > -32767;
+ five | f1 | x
+------+-------+-------
+ | 0 | -2
+ | 1234 | 1232
+ | -1234 | -1236
+ | 32767 | 32765
+(4 rows)
SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT2_TBL i;
five | f1 | x
diff --git a/src/test/regress/expected/int4.out b/src/test/regress/expected/int4.out
index e5d930e31e0..0e6049f29a8 100644
--- a/src/test/regress/expected/int4.out
+++ b/src/test/regress/expected/int4.out
@@ -144,64 +144,74 @@ SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % int4 '2') = int2 '0';
(3 rows)
SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i;
- five | f1 | x
-------+-------------+---------
- | 0 | 0
- | 123456 | 246912
- | -123456 | -246912
- | 2147483647 | -2
- | -2147483647 | 2
-(5 rows)
+ERROR: integer out of range
+SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i
+WHERE abs(f1) < 1073741824;
+ five | f1 | x
+------+---------+---------
+ | 0 | 0
+ | 123456 | 246912
+ | -123456 | -246912
+(3 rows)
SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i;
- five | f1 | x
-------+-------------+---------
- | 0 | 0
- | 123456 | 246912
- | -123456 | -246912
- | 2147483647 | -2
- | -2147483647 | 2
-(5 rows)
+ERROR: integer out of range
+SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i
+WHERE abs(f1) < 1073741824;
+ five | f1 | x
+------+---------+---------
+ | 0 | 0
+ | 123456 | 246912
+ | -123456 | -246912
+(3 rows)
SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i;
+ERROR: integer out of range
+SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i
+WHERE f1 < 2147483646;
five | f1 | x
------+-------------+-------------
| 0 | 2
| 123456 | 123458
| -123456 | -123454
- | 2147483647 | -2147483647
| -2147483647 | -2147483645
-(5 rows)
+(4 rows)
SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i;
+ERROR: integer out of range
+SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i
+WHERE f1 < 2147483646;
five | f1 | x
------+-------------+-------------
| 0 | 2
| 123456 | 123458
| -123456 | -123454
- | 2147483647 | -2147483647
| -2147483647 | -2147483645
-(5 rows)
+(4 rows)
SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i;
- five | f1 | x
-------+-------------+------------
- | 0 | -2
- | 123456 | 123454
- | -123456 | -123458
- | 2147483647 | 2147483645
- | -2147483647 | 2147483647
-(5 rows)
+ERROR: integer out of range
+SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i
+WHERE f1 > -2147483647;
+ five | f1 | x
+------+------------+------------
+ | 0 | -2
+ | 123456 | 123454
+ | -123456 | -123458
+ | 2147483647 | 2147483645
+(4 rows)
SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i;
- five | f1 | x
-------+-------------+------------
- | 0 | -2
- | 123456 | 123454
- | -123456 | -123458
- | 2147483647 | 2147483645
- | -2147483647 | 2147483647
-(5 rows)
+ERROR: integer out of range
+SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i
+WHERE f1 > -2147483647;
+ five | f1 | x
+------+------------+------------
+ | 0 | -2
+ | 123456 | 123454
+ | -123456 | -123458
+ | 2147483647 | 2147483645
+(4 rows)
SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT4_TBL i;
five | f1 | x
diff --git a/src/test/regress/expected/int8-exp-three-digits-win32.out b/src/test/regress/expected/int8-exp-three-digits-win32.out
deleted file mode 100644
index c766ee52987..00000000000
--- a/src/test/regress/expected/int8-exp-three-digits-win32.out
+++ /dev/null
@@ -1,300 +0,0 @@
---
--- INT8
--- Test int8 64-bit integers.
---
-CREATE TABLE INT8_TBL(q1 int8, q2 int8);
-INSERT INTO INT8_TBL VALUES('123','456');
-INSERT INTO INT8_TBL VALUES('123','4567890123456789');
-INSERT INTO INT8_TBL VALUES('4567890123456789','123');
-INSERT INTO INT8_TBL VALUES('4567890123456789','4567890123456789');
-INSERT INTO INT8_TBL VALUES('4567890123456789','-4567890123456789');
--- bad inputs
-INSERT INTO INT8_TBL(q1) VALUES (' ');
-ERROR: invalid input syntax for type bigint: " "
-INSERT INTO INT8_TBL(q1) VALUES ('xxx');
-ERROR: invalid input syntax for type bigint: "xxx"
-INSERT INTO INT8_TBL(q1) VALUES ('3908203590239580293850293850329485');
-ERROR: integer out of range
-INSERT INTO INT8_TBL(q1) VALUES ('-1204982019841029840928340329840934');
-ERROR: integer out of range
-INSERT INTO INT8_TBL(q1) VALUES ('- 123');
-ERROR: invalid input syntax for type bigint: "- 123"
-INSERT INTO INT8_TBL(q1) VALUES (' 345 5');
-ERROR: invalid input syntax for type bigint: " 345 5"
-INSERT INTO INT8_TBL(q1) VALUES ('');
-ERROR: invalid input syntax for type bigint: ""
-SELECT * FROM INT8_TBL;
- q1 | q2
-------------------+-------------------
- 123 | 456
- 123 | 4567890123456789
- 4567890123456789 | 123
- 4567890123456789 | 4567890123456789
- 4567890123456789 | -4567890123456789
-(5 rows)
-
-SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL;
- five | plus | minus
-------+------------------+-------------------
- | 123 | -123
- | 123 | -123
- | 4567890123456789 | -4567890123456789
- | 4567890123456789 | -4567890123456789
- | 4567890123456789 | -4567890123456789
-(5 rows)
-
-SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL;
- five | q1 | q2 | plus
-------+------------------+-------------------+------------------
- | 123 | 456 | 579
- | 123 | 4567890123456789 | 4567890123456912
- | 4567890123456789 | 123 | 4567890123456912
- | 4567890123456789 | 4567890123456789 | 9135780246913578
- | 4567890123456789 | -4567890123456789 | 0
-(5 rows)
-
-SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL;
- five | q1 | q2 | minus
-------+------------------+-------------------+-------------------
- | 123 | 456 | -333
- | 123 | 4567890123456789 | -4567890123456666
- | 4567890123456789 | 123 | 4567890123456666
- | 4567890123456789 | 4567890123456789 | 0
- | 4567890123456789 | -4567890123456789 | 9135780246913578
-(5 rows)
-
-SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL
- WHERE q1 < 1000 or (q2 > 0 and q2 < 1000);
- three | q1 | q2 | multiply
--------+------------------+------------------+--------------------
- | 123 | 456 | 56088
- | 123 | 4567890123456789 | 561850485185185047
- | 4567890123456789 | 123 | 561850485185185047
-(3 rows)
-
-SELECT '' AS five, q1, q2, q1 / q2 AS divide FROM INT8_TBL;
- five | q1 | q2 | divide
-------+------------------+-------------------+----------------
- | 123 | 456 | 0
- | 123 | 4567890123456789 | 0
- | 4567890123456789 | 123 | 37137318076884
- | 4567890123456789 | 4567890123456789 | 1
- | 4567890123456789 | -4567890123456789 | -1
-(5 rows)
-
-SELECT '' AS five, q1, float8(q1) FROM INT8_TBL;
- five | q1 | float8
-------+------------------+-----------------------
- | 123 | 123
- | 123 | 123
- | 4567890123456789 | 4.56789012345679e+015
- | 4567890123456789 | 4.56789012345679e+015
- | 4567890123456789 | 4.56789012345679e+015
-(5 rows)
-
-SELECT '' AS five, q2, float8(q2) FROM INT8_TBL;
- five | q2 | float8
-------+-------------------+------------------------
- | 456 | 456
- | 4567890123456789 | 4.56789012345679e+015
- | 123 | 123
- | 4567890123456789 | 4.56789012345679e+015
- | -4567890123456789 | -4.56789012345679e+015
-(5 rows)
-
-SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL;
- five | twice int4
-------+------------------
- | 246
- | 246
- | 9135780246913578
- | 9135780246913578
- | 9135780246913578
-(5 rows)
-
-SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL;
- five | twice int4
-------+------------------
- | 246
- | 246
- | 9135780246913578
- | 9135780246913578
- | 9135780246913578
-(5 rows)
-
--- TO_CHAR()
---
-SELECT '' AS to_char_1, to_char(q1, '9G999G999G999G999G999'), to_char(q2, '9,999,999,999,999,999')
- FROM INT8_TBL;
- to_char_1 | to_char | to_char
------------+------------------------+------------------------
- | 123 | 456
- | 123 | 4,567,890,123,456,789
- | 4,567,890,123,456,789 | 123
- | 4,567,890,123,456,789 | 4,567,890,123,456,789
- | 4,567,890,123,456,789 | -4,567,890,123,456,789
-(5 rows)
-
-SELECT '' AS to_char_2, to_char(q1, '9G999G999G999G999G999D999G999'), to_char(q2, '9,999,999,999,999,999.999,999')
- FROM INT8_TBL;
- to_char_2 | to_char | to_char
------------+--------------------------------+--------------------------------
- | 123.000,000 | 456.000,000
- | 123.000,000 | 4,567,890,123,456,789.000,000
- | 4,567,890,123,456,789.000,000 | 123.000,000
- | 4,567,890,123,456,789.000,000 | 4,567,890,123,456,789.000,000
- | 4,567,890,123,456,789.000,000 | -4,567,890,123,456,789.000,000
-(5 rows)
-
-SELECT '' AS to_char_3, to_char( (q1 * -1), '9999999999999999PR'), to_char( (q2 * -1), '9999999999999999.999PR')
- FROM INT8_TBL;
- to_char_3 | to_char | to_char
------------+--------------------+------------------------
- | <123> | <456.000>
- | <123> | <4567890123456789.000>
- | <4567890123456789> | <123.000>
- | <4567890123456789> | <4567890123456789.000>
- | <4567890123456789> | 4567890123456789.000
-(5 rows)
-
-SELECT '' AS to_char_4, to_char( (q1 * -1), '9999999999999999S'), to_char( (q2 * -1), 'S9999999999999999')
- FROM INT8_TBL;
- to_char_4 | to_char | to_char
------------+-------------------+-------------------
- | 123- | -456
- | 123- | -4567890123456789
- | 4567890123456789- | -123
- | 4567890123456789- | -4567890123456789
- | 4567890123456789- | +4567890123456789
-(5 rows)
-
-SELECT '' AS to_char_5, to_char(q2, 'MI9999999999999999') FROM INT8_TBL;
- to_char_5 | to_char
------------+-------------------
- | 456
- | 4567890123456789
- | 123
- | 4567890123456789
- | -4567890123456789
-(5 rows)
-
-SELECT '' AS to_char_6, to_char(q2, 'FMS9999999999999999') FROM INT8_TBL;
- to_char_6 | to_char
------------+-------------------
- | +456
- | +4567890123456789
- | +123
- | +4567890123456789
- | -4567890123456789
-(5 rows)
-
-SELECT '' AS to_char_7, to_char(q2, 'FM9999999999999999THPR') FROM INT8_TBL;
- to_char_7 | to_char
------------+--------------------
- | 456TH
- | 4567890123456789TH
- | 123RD
- | 4567890123456789TH
- | <4567890123456789>
-(5 rows)
-
-SELECT '' AS to_char_8, to_char(q2, 'SG9999999999999999th') FROM INT8_TBL;
- to_char_8 | to_char
------------+---------------------
- | + 456th
- | +4567890123456789th
- | + 123rd
- | +4567890123456789th
- | -4567890123456789
-(5 rows)
-
-SELECT '' AS to_char_9, to_char(q2, '0999999999999999') FROM INT8_TBL;
- to_char_9 | to_char
------------+-------------------
- | 0000000000000456
- | 4567890123456789
- | 0000000000000123
- | 4567890123456789
- | -4567890123456789
-(5 rows)
-
-SELECT '' AS to_char_10, to_char(q2, 'S0999999999999999') FROM INT8_TBL;
- to_char_10 | to_char
-------------+-------------------
- | +0000000000000456
- | +4567890123456789
- | +0000000000000123
- | +4567890123456789
- | -4567890123456789
-(5 rows)
-
-SELECT '' AS to_char_11, to_char(q2, 'FM0999999999999999') FROM INT8_TBL;
- to_char_11 | to_char
-------------+-------------------
- | 0000000000000456
- | 4567890123456789
- | 0000000000000123
- | 4567890123456789
- | -4567890123456789
-(5 rows)
-
-SELECT '' AS to_char_12, to_char(q2, 'FM9999999999999999.000') FROM INT8_TBL;
- to_char_12 | to_char
-------------+-----------------------
- | 456.000
- | 4567890123456789.000
- | 123.000
- | 4567890123456789.000
- | -4567890123456789.000
-(5 rows)
-
-SELECT '' AS to_char_13, to_char(q2, 'L9999999999999999.000') FROM INT8_TBL;
- to_char_13 | to_char
-------------+------------------------
- | 456.000
- | 4567890123456789.000
- | 123.000
- | 4567890123456789.000
- | -4567890123456789.000
-(5 rows)
-
-SELECT '' AS to_char_14, to_char(q2, 'FM9999999999999999.999') FROM INT8_TBL;
- to_char_14 | to_char
-------------+--------------------
- | 456.
- | 4567890123456789.
- | 123.
- | 4567890123456789.
- | -4567890123456789.
-(5 rows)
-
-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;
- to_char_15 | to_char
-------------+-------------------------------------------
- | +4 5 6 . 0 0 0
- | +4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0
- | +1 2 3 . 0 0 0
- | +4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0
- | -4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0
-(5 rows)
-
-SELECT '' AS to_char_16, to_char(q2, '99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM INT8_TBL;
- to_char_16 | to_char
-------------+-----------------------------------------------------------
- | text 9999 "text between quote marks" 456
- | 45678 text 9012 9999 345 "text between quote marks" 6789
- | text 9999 "text between quote marks" 123
- | 45678 text 9012 9999 345 "text between quote marks" 6789
- | -45678 text 9012 9999 345 "text between quote marks" 6789
-(5 rows)
-
-SELECT '' AS to_char_17, to_char(q2, '999999SG9999999999') FROM INT8_TBL;
- to_char_17 | to_char
-------------+-------------------
- | + 456
- | 456789+0123456789
- | + 123
- | 456789+0123456789
- | 456789-0123456789
-(5 rows)
-
diff --git a/src/test/regress/expected/int8-exp-three-digits.out b/src/test/regress/expected/int8-exp-three-digits.out
index e1eb64792c6..5e6bee8cc79 100644
--- a/src/test/regress/expected/int8-exp-three-digits.out
+++ b/src/test/regress/expected/int8-exp-three-digits.out
@@ -3,11 +3,26 @@
-- Test int8 64-bit integers.
--
CREATE TABLE INT8_TBL(q1 int8, q2 int8);
-INSERT INTO INT8_TBL VALUES('123','456');
-INSERT INTO INT8_TBL VALUES('123','4567890123456789');
+INSERT INTO INT8_TBL VALUES(' 123 ',' 456');
+INSERT INTO INT8_TBL VALUES('123 ','4567890123456789');
INSERT INTO INT8_TBL VALUES('4567890123456789','123');
INSERT INTO INT8_TBL VALUES('4567890123456789','4567890123456789');
INSERT INTO INT8_TBL VALUES('4567890123456789','-4567890123456789');
+-- bad inputs
+INSERT INTO INT8_TBL(q1) VALUES (' ');
+ERROR: invalid input syntax for integer: " "
+INSERT INTO INT8_TBL(q1) VALUES ('xxx');
+ERROR: invalid input syntax for integer: "xxx"
+INSERT INTO INT8_TBL(q1) VALUES ('3908203590239580293850293850329485');
+ERROR: value "3908203590239580293850293850329485" is out of range for type bigint
+INSERT INTO INT8_TBL(q1) VALUES ('-1204982019841029840928340329840934');
+ERROR: value "-1204982019841029840928340329840934" is out of range for type bigint
+INSERT INTO INT8_TBL(q1) VALUES ('- 123');
+ERROR: invalid input syntax for integer: "- 123"
+INSERT INTO INT8_TBL(q1) VALUES (' 345 5');
+ERROR: invalid input syntax for integer: " 345 5"
+INSERT INTO INT8_TBL(q1) VALUES ('');
+ERROR: invalid input syntax for integer: ""
SELECT * FROM INT8_TBL;
q1 | q2
------------------+-------------------
@@ -48,6 +63,8 @@ SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL;
| 4567890123456789 | -4567890123456789 | 9135780246913578
(5 rows)
+SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL;
+ERROR: bigint out of range
SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL
WHERE q1 < 1000 or (q2 > 0 and q2 < 1000);
three | q1 | q2 | multiply
@@ -139,7 +156,7 @@ SELECT '' AS to_char_3, to_char( (q1 * -1), '9999999999999999PR'), to_char( (q2
| <123> | <4567890123456789.000>
| <4567890123456789> | <123.000>
| <4567890123456789> | <4567890123456789.000>
- | <4567890123456789> | 4567890123456789.000
+ | <4567890123456789> | 4567890123456789.000
(5 rows)
SELECT '' AS to_char_4, to_char( (q1 * -1), '9999999999999999S'), to_char( (q2 * -1), 'S9999999999999999')
@@ -154,12 +171,12 @@ SELECT '' AS to_char_4, to_char( (q1 * -1), '9999999999999999S'), to_char( (q2 *
(5 rows)
SELECT '' AS to_char_5, to_char(q2, 'MI9999999999999999') FROM INT8_TBL;
- to_char_5 | to_char
------------+--------------------
- | 456
- | 4567890123456789
- | 123
- | 4567890123456789
+ to_char_5 | to_char
+-----------+-------------------
+ | 456
+ | 4567890123456789
+ | 123
+ | 4567890123456789
| -4567890123456789
(5 rows)
@@ -256,11 +273,11 @@ 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;
to_char_15 | to_char
------------+-------------------------------------------
- | +4 5 6 . 0 0 0
- | + 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0
- | +1 2 3 . 0 0 0
- | + 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0
- | - 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0
+ | +4 5 6 . 0 0 0
+ | +4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0
+ | +1 2 3 . 0 0 0
+ | +4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0
+ | -4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 . 0 0 0
(5 rows)
SELECT '' AS to_char_16, to_char(q2, '99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM INT8_TBL;
diff --git a/src/test/regress/expected/int8.out b/src/test/regress/expected/int8.out
index 7172cc1071a..164285dd65a 100644
--- a/src/test/regress/expected/int8.out
+++ b/src/test/regress/expected/int8.out
@@ -10,19 +10,19 @@ INSERT INTO INT8_TBL VALUES('4567890123456789','4567890123456789');
INSERT INTO INT8_TBL VALUES('4567890123456789','-4567890123456789');
-- bad inputs
INSERT INTO INT8_TBL(q1) VALUES (' ');
-ERROR: invalid input syntax for type bigint: " "
+ERROR: invalid input syntax for integer: " "
INSERT INTO INT8_TBL(q1) VALUES ('xxx');
-ERROR: invalid input syntax for type bigint: "xxx"
+ERROR: invalid input syntax for integer: "xxx"
INSERT INTO INT8_TBL(q1) VALUES ('3908203590239580293850293850329485');
-ERROR: integer out of range
+ERROR: value "3908203590239580293850293850329485" is out of range for type bigint
INSERT INTO INT8_TBL(q1) VALUES ('-1204982019841029840928340329840934');
-ERROR: integer out of range
+ERROR: value "-1204982019841029840928340329840934" is out of range for type bigint
INSERT INTO INT8_TBL(q1) VALUES ('- 123');
-ERROR: invalid input syntax for type bigint: "- 123"
+ERROR: invalid input syntax for integer: "- 123"
INSERT INTO INT8_TBL(q1) VALUES (' 345 5');
-ERROR: invalid input syntax for type bigint: " 345 5"
+ERROR: invalid input syntax for integer: " 345 5"
INSERT INTO INT8_TBL(q1) VALUES ('');
-ERROR: invalid input syntax for type bigint: ""
+ERROR: invalid input syntax for integer: ""
SELECT * FROM INT8_TBL;
q1 | q2
------------------+-------------------
@@ -63,6 +63,8 @@ SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL;
| 4567890123456789 | -4567890123456789 | 9135780246913578
(5 rows)
+SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL;
+ERROR: bigint out of range
SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL
WHERE q1 < 1000 or (q2 > 0 and q2 < 1000);
three | q1 | q2 | multiply
diff --git a/src/test/regress/expected/subselect.out b/src/test/regress/expected/subselect.out
index fb80fb0a503..07e727de482 100644
--- a/src/test/regress/expected/subselect.out
+++ b/src/test/regress/expected/subselect.out
@@ -146,7 +146,8 @@ SELECT '' AS five, f1 AS "Correlated Field"
--
SELECT '' AS eight, ss.f1 AS "Correlated Field", ss.f3 AS "Second Field"
FROM SUBSELECT_TBL ss
- WHERE f1 NOT IN (SELECT f1+1 FROM INT4_TBL WHERE f1 != ss.f1);
+ WHERE f1 NOT IN (SELECT f1+1 FROM INT4_TBL
+ WHERE f1 != ss.f1 AND f1 < 2147483647);
eight | Correlated Field | Second Field
-------+------------------+--------------
| 2 | 4
diff --git a/src/test/regress/resultmap b/src/test/regress/resultmap
index 313eca30e9f..a54c7fe7baa 100644
--- a/src/test/regress/resultmap
+++ b/src/test/regress/resultmap
@@ -7,4 +7,4 @@ float8/.*-qnx=float8-exp-three-digits
float8/i.86-pc-mingw32=float8-exp-three-digits-win32
float8/i.86-pc-cygwin=float8-small-is-zero
int8/.*-qnx=int8-exp-three-digits
-int8/i.86-pc-mingw32=int8-exp-three-digits-win32
+int8/i.86-pc-mingw32=int8-exp-three-digits
diff --git a/src/test/regress/sql/int2.sql b/src/test/regress/sql/int2.sql
index e42b4236fdc..81bff557120 100644
--- a/src/test/regress/sql/int2.sql
+++ b/src/test/regress/sql/int2.sql
@@ -63,14 +63,23 @@ SELECT '' AS three, i.* FROM INT2_TBL i WHERE (i.f1 % int4 '2') = int2 '0';
SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i;
+SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i
+WHERE abs(f1) < 16384;
+
SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT2_TBL i;
SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i;
+SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i
+WHERE f1 < 32766;
+
SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT2_TBL i;
SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i;
+SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i
+WHERE f1 > -32767;
+
SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT2_TBL i;
SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT2_TBL i;
diff --git a/src/test/regress/sql/int4.sql b/src/test/regress/sql/int4.sql
index 85b22ccd0ab..b4c3929d09f 100644
--- a/src/test/regress/sql/int4.sql
+++ b/src/test/regress/sql/int4.sql
@@ -63,16 +63,34 @@ SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % int4 '2') = int2 '0';
SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i;
+SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i
+WHERE abs(f1) < 1073741824;
+
SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i;
+SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i
+WHERE abs(f1) < 1073741824;
+
SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i;
+SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i
+WHERE f1 < 2147483646;
+
SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i;
+SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i
+WHERE f1 < 2147483646;
+
SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i;
+SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i
+WHERE f1 > -2147483647;
+
SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i;
+SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i
+WHERE f1 > -2147483647;
+
SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT4_TBL i;
SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT4_TBL i;
diff --git a/src/test/regress/sql/int8.sql b/src/test/regress/sql/int8.sql
index 98b1606430d..ec7766219d6 100644
--- a/src/test/regress/sql/int8.sql
+++ b/src/test/regress/sql/int8.sql
@@ -25,6 +25,7 @@ SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL;
SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL;
SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL;
+SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL;
SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL
WHERE q1 < 1000 or (q2 > 0 and q2 < 1000);
SELECT '' AS five, q1, q2, q1 / q2 AS divide FROM INT8_TBL;
diff --git a/src/test/regress/sql/subselect.sql b/src/test/regress/sql/subselect.sql
index be3a0a87b5d..5cba9ca74d0 100644
--- a/src/test/regress/sql/subselect.sql
+++ b/src/test/regress/sql/subselect.sql
@@ -71,7 +71,8 @@ SELECT '' AS five, f1 AS "Correlated Field"
SELECT '' AS eight, ss.f1 AS "Correlated Field", ss.f3 AS "Second Field"
FROM SUBSELECT_TBL ss
- WHERE f1 NOT IN (SELECT f1+1 FROM INT4_TBL WHERE f1 != ss.f1);
+ WHERE f1 NOT IN (SELECT f1+1 FROM INT4_TBL
+ WHERE f1 != ss.f1 AND f1 < 2147483647);
select q1, float8(count(*)) / (select count(*) from int8_tbl)
from int8_tbl group by q1 order by q1;