6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_4118_test.py

40 lines
847 B
Python

#coding:utf-8
"""
ID: issue-4446
ISSUE: 4446
TITLE: Expression index may be not used for derived fields or view fields
DESCRIPTION:
JIRA: CORE-4118
FBTEST: bugs.core_4118
"""
import pytest
from firebird.qa import *
init_script = """create table t (id int, d timestamp);
create index itd on t computed (cast(d as date));
COMMIT;
"""
db = db_factory(init=init_script)
test_script = """SET PLAN ON;
select * from t where cast(d as date) = current_date;
select * from (select id, cast(d as date) as d from t) where d = current_date;
"""
act = isql_act('db', test_script)
expected_stdout = """
PLAN (T INDEX (ITD))
PLAN (T INDEX (ITD))
"""
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout