Skip to content

Commit e593ab8

Browse files
committed
Added/Updated tests\functional\sqlancer\doi_10_1145_3428279_example_02_test.py: adapted from article provided in SQLancer documentation.
1 parent 09940f4 commit e593ab8

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#coding:utf-8
2+
3+
"""
4+
ID: n/a
5+
ISSUE: https://dl.acm.org/doi/pdf/10.1145/3428279
6+
TITLE: Wrong result of UNION DISTINCT
7+
DESCRIPTION:
8+
Manuel Rigger and Zhendong Su
9+
Finding Bugs in Database Systems via Query Partitioning
10+
https://dl.acm.org/doi/pdf/10.1145/3428279
11+
page 10 listing 2
12+
"""
13+
14+
import pytest
15+
from firebird.qa import *
16+
17+
db = db_factory()
18+
19+
test_script = """
20+
set list on;
21+
recreate view v0 as select 1 x from rdb$database;
22+
recreate table t0 ( c0 int );
23+
recreate view v0 as select cast ( t0.c0 as integer ) as c0 from t0;
24+
25+
insert into t0 ( c0 ) values (0);
26+
27+
set count on;
28+
29+
select distinct t0.c0 as q1_table_c0, v0.c0 as q1_view_c0
30+
from t0 left outer join v0 on v0.c0 >= '0'; -- expected = found = {0|0}
31+
32+
select t0.c0 as q2_table_c0, v0.c0 as q2_view_c0 from t0 left outer join v0 on v0.c0 >= '0' where true
33+
union
34+
select * from t0 left join v0 on v0.c0 >= '0' where not true
35+
union
36+
select * from t0 left join v0 on v0.c0 >= '0' where true is null ; -- expected: {0|0}, found: {0|null}
37+
"""
38+
39+
act = isql_act('db', test_script, substitutions=[('[ \t]+', ' ')])
40+
41+
@pytest.mark.version('>=3.0')
42+
def test_1(act: Action):
43+
act.expected_stdout = """
44+
Q1_TABLE_C0 0
45+
Q1_VIEW_C0 0
46+
Records affected: 1
47+
48+
Q2_TABLE_C0 0
49+
Q2_VIEW_C0 0
50+
Records affected: 1
51+
"""
52+
act.execute(combine_output = True)
53+
assert act.clean_stdout == act.clean_expected_stdout

0 commit comments

Comments
 (0)