|
7 | 7 | DESCRIPTION: |
8 | 8 | JIRA: CORE-2508 |
9 | 9 | 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>)). |
10 | 19 | """ |
11 | 20 |
|
12 | 21 | import pytest |
|
15 | 24 | db = db_factory() |
16 | 25 |
|
17 | 26 | 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; |
19 | 31 | create index "abc(" on t(a); |
| 32 | + create descending index "mod(" on t(b); |
20 | 33 | 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()) |
29 | 43 | """ |
30 | 44 |
|
31 | 45 | act = isql_act('db', test_script) |
32 | 46 |
|
33 | 47 | expected_stdout = """ |
34 | | - PLAN (T INDEX (abc(, abc(, abc()) |
| 48 | + PLAN (T INDEX (abc(, mod()) |
35 | 49 | """ |
36 | 50 |
|
37 | 51 | @pytest.mark.version('>=3.0') |
38 | 52 | def test_1(act: Action): |
39 | 53 | act.expected_stdout = expected_stdout |
40 | 54 | act.execute() |
41 | 55 | assert act.clean_stdout == act.clean_expected_stdout |
42 | | - |
|
0 commit comments