Skip to content

Commit 310b2c2

Browse files
committed
Added/Updated tests\bugs\gh_7995_test.py: Checked on 5.0.1.1332 (commit ffb54229).
1 parent 82254e5 commit 310b2c2

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

tests/bugs/gh_7995_test.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#coding:utf-8
2+
3+
"""
4+
ID: issue-7995
5+
ISSUE: https://github.com/FirebirdSQL/firebird/issues/7995
6+
TITLE: Unexpected results after creating partial index
7+
NOTES:
8+
[07.02.2024] pzotov
9+
Confirmed bug on 6.0.0.249, 5.0.1.1331.
10+
Checked on 5.0.1.1332 (commit ffb54229).
11+
"""
12+
13+
import pytest
14+
from firebird.qa import *
15+
16+
db = db_factory()
17+
18+
test_script = """
19+
recreate table t0(c0 boolean);
20+
recreate table t1(c0 int, c1 int);
21+
create unique index t1i0 on t1(c0) where ( t1.c0 is not null );
22+
23+
insert into t0 (c0) values (true);
24+
insert into t0 (c0) values (false);
25+
insert into t1 (c0, c1) values (0, 1);
26+
insert into t1 (c0) values (1);
27+
insert into t1 (c0) values (2);
28+
insert into t1 (c0) values (3);
29+
insert into t1 (c0) values (4);
30+
insert into t1 (c0) values (5);
31+
insert into t1 (c0) values (6);
32+
insert into t1 (c0) values (7);
33+
insert into t1 (c0) values (8);
34+
insert into t1 (c0) values (9);
35+
insert into t1 (c0) values (10); -- at least 11 rows data
36+
37+
set heading off;
38+
set count on;
39+
40+
select ((true or t1.c1 > 0)and(t0.c0)) from t1 cross join t0; -- 11 rows of true
41+
42+
select t1.c0 as t1_c0, t1.c1 as t1_c1, t0.c0 as t0_c0 from t1 cross join t0 where ( (true or t1.c1 > 0) and t0.c0);
43+
"""
44+
45+
act = isql_act('db', test_script, substitutions = [('[ \t]+', ' ')])
46+
47+
expected_stdout = """
48+
<true>
49+
<true>
50+
<true>
51+
<true>
52+
<true>
53+
<true>
54+
<true>
55+
<true>
56+
<true>
57+
<true>
58+
<true>
59+
<false>
60+
<false>
61+
<false>
62+
<false>
63+
<false>
64+
<false>
65+
<false>
66+
<false>
67+
<false>
68+
<false>
69+
<false>
70+
71+
Records affected: 22
72+
73+
0 1 <true>
74+
1 <null> <true>
75+
2 <null> <true>
76+
3 <null> <true>
77+
4 <null> <true>
78+
5 <null> <true>
79+
6 <null> <true>
80+
7 <null> <true>
81+
8 <null> <true>
82+
9 <null> <true>
83+
10 <null> <true>
84+
85+
Records affected: 11
86+
"""
87+
88+
@pytest.mark.version('>=5.0.1')
89+
def test_1(act: Action):
90+
act.expected_stdout = expected_stdout
91+
act.execute(combine_output = True)
92+
assert act.clean_stdout == act.clean_expected_stdout

0 commit comments

Comments
 (0)