|
3 | 3 | """
|
4 | 4 | ID: issue-3679
|
5 | 5 | ISSUE: 3679
|
6 |
| -TITLE: Sub-optimal join plan when the slave table depends on the master one via the OR predicate |
| 6 | +TITLE: Sub-optimal join plan when the slave table depends on the master via the "OR" predicate |
7 | 7 | DESCRIPTION:
|
8 | 8 | JIRA: CORE-3312
|
9 | 9 | FBTEST: bugs.core_3312
|
| 10 | +NOTES: |
| 11 | + [27.06.2025] pzotov |
| 12 | + Added substitutions in order to suppress digital suffix of indices name (in 'RDB$INDEX_'). |
| 13 | + Separated expected output for FB major versions prior/since 6.x. |
| 14 | + No substitutions are used to suppress schema and quotes. Discussed with dimitr, 24.06.2025 12:39. |
| 15 | +
|
| 16 | + Checked on 6.0.0.876; 5.0.3.1668; 4.0.6.3214; 3.0.13.33813. |
10 | 17 | """
|
11 | 18 |
|
12 | 19 | import pytest
|
13 | 20 | from firebird.qa import *
|
14 | 21 |
|
15 | 22 | db = db_factory()
|
16 | 23 |
|
17 |
| -test_script = """SET PLANONLY ON; |
| 24 | +test_script = """ |
| 25 | +SET PLANONLY ON; |
18 | 26 | select *
|
19 | 27 | from rdb$relations r
|
20 | 28 | join rdb$security_classes sc
|
|
27 | 35 | or (r.rdb$default_class = sc.rdb$security_class and r.rdb$relation_id = 1);
|
28 | 36 | """
|
29 | 37 |
|
30 |
| -act = isql_act('db', test_script) |
31 | 38 |
|
32 |
| -expected_stdout = """ |
33 |
| -PLAN JOIN (R NATURAL, SC INDEX (RDB$INDEX_7, RDB$INDEX_7)) |
34 |
| -PLAN JOIN (R INDEX (RDB$INDEX_1, RDB$INDEX_1), SC INDEX (RDB$INDEX_7, RDB$INDEX_7)) |
| 39 | +substitutions = [ ('[ \t]+', ' '), ('RDB\\$INDEX_\\d+', 'RDB$INDEX_*') ] |
| 40 | +act = isql_act('db', test_script, substitutions = substitutions) |
| 41 | + |
| 42 | + |
| 43 | +expected_out_5x = """ |
| 44 | + PLAN JOIN (R NATURAL, SC INDEX (RDB$INDEX_*, RDB$INDEX_*)) |
| 45 | + PLAN JOIN (R INDEX (RDB$INDEX_*, RDB$INDEX_*), SC INDEX (RDB$INDEX_*, RDB$INDEX_*)) |
35 | 46 | """
|
36 | 47 |
|
| 48 | +expected_out_6x = """ |
| 49 | + PLAN JOIN ("R" NATURAL, "SC" INDEX ("SYSTEM"."RDB$INDEX_*", "SYSTEM"."RDB$INDEX_*")) |
| 50 | + PLAN JOIN ("R" INDEX ("SYSTEM"."RDB$INDEX_*", "SYSTEM"."RDB$INDEX_*"), "SC" INDEX ("SYSTEM"."RDB$INDEX_*", "SYSTEM"."RDB$INDEX_*")) |
| 51 | +""" |
| 52 | + |
| 53 | +@pytest.mark.intl |
37 | 54 | @pytest.mark.version('>=3')
|
38 | 55 | def test_1(act: Action):
|
39 |
| - act.expected_stdout = expected_stdout |
40 |
| - act.execute() |
| 56 | + act.expected_stdout = expected_out_5x if act.is_version('<6') else expected_out_6x |
| 57 | + act.execute(combine_output = True) |
41 | 58 | assert act.clean_stdout == act.clean_expected_stdout
|
42 |
| - |
|
0 commit comments