Skip to content
This repository was archived by the owner on Jun 7, 2021. It is now read-only.

Commit c1b3e25

Browse files
committed
Add some tests with NULL and composite predicates.
1 parent 24158ee commit c1b3e25

2 files changed

Lines changed: 79 additions & 5 deletions

File tree

core/sql/regress/core/EXPECTED001.SB

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
>>invoke t001t1;
1515

1616
-- Definition of Trafodion table TRAFODION.SCH.T001T1
17-
-- Definition current Mon Aug 27 15:59:38 2018
17+
-- Definition current Fri Nov 16 17:12:39 2018
1818

1919
(
2020
SYSKEY LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -32,7 +32,7 @@
3232
>>invoke $$TEST_SCHEMA$$.t001ut1;
3333

3434
-- Definition of Trafodion table TRAFODION.SCH.T001UT1
35-
-- Definition current Mon Aug 27 15:59:39 2018
35+
-- Definition current Fri Nov 16 17:12:40 2018
3636

3737
(
3838
SYSKEY LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -445,13 +445,75 @@ A
445445
.0
446446

447447
--- 1 row(s) selected.
448-
>>cqd pcode_opt_level 'on';
448+
>>
449+
>>select case when cast(null as int) > 0 and 2>1 then 1/0 else 0 end from dual;
449450

450-
--- SQL operation complete.
451+
(EXPR)
452+
-------
453+
454+
.0
455+
456+
--- 1 row(s) selected.
457+
>>select case when cast(null as int) > 0 or 2>1 then 1/0 else 0 end from dual;
458+
459+
*** ERROR[8419] An arithmetic expression attempted a division by zero.
460+
461+
--- 0 row(s) selected.
462+
>>
463+
>>select case when cast(null as int) > 0 and 2>3 then 1/0 else 0 end from dual;
464+
465+
(EXPR)
466+
-------
467+
468+
.0
469+
470+
--- 1 row(s) selected.
471+
>>select case when cast(null as int) > 0 or 2>3 then 1/0 else 0 end from dual;
472+
473+
(EXPR)
474+
-------
475+
476+
.0
477+
478+
--- 1 row(s) selected.
451479
>>
452480
>>-- PCODE way
481+
>>cqd pcode_opt_level 'on';
482+
483+
--- SQL operation complete.
453484
>>select case when cast(null as int) > 0 then 1/0 else 0 end from dual;
454485

486+
(EXPR)
487+
-------
488+
489+
.0
490+
491+
--- 1 row(s) selected.
492+
>>
493+
>>select case when cast(null as int) > 0 and 2>1 then 1/0 else 0 end from dual;
494+
495+
(EXPR)
496+
-------
497+
498+
.0
499+
500+
--- 1 row(s) selected.
501+
>>select case when cast(null as int) > 0 or 2>1 then 1/0 else 0 end from dual;
502+
503+
*** ERROR[8419] An arithmetic expression attempted a division by zero.
504+
505+
--- 0 row(s) selected.
506+
>>
507+
>>select case when cast(null as int) > 0 and 2>3 then 1/0 else 0 end from dual;
508+
509+
(EXPR)
510+
-------
511+
512+
.0
513+
514+
--- 1 row(s) selected.
515+
>>select case when cast(null as int) > 0 or 2>3 then 1/0 else 0 end from dual;
516+
455517
(EXPR)
456518
-------
457519

core/sql/regress/core/TEST001

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,23 @@ select (case a when 1 then 1 when 2 then 2 else null end) from t001t1; -- ok
131131
-- clause way
132132
cqd pcode_opt_level 'off';
133133
select case when cast(null as int) > 0 then 1/0 else 0 end from dual;
134-
cqd pcode_opt_level 'on';
134+
135+
select case when cast(null as int) > 0 and 2>1 then 1/0 else 0 end from dual;
136+
select case when cast(null as int) > 0 or 2>1 then 1/0 else 0 end from dual;
137+
138+
select case when cast(null as int) > 0 and 2>3 then 1/0 else 0 end from dual;
139+
select case when cast(null as int) > 0 or 2>3 then 1/0 else 0 end from dual;
135140

136141
-- PCODE way
142+
cqd pcode_opt_level 'on';
137143
select case when cast(null as int) > 0 then 1/0 else 0 end from dual;
138144

145+
select case when cast(null as int) > 0 and 2>1 then 1/0 else 0 end from dual;
146+
select case when cast(null as int) > 0 or 2>1 then 1/0 else 0 end from dual;
147+
148+
select case when cast(null as int) > 0 and 2>3 then 1/0 else 0 end from dual;
149+
select case when cast(null as int) > 0 or 2>3 then 1/0 else 0 end from dual;
150+
139151
select a from t001t1 where null is null; -- ok
140152
select a from t001t1 where null is not null; -- ok (0 rows)
141153

0 commit comments

Comments
 (0)