David Wayne Birdsall created TRAFODION-3237:
-----------------------------------------------

             Summary: Incorrect results for INTERVAL addition in an uncommon 
case
                 Key: TRAFODION-3237
                 URL: https://issues.apache.org/jira/browse/TRAFODION-3237
             Project: Apache Trafodion
          Issue Type: Bug
          Components: sql-cmp
    Affects Versions: 2.4
            Reporter: David Wayne Birdsall
            Assignee: David Wayne Birdsall


The following script illustrates the problem:
{quote}?section ddl

drop table if exists mytableF_base;

create table mytableF_base (
val int,
"c9" interval day(7) to second default NULL,
"c10" interval day(13) to second(0) default NULL,
"key c10" interval day(13) to second(0) not null default interval 
'1111111111111:01:11:11' day(13) to second(0),
unique ("key c10")
);


?section populateit

insert into mytableF_base values (
0,
interval '0 00:00:00' day(7) to second,
interval '0 00:00:00' day(13) to second(0),
interval '0 00:00:00' day(13) to second(0));

insert into mytableF_base 
select 1, 
"c9" + interval '1' day,
"c10" + interval '1' day, -- gives incorrect result 
"key c10" + interval '1' day -- gives incorrect result 
from mytableF_base
where val = 0;

insert into mytableF_base 
select 23, 
"c9" + interval '1' day,
"c10" + interval '2' day, -- gives correct result
"key c10" + interval '3' day -- gives correct result
from mytableF_base
where val = 0;

select "c10","key c10" from mytableF_base;
{quote}
When run, the last SELECT gives:
{quote}>>select "c10","key c10" from mytableF_base;

c10 key c10 
----------------------- -----------------------

0 00:00:00 0 00:00:00
 1000000 00:00:00 1000000 00:00:00
 2 00:00:00 3 00:00:00

--- 3 row(s) selected.
>>exit;
{quote}
The second line is incorrect; the values are off by a factor of one million.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to