2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
|
|
|
ID: issue-3721
|
|
|
|
ISSUE: 3721
|
|
|
|
TITLE: Wrong comparsion of DATE and TIMESTAMP if index is used
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-3355
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_3355
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
init_script = """create table tdate (id integer not null primary key, val date);
|
2021-04-26 20:07:00 +02:00
|
|
|
create index tdateix1 on tdate (val);
|
|
|
|
commit;
|
|
|
|
insert into tdate values (0, '1997-12-31');
|
|
|
|
insert into tdate values (1, '1998-01-01');
|
|
|
|
insert into tdate values (2, '1998-01-02');
|
|
|
|
insert into tdate values (3, '1998-01-03');
|
|
|
|
insert into tdate values (4, '1998-01-04');
|
|
|
|
insert into tdate values (5, '1998-01-05');
|
|
|
|
commit;
|
|
|
|
"""
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
db = db_factory(init=init_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
test_script = """select count(*) from tdate where val >= timestamp'1998-01-04 12:00:00.0000';
|
2021-04-26 20:07:00 +02:00
|
|
|
select count(*) from tdate where val < timestamp'1998-01-04 12:00:00.0000';
|
|
|
|
"""
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
COUNT
|
|
|
|
=====================
|
|
|
|
1
|
|
|
|
|
|
|
|
|
|
|
|
COUNT
|
|
|
|
=====================
|
|
|
|
5
|
|
|
|
"""
|
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-22 21:59:15 +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
|
|
|
|