From 3a97423b63241ec35d15e3d086f7555e4a8ae77a Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Wed, 6 Sep 2023 11:12:58 +0300 Subject: [PATCH] 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. --- tests/bugs/core_2508_test.py | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/tests/bugs/core_2508_test.py b/tests/bugs/core_2508_test.py index 932f8545..d150a8db 100644 --- a/tests/bugs/core_2508_test.py +++ b/tests/bugs/core_2508_test.py @@ -7,6 +7,15 @@ TITLE: Tricky index names can defeat the parsing logic when generating a h DESCRIPTION: JIRA: CORE-2508 FBTEST: bugs.core_2508 +NOTES: + [06.09.2023] + Replaced query so that DIFFERENT indices are involved (because WHERE-expression refers to diff. columns). + This is needed in FB 4.x+ after: + https://github.com/FirebirdSQL/firebird/commit/0493422c9f729e27be0112ab60f77e753fabcb5b + ("Better processing and optimization if IN predicates (#7707)") + Old query that did use IN predicate no more applicable here: all occurences of the same index + that works for mining data are now "collapsed" to the single one, i.e.: + PLAN ( INDEX (, , )) ==> PLAN ( INDEX ()). """ import pytest @@ -15,23 +24,28 @@ from firebird.qa import * db = db_factory() test_script = """ - create table t(a int not null); + create sequence g; + create table t(a int, b int); + insert into t(a,b) select gen_id(g,1),gen_id(g,1) from rdb$types; + commit; create index "abc(" on t(a); + create descending index "mod(" on t(b); set planonly; - select * from t where a in (0, 1, 2); - -- This will produce in 2.5.x: - -- PLAN (T INDEX (abc(abc(abc()) - -- ^^^ ^^^ - -- | | - -- +---+--- NO commas here! - -- Compare with 3.0: - -- PLAN (T INDEX (abc(, abc(, abc()) + select * from t where a <= 33 and b >= 22; + + -- On 2.5.9.27156 plan for that query was: + -- PLAN (T INDEX (abc(mod()) + -- ^^^ + -- | + -- +---- NO comma here! + -- Compare with 3.x: + -- PLAN (T INDEX (abc(, mod()) """ act = isql_act('db', test_script) expected_stdout = """ - PLAN (T INDEX (abc(, abc(, abc()) + PLAN (T INDEX (abc(, mod()) """ @pytest.mark.version('>=3.0') @@ -39,4 +53,3 @@ def test_1(act: Action): act.expected_stdout = expected_stdout act.execute() assert act.clean_stdout == act.clean_expected_stdout -