Skip to content

Commit 3a97423

Browse files
committed
Added/Updated tests\bugs\core_2508_test.py: Replaced query so that DIFFERENT indices are involved (because WHERE-expression refers to diff. columns). See notes.
1 parent 5b86af0 commit 3a97423

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

tests/bugs/core_2508_test.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
DESCRIPTION:
88
JIRA: CORE-2508
99
FBTEST: bugs.core_2508
10+
NOTES:
11+
[06.09.2023]
12+
Replaced query so that DIFFERENT indices are involved (because WHERE-expression refers to diff. columns).
13+
This is needed in FB 4.x+ after:
14+
https://github.com/FirebirdSQL/firebird/commit/0493422c9f729e27be0112ab60f77e753fabcb5b
15+
("Better processing and optimization if IN <list> predicates (#7707)")
16+
Old query that did use IN predicate no more applicable here: all occurences of the same index
17+
that works for mining data are now "collapsed" to the single one, i.e.:
18+
PLAN (<tabname> INDEX (<idxname>, <idxname>, <idxname>)) ==> PLAN (<tabname> INDEX (<idxname>)).
1019
"""
1120

1221
import pytest
@@ -15,28 +24,32 @@
1524
db = db_factory()
1625

1726
test_script = """
18-
create table t(a int not null);
27+
create sequence g;
28+
create table t(a int, b int);
29+
insert into t(a,b) select gen_id(g,1),gen_id(g,1) from rdb$types;
30+
commit;
1931
create index "abc(" on t(a);
32+
create descending index "mod(" on t(b);
2033
set planonly;
21-
select * from t where a in (0, 1, 2);
22-
-- This will produce in 2.5.x:
23-
-- PLAN (T INDEX (abc(abc(abc())
24-
-- ^^^ ^^^
25-
-- | |
26-
-- +---+--- NO commas here!
27-
-- Compare with 3.0:
28-
-- PLAN (T INDEX (abc(, abc(, abc())
34+
select * from t where a <= 33 and b >= 22;
35+
36+
-- On 2.5.9.27156 plan for that query was:
37+
-- PLAN (T INDEX (abc(mod())
38+
-- ^^^
39+
-- |
40+
-- +---- NO comma here!
41+
-- Compare with 3.x:
42+
-- PLAN (T INDEX (abc(, mod())
2943
"""
3044

3145
act = isql_act('db', test_script)
3246

3347
expected_stdout = """
34-
PLAN (T INDEX (abc(, abc(, abc())
48+
PLAN (T INDEX (abc(, mod())
3549
"""
3650

3751
@pytest.mark.version('>=3.0')
3852
def test_1(act: Action):
3953
act.expected_stdout = expected_stdout
4054
act.execute()
4155
assert act.clean_stdout == act.clean_expected_stdout
42-

0 commit comments

Comments
 (0)