trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [2/5] incubator-trafodion git commit: JIRA TRAFODION-1825. Fix for core caused by input datetime values.
Date Mon, 22 Feb 2016 23:48:54 GMT
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/44fb4f56/core/sql/regress/executor/EXPECTED022.SB
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/EXPECTED022.SB b/core/sql/regress/executor/EXPECTED022.SB
new file mode 100644
index 0000000..cbe4b2f
--- /dev/null
+++ b/core/sql/regress/executor/EXPECTED022.SB
@@ -0,0 +1,9467 @@
+>>obey TEST022 (test);
+>>-------------------------------------------------------------------------------
+>>create table t022t1 (a int);
+
+--- SQL operation complete.
+>>create table t022t2 (a int);
+
+--- SQL operation complete.
+>>create table t022t3 (a int unsigned);
+
+--- SQL operation complete.
+>>create table t022t4 (a smallint unsigned, b smallint);
+
+--- SQL operation complete.
+>>
+>>insert into t022t1 values (1);
+
+--- 1 row(s) inserted.
+>>insert into t022t2 values (1), (2);
+
+--- 2 row(s) inserted.
+>>insert into t022t3 values (4294967295), (3000000000);
+
+--- 2 row(s) inserted.
+>>insert into t022t4 values (65535, 32767);
+
+--- 1 row(s) inserted.
+>>
+>>?ifMX
+>>create table t022u (a int);
+
+--- SQL operation complete.
+>>insert into t022u values (1), (2);
+
+--- 2 row(s) inserted.
+>>create table t022a7 (c1 float(22), c2 float not null);
+
+--- SQL operation complete.
+>>?ifNT
+>>-- The ifNT setting is also enabled when run on Linux platforms.
+>>prepare insertIntoT022A7 from insert into t022a7 values (?,?);
+
+--- SQL command prepared.
+>>sh sh -c 'rm -f t022xxx > /dev/null 2>&1 ';
+>>-- Must use "sh sh -c" if we want the command to work on NT platforms.
+>>-- The space between t022xxx and the single quote (') is required by the SQLCI sh command.
+>>-- If the space is not specified, the output is going into the file "t022xxx'" - Strange!
+>>sh sh -c 'echo "begin work;"                                      > t022xxx ';
+>>sh sh -c 'echo "execute insertIntoT022A7 using 0 , 1. ; "        >> t022xxx ';
+>>sh sh -c 'echo "execute insertIntoT022A7 using 1 , 2.E3 ; "      >> t022xxx ';
+>>sh sh -c 'echo "execute insertIntoT022A7 using 3 , 123.456E2 ; " >> t022xxx ';
+>>sh sh -c 'echo "commit work;"                                    >> t022xxx ';
+>>?ifNT
+>>?ifNSK
+>>sh echo 0 , 1.   > t022xxx;
+>>sh echo 1 , 2.E3  >> t022xxx;
+>>sh echo 3 , 123.456E2 >> t022xxx;
+>>?ifNSK
+>>?ifMX
+>>
+>>-- Positive cases to test the limits of each data type.
+>>
+>>select cast (-9 as numeric(1)) from t022t1;
+
+(EXPR)
+------
+
+    -9
+
+--- 1 row(s) selected.
+>>select cast (9 as numeric(1)) from t022t1;
+
+(EXPR)
+------
+
+     9
+
+--- 1 row(s) selected.
+>>select cast (-9999 as numeric(4)) from t022t1;
+
+(EXPR)
+------
+
+ -9999
+
+--- 1 row(s) selected.
+>>select cast (9999 as numeric(4)) from t022t1;
+
+(EXPR)
+------
+
+  9999
+
+--- 1 row(s) selected.
+>>select cast (-32768 as smallint) from t022t1;
+
+(EXPR)
+------
+
+-32768
+
+--- 1 row(s) selected.
+>>select cast (32767 as smallint) from t022t1;
+
+(EXPR)
+------
+
+ 32767
+
+--- 1 row(s) selected.
+>>
+>>select cast (0 as numeric(1) unsigned) from t022t1;
+
+(EXPR)
+------
+
+     0
+
+--- 1 row(s) selected.
+>>select cast (9 as numeric(1) unsigned) from t022t1;
+
+(EXPR)
+------
+
+     9
+
+--- 1 row(s) selected.
+>>select cast (0 as numeric(4) unsigned) from t022t1;
+
+(EXPR)
+------
+
+     0
+
+--- 1 row(s) selected.
+>>select cast (9999 as numeric(4) unsigned) from t022t1;
+
+(EXPR)
+------
+
+  9999
+
+--- 1 row(s) selected.
+>>select cast (0 as smallint unsigned) from t022t1;
+
+(EXPR)
+------
+
+     0
+
+--- 1 row(s) selected.
+>>select cast (65535 as smallint unsigned) from t022t1;
+
+(EXPR)
+------
+
+ 65535
+
+--- 1 row(s) selected.
+>>
+>>select cast (-99999 as numeric(5)) from t022t1;
+
+(EXPR)     
+-----------
+
+     -99999
+
+--- 1 row(s) selected.
+>>select cast (99999 as numeric(5)) from t022t1;
+
+(EXPR)     
+-----------
+
+      99999
+
+--- 1 row(s) selected.
+>>select cast (-999999999 as numeric(9)) from t022t1;
+
+(EXPR)     
+-----------
+
+ -999999999
+
+--- 1 row(s) selected.
+>>select cast (999999999 as numeric(9)) from t022t1;
+
+(EXPR)     
+-----------
+
+  999999999
+
+--- 1 row(s) selected.
+>>select cast (-2147483648 as int) from t022t1;
+
+(EXPR)     
+-----------
+
+-2147483648
+
+--- 1 row(s) selected.
+>>select cast (2147483647 as int) from t022t1;
+
+(EXPR)     
+-----------
+
+ 2147483647
+
+--- 1 row(s) selected.
+>>
+>>select cast (0 as numeric(5) unsigned) from t022t1;
+
+(EXPR)    
+----------
+
+         0
+
+--- 1 row(s) selected.
+>>select cast (99999 as numeric(5) unsigned) from t022t1;
+
+(EXPR)    
+----------
+
+     99999
+
+--- 1 row(s) selected.
+>>select cast (0 as numeric(9) unsigned) from t022t1;
+
+(EXPR)    
+----------
+
+         0
+
+--- 1 row(s) selected.
+>>select cast (999999999 as numeric(9) unsigned) from t022t1;
+
+(EXPR)    
+----------
+
+ 999999999
+
+--- 1 row(s) selected.
+>>select cast (0 as int unsigned) from t022t1;
+
+(EXPR)    
+----------
+
+         0
+
+--- 1 row(s) selected.
+>>select cast (4294967295 as int unsigned) from t022t1;
+
+(EXPR)    
+----------
+
+4294967295
+
+--- 1 row(s) selected.
+>>
+>>select cast (-9999999999 as numeric(10)) from t022t1;
+
+(EXPR)              
+--------------------
+
+         -9999999999
+
+--- 1 row(s) selected.
+>>select cast (9999999999 as numeric(10)) from t022t1;
+
+(EXPR)              
+--------------------
+
+          9999999999
+
+--- 1 row(s) selected.
+>>select cast (-999999999999999999 as numeric(18)) from t022t1;
+
+(EXPR)              
+--------------------
+
+ -999999999999999999
+
+--- 1 row(s) selected.
+>>select cast (999999999999999999 as numeric(18)) from t022t1;
+
+(EXPR)              
+--------------------
+
+  999999999999999999
+
+--- 1 row(s) selected.
+>>select cast (-9223372036854775808 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+-9223372036854775808
+
+--- 1 row(s) selected.
+>>select cast (9223372036854775807 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+ 9223372036854775807
+
+--- 1 row(s) selected.
+>>
+>>select cast (-9 as decimal(1)) from t022t1;
+
+(EXPR)
+------
+
+    -9
+
+--- 1 row(s) selected.
+>>select cast (9 as decimal(1)) from t022t1;
+
+(EXPR)
+------
+
+     9
+
+--- 1 row(s) selected.
+>>select cast (-999999999999999999 as decimal(18)) from t022t1;
+
+(EXPR)             
+-------------------
+
+-999999999999999999
+
+--- 1 row(s) selected.
+>>select cast (999999999999999999 as decimal(18)) from t022t1;
+
+(EXPR)             
+-------------------
+
+ 999999999999999999
+
+--- 1 row(s) selected.
+>>
+>>select cast (0 as decimal(1) unsigned) from t022t1;
+
+(EXPR)
+------
+
+     0
+
+--- 1 row(s) selected.
+>>select cast (9 as decimal(1) unsigned) from t022t1;
+
+(EXPR)
+------
+
+     9
+
+--- 1 row(s) selected.
+>>select cast (0 as decimal(9) unsigned) from t022t1;
+
+(EXPR)   
+---------
+
+        0
+
+--- 1 row(s) selected.
+>>select cast (999999999 as decimal(9) unsigned) from t022t1;
+
+(EXPR)   
+---------
+
+999999999
+
+--- 1 row(s) selected.
+>>
+>>select cast (date'12/31/9999' as timestamp(3)) from t022t1;
+
+(EXPR)                 
+-----------------------
+
+9999-12-31 00:00:00.000
+
+--- 1 row(s) selected.
+>>select cast (timestamp'12/31/9999 11:59:59.999999 pm' as date) from t022t1;
+
+(EXPR)    
+----------
+
+9999-12-31
+
+--- 1 row(s) selected.
+>>select cast (timestamp'12/31/9999 11:59:59.999999 pm' as time(3)) from t022t1;
+
+(EXPR)      
+------------
+
+23:59:59.999
+
+--- 1 row(s) selected.
+>>
+>>select interval'0.1'second + timestamp'12/31/9998 11:59:59.9 pm' from t022t1;
+
+(EXPR)               
+---------------------
+
+9999-01-01 00:00:00.0
+
+--- 1 row(s) selected.
+>>select timestamp'12/31/9998 11:59:59.9 pm' + interval'0.1'second from t022t1;
+
+(EXPR)               
+---------------------
+
+9999-01-01 00:00:00.0
+
+--- 1 row(s) selected.
+>>select timestamp'01/01/9999 00:00:00.0' + interval-'0.1'second from t022t1;
+
+(EXPR)               
+---------------------
+
+9998-12-31 23:59:59.9
+
+--- 1 row(s) selected.
+>>select timestamp'01/01/9999 00:00:00.0' - interval'0.1'second from t022t1;
+
+(EXPR)               
+---------------------
+
+9998-12-31 23:59:59.9
+
+--- 1 row(s) selected.
+>>select (date'12/31/9999' - date'12/31/9998') day(3) from t022t1;
+
+(EXPR)
+------
+
+   365
+
+--- 1 row(s) selected.
+>>select (date'12/31/9998' - date'12/31/9999') day(3) from t022t1;
+
+(EXPR)
+------
+
+  -365
+
+--- 1 row(s) selected.
+>>
+>>select interval'1'month + timestamp'12/31/9998 11:59:59.999 pm' from t022t1;
+
+(EXPR)                 
+-----------------------
+
+9999-01-31 23:59:59.999
+
+--- 1 row(s) selected.
+>>select timestamp'12/31/9998 11:59:59.999 pm' + interval'1'month from t022t1;
+
+(EXPR)                 
+-----------------------
+
+9999-01-31 23:59:59.999
+
+--- 1 row(s) selected.
+>>select timestamp'01/31/9999 11:59:59.999 pm' + interval-'1'month from t022t1;
+
+(EXPR)                 
+-----------------------
+
+9998-12-31 23:59:59.999
+
+--- 1 row(s) selected.
+>>select timestamp'01/31/9999 11:59:59.999 pm' - interval'1'month from t022t1;
+
+(EXPR)                 
+-----------------------
+
+9998-12-31 23:59:59.999
+
+--- 1 row(s) selected.
+>>select (date'12/31/9999' - date'12/31/9998') month from t022t1;
+
+*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL MONTH(2).
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select (date'12/31/9998' - date'12/31/9999') month from t022t1;
+
+*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL MONTH(2).
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select (date'12/31/9999' - date'12/31/9998') year to month from t022t1;
+
+*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL YEAR(2) TO MONTH.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select (date'12/31/9998' - date'12/31/9999') year to month from t022t1;
+
+*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL YEAR(2) TO MONTH.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>
+>>select interval'1'second + time'11:59:59 pm' from t022t1;
+
+(EXPR)  
+--------
+
+00:00:00
+
+--- 1 row(s) selected.
+>>select time'11:59:59 pm' + interval'1'second from t022t1;
+
+(EXPR)  
+--------
+
+00:00:00
+
+--- 1 row(s) selected.
+>>select time'12:00:00 am' + interval-'1'second from t022t1;
+
+(EXPR)  
+--------
+
+23:59:59
+
+--- 1 row(s) selected.
+>>select time'12:00:00 am' - interval'1'second from t022t1;
+
+(EXPR)  
+--------
+
+23:59:59
+
+--- 1 row(s) selected.
+>>
+>>select timestamp '2015-05-31T10:11:12' from t022t1;
+
+(EXPR)             
+-------------------
+
+2015-05-31 10:11:12
+
+--- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12Z' from t022t1;
+
+(EXPR)             
+-------------------
+
+2015-05-31 10:11:12
+
+--- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12-05:00' from t022t1;
+
+(EXPR)             
+-------------------
+
+2015-05-31 15:11:12
+
+--- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12+05:00' from t022t1;
+
+(EXPR)             
+-------------------
+
+2015-05-31 05:11:12
+
+--- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12.123-05:00' from t022t1;
+
+(EXPR)                 
+-----------------------
+
+2015-05-31 15:11:12.123
+
+--- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12.123+05:00' from t022t1;
+
+(EXPR)                 
+-----------------------
+
+2015-05-31 05:11:12.123
+
+--- 1 row(s) selected.
+>>
+>>select cast('2015-05-31T10:11:12' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 10:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12Z' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 10:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12-05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 15:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12+05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 05:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12.123-05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 15:11:12.123000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12.123+05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 05:11:12.123000
+
+--- 1 row(s) selected.
+>>
+>>select time '10:11:12' from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12Z' from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12-05:00' from t022t1;
+
+(EXPR)  
+--------
+
+15:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12+05:00' from t022t1;
+
+(EXPR)  
+--------
+
+05:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12.123-05:00' from t022t1;
+
+(EXPR)      
+------------
+
+15:11:12.123
+
+--- 1 row(s) selected.
+>>select time '10:11:12.123+05:00' from t022t1;
+
+(EXPR)      
+------------
+
+05:11:12.123
+
+--- 1 row(s) selected.
+>>
+>>select cast('10:11:12' as time) from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12Z' as time) from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12-05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+15:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12+05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+05:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12.123-05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+15:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12.123+05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+05:11:12
+
+--- 1 row(s) selected.
+>>
+>>select time '23:11:06.123' from t022t1;
+
+(EXPR)      
+------------
+
+23:11:06.123
+
+--- 1 row(s) selected.
+>>select cast ('23:11:06.123' as time(2)) from t022t1;
+
+(EXPR)     
+-----------
+
+23:11:06.12
+
+--- 1 row(s) selected.
+>>
+>>select cast('2010-01-01' as timestamp(3)) from t022t1;
+
+(EXPR)                 
+-----------------------
+
+2010-01-01 00:00:00.000
+
+--- 1 row(s) selected.
+>>select cast('2010-01-01 10' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2010-01-01 10:00:00.000000
+
+--- 1 row(s) selected.
+>>
+>>create table if not exists t022dtime(a date not null, b time, c timestamp);
+
+--- SQL operation complete.
+>>prepare s from upsert into t022dtime values (?, ?, ?);
+
+--- SQL command prepared.
+>>execute s using '2010-01-01', '10:10:10', '2010-01-01 10:10:10.123';
+
+--- 1 row(s) inserted.
+>>select * from t022dtime;
+
+A           B         C                         
+----------  --------  --------------------------
+
+2010-01-01  10:10:10  2010-01-01 10:10:10.123000
+
+--- 1 row(s) selected.
+>>
+>>-- negative cases
+>>select cast('2016-01-29Z' as date) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select cast('2016-01-29+05:00' as date) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select cast('10:11:12-05:000' as time) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select date '2016-01-29Z' from t022t1;
+
+*** ERROR[3045] The date '2016-01-29Z' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select date '2016-01-29+05:00' from t022t1;
+
+*** ERROR[3045] The date '2016-01-29+05:00' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select time '25:11:11' from t022t1;
+
+*** ERROR[3046] The time '25:11:11' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select time '23:11:11.1234567' from t022t1;
+
+*** ERROR[3046] The time '23:11:11.1234567' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select cast ('23:11:61' as time) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select cast ('23:11:06' as timestamp) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select cast('2010-01-01' as time) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select timestamp'2010-01-01 10' from t022t1;
+
+*** ERROR[3047] The timestamp '2010-01-01 10' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>
+>>-- Prove these cases work since they're used in the succeeding negative tests.
+>>
+>>select cast (cast (-10 as smallint) as numeric(2)) from t022t1;
+
+(EXPR)
+------
+
+   -10
+
+--- 1 row(s) selected.
+>>select cast (cast (10 as smallint) as numeric(2)) from t022t1;
+
+(EXPR)
+------
+
+    10
+
+--- 1 row(s) selected.
+>>select cast (cast (-10 as numeric(2)) as smallint) from t022t1;
+
+(EXPR)
+------
+
+   -10
+
+--- 1 row(s) selected.
+>>select cast (cast (10 as numeric(2)) as smallint) from t022t1;
+
+(EXPR)
+------
+
+    10
+
+--- 1 row(s) selected.
+>>select cast (-1 as smallint) from t022t1;
+
+(EXPR)
+------
+
+    -1
+
+--- 1 row(s) selected.
+>>
+>>select cast (32768 as smallint unsigned) from t022t1;
+
+(EXPR)
+------
+
+ 32768
+
+--- 1 row(s) selected.
+>>select cast (10 as smallint unsigned) from t022t1;
+
+(EXPR)
+------
+
+    10
+
+--- 1 row(s) selected.
+>>
+>>select cast (-32769 as int) from t022t1;
+
+(EXPR)     
+-----------
+
+     -32769
+
+--- 1 row(s) selected.
+>>select cast (32768 as int) from t022t1;
+
+(EXPR)     
+-----------
+
+      32768
+
+--- 1 row(s) selected.
+>>select cast (-10 as int) from t022t1;
+
+(EXPR)     
+-----------
+
+        -10
+
+--- 1 row(s) selected.
+>>select cast (10 as int) from t022t1;
+
+(EXPR)     
+-----------
+
+         10
+
+--- 1 row(s) selected.
+>>select cast (-1 as int) from t022t1;
+
+(EXPR)     
+-----------
+
+         -1
+
+--- 1 row(s) selected.
+>>select cast (65536 as int) from t022t1;
+
+(EXPR)     
+-----------
+
+      65536
+
+--- 1 row(s) selected.
+>>select cast (-100000 as int) from t022t1;
+
+(EXPR)     
+-----------
+
+    -100000
+
+--- 1 row(s) selected.
+>>select cast (100000 as int) from t022t1;
+
+(EXPR)     
+-----------
+
+     100000
+
+--- 1 row(s) selected.
+>>
+>>select cast (32768 as int unsigned) from t022t1;
+
+(EXPR)    
+----------
+
+     32768
+
+--- 1 row(s) selected.
+>>select cast (10 as int unsigned) from t022t1;
+
+(EXPR)    
+----------
+
+        10
+
+--- 1 row(s) selected.
+>>select cast (65536 as int unsigned) from t022t1;
+
+(EXPR)    
+----------
+
+     65536
+
+--- 1 row(s) selected.
+>>select cast (2147483648 as int unsigned) from t022t1;
+
+(EXPR)    
+----------
+
+2147483648
+
+--- 1 row(s) selected.
+>>select cast (100000 as int unsigned) from t022t1;
+
+(EXPR)    
+----------
+
+    100000
+
+--- 1 row(s) selected.
+>>
+>>select cast (-32769 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+              -32769
+
+--- 1 row(s) selected.
+>>select cast (32768 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+               32768
+
+--- 1 row(s) selected.
+>>select cast (-10 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+                 -10
+
+--- 1 row(s) selected.
+>>select cast (10 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+                  10
+
+--- 1 row(s) selected.
+>>select cast (-1 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+                  -1
+
+--- 1 row(s) selected.
+>>select cast (65536 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+               65536
+
+--- 1 row(s) selected.
+>>select cast (-2147483649 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+         -2147483649
+
+--- 1 row(s) selected.
+>>select cast (2147483648 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+          2147483648
+
+--- 1 row(s) selected.
+>>select cast (-100000 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+             -100000
+
+--- 1 row(s) selected.
+>>select cast (100000 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+              100000
+
+--- 1 row(s) selected.
+>>select cast (4294967296 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+          4294967296
+
+--- 1 row(s) selected.
+>>select cast (-10000000000 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+        -10000000000
+
+--- 1 row(s) selected.
+>>select cast (10000000000 as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+         10000000000
+
+--- 1 row(s) selected.
+>>
+>>select cast (-32769 as decimal(5)) from t022t1;
+
+(EXPR)
+------
+
+-32769
+
+--- 1 row(s) selected.
+>>select cast (32768 as decimal(5)) from t022t1;
+
+(EXPR)
+------
+
+ 32768
+
+--- 1 row(s) selected.
+>>select cast (-10 as decimal(2)) from t022t1;
+
+(EXPR)
+------
+
+   -10
+
+--- 1 row(s) selected.
+>>select cast (10 as decimal(2)) from t022t1;
+
+(EXPR)
+------
+
+    10
+
+--- 1 row(s) selected.
+>>select cast (-1 as decimal(1)) from t022t1;
+
+(EXPR)
+------
+
+    -1
+
+--- 1 row(s) selected.
+>>select cast (65536 as decimal(5)) from t022t1;
+
+(EXPR)
+------
+
+ 65536
+
+--- 1 row(s) selected.
+>>select cast (-2147483649 as decimal(10)) from t022t1;
+
+(EXPR)     
+-----------
+
+-2147483649
+
+--- 1 row(s) selected.
+>>select cast (2147483648 as decimal(10)) from t022t1;
+
+(EXPR)     
+-----------
+
+ 2147483648
+
+--- 1 row(s) selected.
+>>select cast (-100000 as decimal(6)) from t022t1;
+
+(EXPR) 
+-------
+
+-100000
+
+--- 1 row(s) selected.
+>>select cast (100000 as decimal(6)) from t022t1;
+
+(EXPR) 
+-------
+
+ 100000
+
+--- 1 row(s) selected.
+>>select cast (4294967296 as decimal(10)) from t022t1;
+
+(EXPR)     
+-----------
+
+ 4294967296
+
+--- 1 row(s) selected.
+>>select cast (-10000000000 as decimal(11)) from t022t1;
+
+(EXPR)      
+------------
+
+-10000000000
+
+--- 1 row(s) selected.
+>>select cast (10000000000 as decimal(11)) from t022t1;
+
+(EXPR)      
+------------
+
+ 10000000000
+
+--- 1 row(s) selected.
+>>
+>>select cast (32768 as decimal(5) unsigned) from t022t1;
+
+(EXPR)
+------
+
+ 32768
+
+--- 1 row(s) selected.
+>>select cast (10 as decimal(2) unsigned) from t022t1;
+
+(EXPR)
+------
+
+    10
+
+--- 1 row(s) selected.
+>>select cast (65536 as decimal(5) unsigned) from t022t1;
+
+(EXPR)
+------
+
+ 65536
+
+--- 1 row(s) selected.
+>>select cast (100000 as decimal(6) unsigned) from t022t1;
+
+(EXPR)
+------
+
+100000
+
+--- 1 row(s) selected.
+>>
+>>-- Floating point results are different depending on whether you are
+>>-- running on NSK (Tandem floating point) or NT (IEEE floating point)
+>>?ifNSK
+>>select cast (-32769 as real) from t022t1;
+>>select cast (32768 as real) from t022t1;
+>>select cast (-10 as real) from t022t1;
+>>select cast (10 as real) from t022t1;
+>>select cast (-1 as real) from t022t1;
+>>select cast (65536 as real) from t022t1;
+>>select cast (-2147483649 as real) from t022t1;
+>>select cast (9999999999 as real) from t022t1;
+>>select cast (-100000 as real) from t022t1;
+>>select cast (100000 as real) from t022t1;
+>>select cast (9999999999 as real) from t022t1;
+>>
+>>select cast (-32769 as double precision) from t022t1;
+>>select cast (32768 as double precision) from t022t1;
+>>select cast (-10 as double precision) from t022t1;
+>>select cast (10 as double precision) from t022t1;
+>>select cast (-1 as double precision) from t022t1;
+>>select cast (65536 as double precision) from t022t1;
+>>select cast (-2147483649 as double precision) from t022t1;
+>>select cast (2147483648 as double precision) from t022t1;
+>>select cast (-100000 as double precision) from t022t1;
+>>select cast (100000 as double precision) from t022t1;
+>>select cast (4294967296 as double precision) from t022t1;
+>>?ifNSK
+>>?ifNT
+>>select cast (-32769 as real) from t022t1;
+
+(EXPR)         
+---------------
+
+-3.2769000E+004
+
+--- 1 row(s) selected.
+>>select cast (32768 as real) from t022t1;
+
+(EXPR)         
+---------------
+
+ 3.2768000E+004
+
+--- 1 row(s) selected.
+>>select cast (-10 as real) from t022t1;
+
+(EXPR)         
+---------------
+
+-1.0000000E+001
+
+--- 1 row(s) selected.
+>>select cast (10 as real) from t022t1;
+
+(EXPR)         
+---------------
+
+ 1.0000000E+001
+
+--- 1 row(s) selected.
+>>select cast (-1 as real) from t022t1;
+
+(EXPR)         
+---------------
+
+-1.0000000E+000
+
+--- 1 row(s) selected.
+>>select cast (65536 as real) from t022t1;
+
+(EXPR)         
+---------------
+
+ 6.5536000E+004
+
+--- 1 row(s) selected.
+>>select cast (-2147483649 as real) from t022t1;
+
+(EXPR)         
+---------------
+
+-2.1474836E+009
+
+--- 1 row(s) selected.
+>>select cast (9999999999 as real) from t022t1;
+
+(EXPR)         
+---------------
+
+ 1.0000000E+010
+
+--- 1 row(s) selected.
+>>select cast (-100000 as real) from t022t1;
+
+(EXPR)         
+---------------
+
+-1.0000000E+005
+
+--- 1 row(s) selected.
+>>select cast (100000 as real) from t022t1;
+
+(EXPR)         
+---------------
+
+ 1.0000000E+005
+
+--- 1 row(s) selected.
+>>select cast (9999999999 as real) from t022t1;
+
+(EXPR)         
+---------------
+
+ 1.0000000E+010
+
+--- 1 row(s) selected.
+>>
+>>select cast (-32769 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+-3.27690000000000064E+004
+
+--- 1 row(s) selected.
+>>select cast (32768 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+ 3.27680000000000000E+004
+
+--- 1 row(s) selected.
+>>select cast (-10 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+-1.00000000000000000E+001
+
+--- 1 row(s) selected.
+>>select cast (10 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+ 1.00000000000000000E+001
+
+--- 1 row(s) selected.
+>>select cast (-1 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+-1.00000000000000000E+000
+
+--- 1 row(s) selected.
+>>select cast (65536 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+ 6.55360000000000000E+004
+
+--- 1 row(s) selected.
+>>select cast (-2147483649 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+-2.14748364900000032E+009
+
+--- 1 row(s) selected.
+>>select cast (2147483648 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+ 2.14748364800000000E+009
+
+--- 1 row(s) selected.
+>>select cast (-100000 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+-1.00000000000000000E+005
+
+--- 1 row(s) selected.
+>>select cast (100000 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+ 1.00000000000000000E+005
+
+--- 1 row(s) selected.
+>>select cast (4294967296 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+ 4.29496729600000000E+009
+
+--- 1 row(s) selected.
+>>?ifNT
+>>
+>>select cast ('Hello, world!' as char(13)) from t022t2;
+
+(EXPR)       
+-------------
+
+Hello, world!
+Hello, world!
+
+--- 2 row(s) selected.
+>>select cast ('Hello, world!' as varchar(13)) from t022t2;
+
+(EXPR)       
+-------------
+
+Hello, world!
+Hello, world!
+
+--- 2 row(s) selected.
+>>select cast (cast ('Hello        ' as char(13)) as char(5)) from t022t2;
+
+(EXPR)
+------
+
+Hello 
+Hello 
+
+--- 2 row(s) selected.
+>>select cast (cast ('Hello        ' as char(13)) as varchar(5)) from t022t2;
+
+(EXPR)
+------
+
+Hello 
+Hello 
+
+--- 2 row(s) selected.
+>>select cast (cast ('Hello, world!' as char(13)) as char(5)) from t022t2;
+
+*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
+
+(EXPR)
+------
+
+Hello 
+
+*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
+
+Hello 
+
+--- 2 row(s) selected.
+>>select cast (cast ('Hello, world!' as char(13)) as varchar(5)) from t022t2;
+
+*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
+
+(EXPR)
+------
+
+Hello 
+
+*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
+
+Hello 
+
+--- 2 row(s) selected.
+>>select cast (cast ('Hello        ' as varchar(13)) as char(5)) from t022t2;
+
+(EXPR)
+------
+
+Hello 
+Hello 
+
+--- 2 row(s) selected.
+>>select cast (cast ('Hello        ' as varchar(13)) as varchar(5)) from t022t2;
+
+(EXPR)
+------
+
+Hello 
+Hello 
+
+--- 2 row(s) selected.
+>>select cast (cast ('Hello, world!' as varchar(13)) as char(5)) from t022t2;
+
+*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
+
+(EXPR)
+------
+
+Hello 
+
+*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
+
+Hello 
+
+--- 2 row(s) selected.
+>>select cast (cast ('Hello, world!' as varchar(13)) as varchar(5)) from t022t2;
+
+*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
+
+(EXPR)
+------
+
+Hello 
+
+*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
+
+Hello 
+
+--- 2 row(s) selected.
+>>select cast (cast (-2147483649 as double precision) as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+         -2147483649
+
+--- 1 row(s) selected.
+>>select cast (cast (2147483648 as double precision) as largeint) from t022t1;
+
+(EXPR)              
+--------------------
+
+          2147483648
+
+--- 1 row(s) selected.
+>>
+>>-- Positive cases to test division.
+>>
+>>select cast (1 as numeric(1)) / cast (1 as numeric(1)) from t022t1;
+
+(EXPR) 
+-------
+
+    1.0
+
+--- 1 row(s) selected.
+>>select cast (1 as numeric(5)) / cast (1 as numeric(1)) from t022t1;
+
+(EXPR)      
+------------
+
+         1.0
+
+--- 1 row(s) selected.
+>>select cast (1 as numeric(1)) / cast (1 as numeric(5)) from t022t1;
+
+(EXPR)      
+------------
+
+     1.00000
+
+--- 1 row(s) selected.
+>>select cast (1 as numeric(5)) / cast (1 as numeric(5)) from t022t1;
+
+(EXPR)               
+---------------------
+
+              1.00000
+
+--- 1 row(s) selected.
+>>select cast (1 as numeric(10)) / cast (1 as numeric(10)) from t022t1;
+
+(EXPR)               
+---------------------
+
+           1.00000000
+
+--- 1 row(s) selected.
+>>
+>>select cast (1 as numeric(1) unsigned) /
++>       cast (1 as numeric(1) unsigned) from t022t1;
+
+(EXPR)
+------
+
+   1.0
+
+--- 1 row(s) selected.
+>>select cast (1 as numeric(5) unsigned) /
++>       cast (1 as numeric(1) unsigned) from t022t1;
+
+(EXPR)     
+-----------
+
+        1.0
+
+--- 1 row(s) selected.
+>>select cast (1 as numeric(1) unsigned) /
++>       cast (1 as numeric(5) unsigned) from t022t1;
+
+(EXPR)     
+-----------
+
+    1.00000
+
+--- 1 row(s) selected.
+>>select cast (1 as numeric(5) unsigned) /
++>       cast (1 as numeric(5) unsigned) from t022t1;
+
+(EXPR)               
+---------------------
+
+              1.00000
+
+--- 1 row(s) selected.
+>>select cast (1 as numeric(9) unsigned) /
++>       cast (1 as numeric(9) unsigned) from t022t1;
+
+(EXPR)               
+---------------------
+
+          1.000000000
+
+--- 1 row(s) selected.
+>>
+>>select cast (1 as double precision) / cast (1 as double precision) from t022t1;
+
+(EXPR)                   
+-------------------------
+
+ 1.00000000000000000E+000
+
+--- 1 row(s) selected.
+>>
+>>-- Negative tests.
+>>
+>>select cast (cast (-10 as smallint) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:-10 Target Type:LARGEINT(IBIN64S) Min Target Value:-9. Instruction:RANGE_LOW_S16S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as smallint) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_S16S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-10 as numeric(2)) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:-10 Target Type:LARGEINT(IBIN64S) Min Target Value:-9. Instruction:RANGE_LOW_S16S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as numeric(2)) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_S16S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as smallint) as smallint unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:-1 Target Type:LARGEINT(IBIN64S) Max Target Value:0. Instruction:RANGE_LOW_S16S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as smallint) as numeric(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_S16S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as smallint) as int unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:-1 Target Type:LARGEINT(IBIN64S) Max Target Value:0. Instruction:RANGE_LOW_S16S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (-10 as smallint) as decimal(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as smallint) as decimal(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as smallint) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as smallint) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
+
+--- 0 row(s) selected.
+>>
+>>select cast (cast (32768 as smallint unsigned) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT UNSIGNED(MBIN16U) Source Value:32768 Target Type:LARGEINT(IBIN64S) Max Target Value:32767. Instruction:RANGE_HIGH_U16S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as smallint unsigned) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT UNSIGNED(MBIN16U) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_U16S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as smallint unsigned) as numeric(1)unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT UNSIGNED(MBIN16U) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_U16S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as smallint unsigned) as decimal(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as smallint unsigned) as decimal(1)unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
+
+--- 0 row(s) selected.
+>>
+>>select cast (cast (-32769 as int) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:-32769 Target Type:LARGEINT(IBIN64S) Min Target Value:-32768. Instruction:RANGE_LOW_S32S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (32768 as int) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:32768 Target Type:LARGEINT(IBIN64S) Max Target Value:32767. Instruction:RANGE_HIGH_S32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-10 as int) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:-10 Target Type:LARGEINT(IBIN64S) Min Target Value:-9. Instruction:RANGE_LOW_S32S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as int) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_S32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as int) as smallint unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype. Source Type:INTEGER SIGNED(MBIN32S) Source Value:-1 Target Type:LARGEINT(IBIN64S) Max Target Value:0. Instruction:RANGE_LOW_S32S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (65536 as int) as smallint unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:65536 Target Type:LARGEINT(IBIN64S) Max Target Value:65535. Instruction:RANGE_HIGH_S32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as int) as numeric(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_S32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-100000 as int) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:-100000 Target Type:LARGEINT(IBIN64S) Min Target Value:-99999. Instruction:RANGE_LOW_S32S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as int) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_S32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as int) as int unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype. Source Type:INTEGER SIGNED(MBIN32S) Source Value:-1 Target Type:LARGEINT(IBIN64S) Max Target Value:0. Instruction:RANGE_LOW_S32S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as int) as numeric(5) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_S32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-10 as int) as decimal(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as int) as decimal(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as int) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as int) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
+
+--- 0 row(s) selected.
+>>
+>>select cast (cast (32768 as int unsigned) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:32768 Target Type:LARGEINT(IBIN64S) Max Target Value:32767. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as int unsigned) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (65536 as int unsigned) as smallint unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:65536 Target Type:LARGEINT(IBIN64S) Max Target Value:65535. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as int unsigned) as numeric(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (2147483648 as int unsigned) as int) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:2147483648 Target Type:LARGEINT(IBIN64S) Max Target Value:2147483647. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as int unsigned) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as int unsigned) as numeric(5) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as int unsigned) as decimal(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as int unsigned) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
+
+--- 0 row(s) selected.
+>>
+>>select cast (cast (-32769 as largeint) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:-32769 Target Type:LARGEINT(IBIN64S) Min Target Value:-32768. Instruction:RANGE_LOW_S64S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (32768 as largeint) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:32768 Target Type:LARGEINT(IBIN64S) Max Target Value:32767. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-10 as largeint) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:-10 Target Type:LARGEINT(IBIN64S) Min Target Value:-9. Instruction:RANGE_LOW_S64S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as largeint) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as largeint) as smallint unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
+
+--- 0 row(s) selected.
+>>select cast (cast (65536 as largeint) as smallint unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:65536 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as largeint) as numeric(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-2147483649 as largeint) as int) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:-2147483649 Target Type:LARGEINT(IBIN64S) Min Target Value:-2147483648. Instruction:RANGE_LOW_S64S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (2147483648 as largeint) as int) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:2147483648 Target Type:LARGEINT(IBIN64S) Max Target Value:2147483647. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-100000 as largeint) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:-100000 Target Type:LARGEINT(IBIN64S) Min Target Value:-99999. Instruction:RANGE_LOW_S64S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as largeint) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as largeint) as int unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype. Source Type:LARGEINT(MBIN64S) Source Value:-1 Target Type:LARGEINT(IBIN64S) Max Target Value:0. Instruction:RANGE_LOW_S64S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (4294967296 as largeint) as int unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:4294967296 Target Type:LARGEINT(IBIN64S) Max Target Value:4294967295. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as largeint) as numeric(5) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (-10000000000 as largeint) as numeric(10)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:-10000000000 Target Type:LARGEINT(IBIN64S) Min Target Value:-9999999999. Instruction:RANGE_LOW_S64S64 Operation:RANGE_LOW.
+
+--- 0 row(s) selected.
+>>select cast (cast (10000000000 as largeint) as numeric(10)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:10000000000 Target Type:LARGEINT(IBIN64S) Max Target Value:9999999999. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as largeint) as decimal(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as largeint) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as largeint) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
+
+--- 0 row(s) selected.
+>>
+>>select cast (cast (-32769 as decimal(5)) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-32769 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (32768 as decimal(5)) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:32768 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-10 as decimal(2)) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as decimal(2)) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as decimal(1)) as smallint unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
+
+--- 0 row(s) selected.
+>>select cast (cast (65536 as decimal(5)) as smallint unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:65536 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as decimal(2)) as numeric(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-2147483649 as decimal(10)) as int) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-2147483649 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (2147483648 as decimal(10)) as int) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:2147483648 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-100000 as decimal(6)) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as decimal(6)) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as decimal(1)) as int unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
+
+--- 0 row(s) selected.
+>>select cast (cast (4294967296 as decimal(10)) as int unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:4294967296 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as decimal(6)) as numeric(5) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-10000000000 as decimal(11)) as numeric(10)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10000000000 to Target Type:LARGEINT(REC_BIN64_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10000000000 as decimal(11)) as numeric(10)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10000000000 to Target Type:LARGEINT(REC_BIN64_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as decimal(2)) as decimal(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as decimal(1)) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as decimal(2)) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
+
+--- 0 row(s) selected.
+>>
+>>select cast (cast (32768 as decimal(5) unsigned) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:32768 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as decimal(2) unsigned) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (65536 as decimal(5) unsigned) as smallint unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:65536 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as decimal(2) unsigned) as numeric(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as decimal(6) unsigned) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as decimal(6) unsigned) as numeric(5) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as decimal(2) unsigned) as decimal(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as decimal(2) unsigned) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
+
+--- 0 row(s) selected.
+>>
+>>select cast (cast (-32769 as real) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:-3.2769000E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (32768 as real) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:3.2768000E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-10 as real) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:0.0000000E+000 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as real) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-044 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as real) as smallint unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
+
+--- 0 row(s) selected.
+>>select cast (cast (65536 as real) as smallint unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:6.5536000E+004 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as real) as numeric(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-044 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-2147484160 as real) as int) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:-2.1474841E+009 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (9999999999 as real) as int) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+010 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-100000 as real) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:0.0000000E+000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as real) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-040 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as real) as int unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
+
+--- 0 row(s) selected.
+>>select cast (cast (9999999999 as real) as int unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+010 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as real) as numeric(5) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-040 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as real) as decimal(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+001 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as real) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:-1.0000000E+000 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as real) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+001 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
+
+--- 0 row(s) selected.
+>>
+>>select cast (cast (-32769 as double precision) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:-3.27690000000000064E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (32768 as double precision) as smallint) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:3.27680000000000000E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-10 as double precision) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:0.00000000000000000E+000 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as double precision) as numeric(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246592E-323 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as double precision) as smallint unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
+
+--- 0 row(s) selected.
+>>select cast (cast (65536 as double precision) as smallint unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:6.55360000000000000E+004 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as double precision) as numeric(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246592E-323 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-2147483649 as double precision) as int) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:-2.14748364900000032E+009 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (2147483648 as double precision) as int) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:2.14748364800000000E+009 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-100000 as double precision) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:0.00000000000000000E+000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as double precision) as numeric(5)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246528E-319 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as double precision) as int unsigned) from t022t1;
+
+*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
+
+--- 0 row(s) selected.
+>>select cast (cast (4294967296 as double precision) as int unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.29496729600000000E+009 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (100000 as double precision) as numeric(5) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246528E-319 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as double precision) as decimal(1)) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:1.00000000000000000E+001 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
+
+--- 0 row(s) selected.
+>>select cast (cast (-1 as double precision) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:-1.00000000000000000E+000 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
+
+--- 0 row(s) selected.
+>>select cast (cast (10 as double precision) as decimal(1) unsigned) from t022t1;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:1.00000000000000000E+001 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
+
+--- 0 row(s) selected.
+>>
+>>-- tests for DATE, TIME, TIMESTAMP
+>>select cast ('12.07.1961 03.04.55.123456' as timestamp) from t022t2;
+
+(EXPR)                    
+--------------------------
+
+1961-07-12 03:04:55.123456
+1961-07-12 03:04:55.123456
+
+--- 2 row(s) selected.
+>>select cast ('12.07.1961 03.04.55.123456' as timestamp(3)) from t022t2;
+
+(EXPR)                 
+-----------------------
+
+1961-07-12 03:04:55.123
+1961-07-12 03:04:55.123
+
+--- 2 row(s) selected.
+>>select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as DATE) from t022t2;
+
+(EXPR)    
+----------
+
+1961-07-12
+1961-07-12
+
+--- 2 row(s) selected.
+>>select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as char(21)) from t022t2;
+
+(EXPR)               
+---------------------
+
+1961-07-12 03:04:55.1
+1961-07-12 03:04:55.1
+
+--- 2 row(s) selected.
+>>select cast ('12/13/1987' as date) from t022t2;
+
+(EXPR)    
+----------
+
+1987-12-13
+1987-12-13
+
+--- 2 row(s) selected.
+>>
+>>-- some negative DATE, TIME, TIMESTAMP
+>>-- illegal european format
+>>select cast ('12.13.1987' as date) from t022t2;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>
+>>-- illegal US format
+>>select cast ('13/12/1987' as date) from t022t2;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>
+>>-- string overflow
+>>select cast (cast ('12.07.1961 03:04:55.123456' as timestamp) as char(18)) from t022t2;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>
+>>-- Feb. 30th doesn't exist
+>>select cast('1997-30-02' as DATE) from t022t2;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>
+>>select interval'0.1'second + timestamp'12/31/9999 11:59:59.9 pm' from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>select timestamp'12/31/9999 11:59:59.9 pm' + interval'0.1'second from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>select timestamp'01/01/0001 00:00:00.0' + interval-'0.1'second from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>select timestamp'01/01/0001 00:00:00.0' - interval'0.1'second from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>
+>>select interval'1'month + date'12/31/9999' from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>select date'12/31/9999' + interval'1'month from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>select date'01/01/0001' + interval-'1'month from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>select date'01/01/0001' - interval'1'month from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>
+>>select interval'1'month + date'01/31/9999' from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>select date'01/31/9999' + interval'1'month from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>select date'03/30/9999' + interval-'1'month from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>select date'03/30/9999' - interval'1'month from t022t1;
+
+*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
+
+--- 0 row(s) selected.
+>>
+>>-- Negative cases to test division by zero.
+>>
+>>select cast (1 as numeric(1)) / cast (0 as numeric(1)) from t022t1;
+
+*** ERROR[8419] An arithmetic expression attempted a division by zero.
+
+--- 0 row(s) selected.
+>>select cast (1 as numeric(5)) / cast (0 as numeric(1)) from t022t1;
+
+*** ERROR[8419] An arithmetic expression attempted a division by zero.
+
+--- 0 row(s) selected.
+>>select cast (1 as numeric(1)) / cast (0 as numeric(5)) from t022t1;
+
+*** ERROR[8419] An arithmetic expression attempted a division by zero.
+
+--- 0 row(s) selected.
+>>select cast (1 as numeric(5)) / cast (0 as numeric(5)) from t022t1;
+
+*** ERROR[8419] An arithmetic expression attempted a division by zero. Operand1 Type:LARGEINT(MBIN64S) Operand1 Value:100000 Operand2 Type:LARGEINT(MBIN64S) Operand2 Value:0. Instruction:DIV_MBIN64S_MBIN64S_MBIN64S Operation:DIV.
+
+--- 0 row(s) selected.
+>>select cast (1 as numeric(10)) / cast (0 as numeric(10)) from t022t1;
+
+*** ERROR[8419] An arithmetic expression attempted a division by zero.
+
+--- 0 row(s) selected.
+>>
+>>select cast (1 as numeric(1) unsigned) /
++>       cast (0 as numeric(1) unsigned) from t022t1;
+
+*** ERROR[8419] An arithmetic expression attempted a division by zero.
+
+--- 0 row(s) selected.
+>>select cast (1 as numeric(5) unsigned) /
++>       cast (0 as numeric(1) unsigned) from t022t1;
+
+*** ERROR[8419] An arithmetic expression attempted a division by zero.
+
+--- 0 row(s) selected.
+>>select cast (1 as numeric(1) unsigned) /
++>       cast (0 as numeric(5) unsigned) from t022t1;
+
+*** ERROR[8419] An arithmetic expression attempted a division by zero.
+
+--- 0 row(s) selected.
+>>select cast (1 as numeric(5) unsigned) /
++>       cast (0 as numeric(5) unsigned) from t022t1;
+
+*** ERROR[8419] An arithmetic expression attempted a division by zero. Operand1 Type:LARGEINT(MBIN64S) Operand1 Value:100000 Operand2 Type:LARGEINT(MBIN64S) Operand2 Value:0. Instruction:DIV_MBIN64S_MBIN64S_MBIN64S Operation:DIV.
+
+--- 0 row(s) selected.
+>>select cast (1 as numeric(9) unsigned) /
++>       cast (0 as numeric(9) unsigned) from t022t1;
+
+*** ERROR[8419] An arithmetic expression attempted a division by zero. Operand1 Type:LARGEINT(MBIN64S) Operand1 Value:1000000000 Operand2 Type:LARGEINT(MBIN64S) Operand2 Value:0. Instruction:DIV_MBIN64S_MBIN64S_MBIN64S Operation:DIV.
+
+--- 0 row(s) selected.
+>>
+>>select cast (1 as double precision) / cast (0 as double precision) from t022t1;
+
+*** ERROR[8419] An arithmetic expression attempted a division by zero. Operand1 Type:IEEE DOUBLE PRECISION(MFLT64) Operand1 Value:1.00000000000000000E+000 Operand2 Type:IEEE DOUBLE PRECISION(MFLT64) Operand2 Value:0.00000000000000000E+000. Instruction:DIV_MFLT64_MFLT64_MFLT64 Operation:DIV.
+
+--- 0 row(s) selected.
+>>
+>>-- Floating point results are different depending on whether you are
+>>-- running on NSK (Tandem floating point) or NT (IEEE floating point)
+>>?ifNSK
+>>-- results:  0 rows selected
+>>select cast('66.2' as float) from t022t1 where cast('66.2' as float) = 66.2;
+>>?ifNSK
+>>?ifNT
+>>-- results:  1 row selected
+>>select cast('66.2' as float) from t022t1 where cast('66.2' as float) = 66.2;
+
+(EXPR)                   
+-------------------------
+
+ 6.62000000000000128E+001
+
+--- 1 row(s) selected.
+>>?ifNT
+>>
+>>-- to test comparisons between signed and unsigned numbers.
+>>
+>>select * from t022t3 where 2147483647 < a;
+
+A         
+----------
+
+4294967295
+3000000000
+
+--- 2 row(s) selected.
+>>select * from t022t3 where 2147483647 <= a;
+
+A         
+----------
+
+4294967295
+3000000000
+
+--- 2 row(s) selected.
+>>select * from t022t3 where a < 2147483647;
+
+--- 0 row(s) selected.
+>>select * from t022t3 where a <= 2147483647;
+
+--- 0 row(s) selected.
+>>select * from t022t3 where a < 0;
+
+--- 0 row(s) selected.
+>>select * from t022t3 where a <= 0;
+
+--- 0 row(s) selected.
+>>select * from t022t3 where -1 > a;
+
+--- 0 row(s) selected.
+>>select * from t022t3 where a > 0;
+
+A         
+----------
+
+4294967295
+3000000000
+
+--- 2 row(s) selected.
+>>select * from t022t3 where a >= 2147483647;
+
+A         
+----------
+
+4294967295
+3000000000
+
+--- 2 row(s) selected.
+>>select * from t022t3 where 2147483647 >= a;
+
+--- 0 row(s) selected.
+>>select * from t022t3 where a >= 32767;
+
+A         
+----------
+
+4294967295
+3000000000
+
+--- 2 row(s) selected.
+>>
+>>select * from t022t4 where b < 3000000000;
+
+A      B     
+-----  ------
+
+65535   32767
+
+--- 1 row(s) selected.
+>>select * from t022t4 where b <= 3000000000;
+
+A      B     
+-----  ------
+
+65535   32767
+
+--- 1 row(s) selected.
+>>select * from t022t4 where b > 3000000000;
+
+--- 0 row(s) selected.
+>>select * from t022t4 where b >= 3000000000;
+
+--- 0 row(s) selected.
+>>
+>>
+>>-- negative test cases
+>>-- The next three tests get different results depending on whether they
+>>-- are run using SQL/MX or SQL/MP tables.  Run them separately 
+>>?ifMP
+>>create table t022t5 (t022t5_c1 numeric( 9) unsigned,
++>                     t022t5_c2 numeric(10) unsigned);
+>>create table t022t6 (t022t6_c1 decimal( 9) unsigned,
++>                     t022t6_c2 decimal(10) unsigned);
+>>create table t022t7 (t022t7_c1 dec    ( 9) unsigned,
++>                     t022t7_c2 dec    (10) unsigned);
+>>?ifMP
+>>
+>>?ifMX
+>>create table t022t5 (t022t5_c1 numeric( 9) unsigned,
++>                     t022t5_c2 numeric(10) unsigned);
+
+--- SQL operation complete.
+>>create table t022t6 (t022t6_c1 decimal( 9) unsigned,
++>                     t022t6_c2 decimal(10) unsigned);
+
+*** ERROR[3008] Precision of DECIMAL UNSIGNED data type, 10, cannot exceed 9.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>create table t022t7 (t022t7_c1 dec    ( 9) unsigned,
++>                     t022t7_c2 dec    (10) unsigned);
+
+*** ERROR[3008] Precision of DECIMAL UNSIGNED data type, 10, cannot exceed 9.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>?ifMX
+>>
+>>select cast(1 as numeric(10) unsigned) from (values(0))x;
+
+(EXPR)     
+-----------
+
+          1
+
+--- 1 row(s) selected.
+>>select cast(1 as decimal(10) unsigned) from (values(0))x;
+
+*** ERROR[3008] Precision of DECIMAL UNSIGNED data type, 10, cannot exceed 9.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select cast(1 as dec    (10) unsigned) from (values(0))x;
+
+*** ERROR[3008] Precision of DECIMAL UNSIGNED data type, 10, cannot exceed 9.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>
+>>
+>>-- time/timestamp AM/PM tests (test convDoIt with timestamps)
+>>create table t022t8 (c1 timestamp, c2 time);
+
+--- SQL operation complete.
+>>
+>>set param ?p '12/05/1998 03:15:08.123456 pm';
+>>insert into t022t8 (c1) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '2015-05-31T14:15:16Z';
+>>insert into t022t8 (c1) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '2015-05-31T14:15:16';
+>>insert into t022t8 (c1) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '2100-01-01:00:00:47.250000';
+>>insert into t022t8 (c1) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '12/05/1998 10:15:08.889 pm';
+>>insert into t022t8 (c1) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '06/28/1998 03:15:08 pm';
+>>insert into t022t8 (c1) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '02/10/1998 12:15:08.123456 am';
+>>insert into t022t8 (c1) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '12/05/1998 03:15:08.123456 am';
+>>insert into t022t8 (c1) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '12/05/1998 03:15:08.123456';
+>>insert into t022t8 (c1) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>-- expect error since 15 hours and am don't match
+>>set param ?p '11/20/1997 15:15:08.123456 am';
+>>insert into t022t8 (c1) values ( ?p );
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+*** ERROR[15015] PARAM ?p (value 11/20/1997 15:15:08.123456 am) cannot be converted to type TIMESTAMP(6).
+
+--- 0 row(s) inserted.
+>>
+>>-- expect an error
+>>set param ?p '2100-01-01:ab:00:47.250000';
+>>insert into t022t8 (c1) values ( ?p );
+
+*** ERROR[8413] The string argument contains characters that cannot be converted.
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+*** ERROR[15015] PARAM ?p (value 2100-01-01:ab:00:47.250000) cannot be converted to type TIMESTAMP(6).
+
+--- 0 row(s) inserted.
+>>
+>>-- expect error since the date is not in US format
+>>set param ?p '1998-03-12 03:15:08.123456 pm';
+>>insert into t022t8 (c1) values ( ?p );
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+*** ERROR[15015] PARAM ?p (value 1998-03-12 03:15:08.123456 pm) cannot be converted to type TIMESTAMP(6).
+
+--- 0 row(s) inserted.
+>>
+>>-- expect error since the date is not in US format
+>>set param ?p '1996-05-23 16:15:08.123 am';
+>>insert into t022t8 (c1) values ( ?p );
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+*** ERROR[15015] PARAM ?p (value 1996-05-23 16:15:08.123 am) cannot be converted to type TIMESTAMP(6).
+
+--- 0 row(s) inserted.
+>>
+>>select c1 from t022t8;
+
+C1                        
+--------------------------
+
+1998-12-05 15:15:08.123456
+2015-05-31 14:15:16.000000
+2015-05-31 14:15:16.000000
+2100-01-01 00:00:47.250000
+1998-12-05 22:15:08.889000
+1998-06-28 15:15:08.000000
+1998-02-10 00:15:08.123456
+1998-12-05 03:15:08.123456
+1998-12-05 03:15:08.123456
+
+--- 9 row(s) selected.
+>>
+>>-- test convDoIt with time
+>>set param ?p '03:15:08 pm';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '11:15:08 pm';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '10:15:08 am';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '12:59:59 am';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '10:05:59 am';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '09:00:00 am';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '11:00:00 am';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '08:00:00';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>set param ?p '00:01:00';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>-- expect error
+>>set param ?p '00:a1:00';
+>>insert into t022t8 (c2) values ( ?p );
+
+*** ERROR[8413] The string argument contains characters that cannot be converted.
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+*** ERROR[15015] PARAM ?p (value 00:a1:00) cannot be converted to type TIME(0).
+
+--- 0 row(s) inserted.
+>>
+>>-- expect error since 14 and am don't match
+>>set param ?p '14:59:59 am';
+>>insert into t022t8 (c2) values ( ?p );
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+*** ERROR[15015] PARAM ?p (value 14:59:59 am) cannot be converted to type TIME(0).
+
+--- 0 row(s) inserted.
+>>
+>>-- expect error 
+>>set param ?p '11:60:59 am';
+>>insert into t022t8 (c2) values ( ?p );
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+*** ERROR[15015] PARAM ?p (value 11:60:59 am) cannot be converted to type TIME(0).
+
+--- 0 row(s) inserted.
+>>
+>>-- expect error
+>>set param ?p '11:03:33';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>-- expect an error
+>>set param ?p '00:01:00.03';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>-- expect an error
+>>set param ?p '10:36:52.0781 pm';
+>>insert into t022t8 (c2) values ( ?p );
+
+--- 1 row(s) inserted.
+>>
+>>select c2 from t022t8;
+
+C2      
+--------
+
+?       
+?       
+?       
+?       
+?       
+?       
+?       
+?       
+?       
+15:15:08
+23:15:08
+10:15:08
+00:59:59
+10:05:59
+09:00:00
+11:00:00
+08:00:00
+00:01:00
+11:03:33
+00:01:00
+22:36:52
+
+--- 21 row(s) selected.
+>>
+>>-- test type casting involving the ordering of digits and other symbols 
+>>-- like - . +
+>>
+>>-- positive cases 
+>>select cast('-.3' as int), cast ('+1.4' as int) , cast('-32.3' as int) 
++>      from t022t8;
+
+(EXPR)       (EXPR)       (EXPR)     
+-----------  -----------  -----------
+
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+          0            1          -32
+
+--- 21 row(s) selected.
+>>select c1 from t022t8 where cast('-.3' as int) < 1 and cast('+1.5' as int) <2;
+
+C1                        
+--------------------------
+
+1998-12-05 15:15:08.123456
+2015-05-31 14:15:16.000000
+2015-05-31 14:15:16.000000
+2100-01-01 00:00:47.250000
+1998-12-05 22:15:08.889000
+1998-06-28 15:15:08.000000
+1998-02-10 00:15:08.123456
+1998-12-05 03:15:08.123456
+1998-12-05 03:15:08.123456
+?                         
+?                    

<TRUNCATED>


Mime
View raw message