David Wayne Birdsall created TRAFODION-2778:
-----------------------------------------------
Summary: Query fails with error 8411 when it should succeed
Key: TRAFODION-2778
URL: https://issues.apache.org/jira/browse/TRAFODION-2778
Project: Apache Trafodion
Issue Type: Bug
Components: sql-cmp
Affects Versions: 2.3-incubating
Environment: All
Reporter: David Wayne Birdsall
Priority: Minor
This is a bug in LARGEINT UNSIGNED handling. A predicate of the form X = -1 is
returning TRUE when X has the value 18446744073709551615 (which happens to be
the largest valid value a LARGEINT UNSIGNED can hold). The value then gets
passed to an expression X + 10, resulting in the 8411 overflow error.
The following script reproduces the error (it is similar to a query found in
regress test seabase/TEST003):
create table t003t2(a largeint unsigned not null primary key, b largeint unsigne
d);
insert into t003t2 values (1, 2);
insert into t003t2 values (18446744073709551615, 18446744073709551615);
select b+10 from t003t2 where b = 2 or b = -1;
When run, the query fails as follows:
>>select b+10 from t003t2 where b = 2 or b = -1;
(EXPR)
--------------------
12
*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or
data conversion. Conversion of Source Type:NUMERIC(REC_NUM_BIG_SIGNED) Source
Value:0x09000000000000000100 to Target Type:LARGEINT(REC_BIN64_SIGNED).
--- 1 row(s) selected.
>>
To see that the predicate is returning TRUE when it shouldn't (and hence that
the overflow must be coming from the expression B+10), observe:
>>select b from t003t2 where b = 2 or b = -1;
B
--------------------
2
18446744073709551615
--- 2 row(s) selected.
>>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)