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

56 lines
1.6 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID: issue-5041
ISSUE: 5041
TITLE: Expression 'where bool_field IS true | false' should also use index as
'where bool_field = true | false' (if such index exists)
2022-01-24 20:27:02 +01:00
DESCRIPTION:
NOTES:
[28.01.2019]
Changed expected PLAN of execution after dimitr's letter 28.01.2019 17:28:
'is NOT <bool>' and 'is distinct from <bool>' should use PLAN NATURAL.
JIRA: CORE-4735
FBTEST: bugs.core_4735
2022-01-24 20:27:02 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
recreate table test(x boolean, unique(x) using index test_x);
commit;
set plan on;
select 1 from test where x = true ;
select 1 from test where x is true ;
select 0 from test where x = false ;
select 0 from test where x is false ;
select 1 from test where x is not true ; -- this must have plan NATURAL, 26.01.2019
select 1 from test where x is distinct from true ; -- this must have plan NATURAL, 26.01.2019
select 1 from test where x is not false ; -- this must have plan NATURAL, 26.01.2019
select 1 from test where x is distinct from false ; -- this must have plan NATURAL, 26.01.2019
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
PLAN (TEST INDEX (TEST_X))
PLAN (TEST INDEX (TEST_X))
PLAN (TEST INDEX (TEST_X))
PLAN (TEST INDEX (TEST_X))
PLAN (TEST NATURAL)
PLAN (TEST NATURAL)
PLAN (TEST NATURAL)
PLAN (TEST NATURAL)
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-24 20:27:02 +01:00
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