Skip to content

Commit 09940f4

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

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#coding:utf-8
2+
3+
"""
4+
ID: n/a
5+
ISSUE: https://dl.acm.org/doi/pdf/10.1145/3428279
6+
TITLE: predicate 0 = -0 to incorrectly evaluate to FALSE.
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 2 listing 1
12+
NOTES:
13+
[01.06.2025] pzotov
14+
Bug exists on Firebird 3.0.13.33807 (18.04.2025).
15+
"""
16+
17+
import pytest
18+
from firebird.qa import *
19+
20+
db = db_factory()
21+
22+
test_script = """
23+
set list on;
24+
recreate table t0 ( c0 int );
25+
recreate table t1 ( c0 double precision );
26+
commit;
27+
28+
insert into t0 values (0) ;
29+
insert into t1 values ( -0e0 );
30+
31+
-- select (t0.c0 = t1.c0) is true from t0 cross join t1;
32+
set count on;
33+
34+
select t0.c0 as q1_t0_c0, t1.c0 as q1_t1_c0
35+
from t0 cross join t1 where t0.c0 = t1.c0 ; -- expected: {0, -0}; found: {}
36+
----------------------------------------------------------------------
37+
select t0.c0 as q2_t0_c0, t1.c0 as q2_t1_c0 from t0 cross join t1 where t0.c0 = t1.c0
38+
union all
39+
select * from t0 cross join t1 where not ( t0.c0 = t1.c0 )
40+
union all
41+
select * from t0 cross join t1 where ( t0.c0 = t1.c0 ) is null ; -- -- expected: {0, -0}; found: {}
42+
----------------------------------------------------------------------
43+
"""
44+
45+
act = isql_act('db', test_script, substitutions=[('[ \t]+', ' ')])
46+
47+
@pytest.mark.version('>=4.0')
48+
def test_1(act: Action):
49+
act.expected_stdout = """
50+
Q1_T0_C0 0
51+
Q1_T1_C0 -0.000000000000000
52+
Records affected: 1
53+
54+
Q2_T0_C0 0
55+
Q2_T1_C0 -0.000000000000000
56+
Records affected: 1
57+
"""
58+
act.execute(combine_output = True)
59+
assert act.clean_stdout == act.clean_expected_stdout

0 commit comments

Comments
 (0)