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_1029_test.py

63 lines
1.5 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-19 17:54:56 +01:00
"""
ID: issue-1444
ISSUE: 1444
TITLE: ad plan in outer joins with IS NULL clauses (dependent on order of predicates)
DESCRIPTION:
JIRA: CORE-1029
FBTEST: bugs.core_1029
2022-01-19 17:54:56 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
init_script = """create table tb1 (id int, col int) ;
2021-04-26 20:07:00 +02:00
create index tbi1 on tb1 (id) ;
create index tbi2 on tb1 (col) ;
insert into tb1 values (1, 1) ;
insert into tb1 values (2, 2) ;
insert into tb1 values (1, null) ;
commit;
"""
2022-01-19 17:54:56 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
test_script = """set plan on;
2021-04-26 20:07:00 +02:00
select * from tb1 a
left join tb1 b on a.id = b.id
where a.col is null and a.col+0 is null;
select * from tb1 a
left join tb1 b on a.id = b.id
where a.col+0 is null and a.col is null;
"""
2022-01-19 17:54:56 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
expected_stdout = """PLAN JOIN (A INDEX (TBI2), B INDEX (TBI1))
2021-04-26 20:07:00 +02:00
ID COL ID COL
============ ============ ============ ============
1 <null> 1 1
1 <null> 1 <null>
PLAN JOIN (A INDEX (TBI2), B INDEX (TBI1))
ID COL ID COL
============ ============ ============ ============
1 <null> 1 1
1 <null> 1 <null>
"""
2022-01-19 17:54:56 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00