6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_3312_test.py

43 lines
1.1 KiB
Python

#coding:utf-8
"""
ID: issue-3679
ISSUE: 3679
TITLE: Sub-optimal join plan when the slave table depends on the master one via the OR predicate
DESCRIPTION:
JIRA: CORE-3312
FBTEST: bugs.core_3312
"""
import pytest
from firebird.qa import *
db = db_factory()
test_script = """SET PLANONLY ON;
select *
from rdb$relations r
join rdb$security_classes sc
on (r.rdb$security_class = sc.rdb$security_class
or r.rdb$default_class = sc.rdb$security_class);
select *
from rdb$relations r
join rdb$security_classes sc
on (r.rdb$security_class = sc.rdb$security_class and r.rdb$relation_id = 0)
or (r.rdb$default_class = sc.rdb$security_class and r.rdb$relation_id = 1);
"""
act = isql_act('db', test_script)
expected_stdout = """
PLAN JOIN (R NATURAL, SC INDEX (RDB$INDEX_7, RDB$INDEX_7))
PLAN JOIN (R INDEX (RDB$INDEX_1, RDB$INDEX_1), SC INDEX (RDB$INDEX_7, RDB$INDEX_7))
"""
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout