Skip to content

Commit 835409b

Browse files
committed
Added/Updated tests\bugs\gh_7568_test.py: Checked on 6.0.0.247.
1 parent 247f8e0 commit 835409b

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

tests/bugs/gh_7568_test.py

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#coding:utf-8
2+
3+
"""
4+
ID: issue-7568
5+
ISSUE: https://github.com/FirebirdSQL/firebird/issues/7568
6+
TITLE: Equivalence of boolean condition in partial index
7+
NOTES:
8+
[03.02.2024] pzotov
9+
Test is based on https://github.com/FirebirdSQL/firebird/pull/7987
10+
Confirmed problem on 6.0.0.244.
11+
Checked on 6.0.0.247.
12+
"""
13+
14+
import pytest
15+
from firebird.qa import *
16+
17+
db = db_factory()
18+
19+
test_script = """
20+
recreate table test (
21+
id bigint generated always as identity primary key
22+
,int_fld1 bigint not null
23+
,int_fld2 bigint not null
24+
,bool_fld1 boolean default false not null
25+
,bool_fld2 boolean default false not null
26+
);
27+
28+
create index test_idx_offer_asc
29+
on test (int_fld1)
30+
where not bool_fld1;
31+
32+
create descending index test_idx_offer_dec
33+
on test (int_fld2)
34+
where not bool_fld2;
35+
36+
-- all the following sql queries must use appropriate index:
37+
38+
set planonly;
39+
40+
select * from test where not bool_fld1;
41+
42+
select * from test where bool_fld1 = false;
43+
44+
select * from test where false = bool_fld1;
45+
46+
select * from test where bool_fld1 <> true;
47+
48+
select * from test where true <> bool_fld1;
49+
50+
select * from test where not bool_fld1 = true;
51+
52+
select * from test where not true = bool_fld1;
53+
54+
55+
select * from test where not bool_fld2;
56+
57+
select * from test where bool_fld2 = false;
58+
59+
select * from test where false = bool_fld2;
60+
61+
select * from test where bool_fld2 <> true;
62+
63+
select * from test where true <> bool_fld2;
64+
65+
select * from test where not bool_fld2 = true;
66+
67+
select * from test where not true = bool_fld2;
68+
"""
69+
70+
act = isql_act('db', test_script)
71+
72+
expected_stdout = """
73+
PLAN (TEST INDEX (TEST_IDX_OFFER_ASC))
74+
75+
PLAN (TEST INDEX (TEST_IDX_OFFER_ASC))
76+
77+
PLAN (TEST INDEX (TEST_IDX_OFFER_ASC))
78+
79+
PLAN (TEST INDEX (TEST_IDX_OFFER_ASC))
80+
81+
PLAN (TEST INDEX (TEST_IDX_OFFER_ASC))
82+
83+
PLAN (TEST INDEX (TEST_IDX_OFFER_ASC))
84+
85+
PLAN (TEST INDEX (TEST_IDX_OFFER_ASC))
86+
87+
PLAN (TEST INDEX (TEST_IDX_OFFER_DEC))
88+
89+
PLAN (TEST INDEX (TEST_IDX_OFFER_DEC))
90+
91+
PLAN (TEST INDEX (TEST_IDX_OFFER_DEC))
92+
93+
PLAN (TEST INDEX (TEST_IDX_OFFER_DEC))
94+
95+
PLAN (TEST INDEX (TEST_IDX_OFFER_DEC))
96+
97+
PLAN (TEST INDEX (TEST_IDX_OFFER_DEC))
98+
99+
PLAN (TEST INDEX (TEST_IDX_OFFER_DEC))
100+
"""
101+
102+
@pytest.mark.version('>=6.0')
103+
def test_1(act: Action):
104+
act.expected_stdout = expected_stdout
105+
act.execute(combine_output = True)
106+
assert act.clean_stdout == act.clean_expected_stdout

0 commit comments

Comments
 (0)