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

59 lines
1.7 KiB
Python
Raw Normal View History

2021-04-28 11:54:08 +02:00
#coding:utf-8
2022-01-27 20:08:36 +01:00
"""
ID: issue-6734
ISSUE: 6734
TITLE: Provide same results for date arithmetics when date is changed by values near +/-max(bigint)
DESCRIPTION:
JIRA: CORE-6504
FBTEST: bugs.core_6504
2022-01-27 20:08:36 +01:00
"""
2021-04-28 11:54:08 +02:00
2022-01-27 20:08:36 +01:00
import pytest
from firebird.qa import *
2021-04-28 11:54:08 +02:00
2022-01-27 20:08:36 +01:00
db = db_factory()
2021-04-28 11:54:08 +02:00
2022-01-27 20:08:36 +01:00
test_script = """
2021-04-28 11:54:08 +02:00
set heading off;
-- All following statements must raise SQLSTATE = 22008.
-- On LINUX builds before 4.0.0.2437 statements NN 5 and 6
-- did not raise error. Instead, they issued date = 2020-02-01:
select 1 as chk_1, date '01.02.2020' + 9223372036854775807 from rdb$database;
select 2 as chk_2, date '01.02.2020' + -9223372036854775807 from rdb$database;
select 3 as chk_3, date '01.02.2020' - 9223372036854775807 from rdb$database;
select 4 as chk_4, date '01.02.2020' - -9223372036854775807 from rdb$database;
select 5 as chk_5, date '01.02.2020' + -9223372036854775808 from rdb$database;
select 6 as chk_6, date '01.02.2020' - -9223372036854775808 from rdb$database;
2021-12-22 20:23:11 +01:00
"""
2021-04-28 11:54:08 +02:00
2022-01-27 20:08:36 +01:00
act = isql_act('db', test_script)
2021-04-28 11:54:08 +02:00
2022-01-27 20:08:36 +01:00
expected_stderr = """
2021-04-28 11:54:08 +02:00
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates
2021-12-22 20:23:11 +01:00
"""
2021-04-28 11:54:08 +02:00
@pytest.mark.version('>=4.0')
2022-01-27 20:08:36 +01:00
def test_1(act: Action):
act.expected_stderr = expected_stderr
act.execute()
assert act.clean_stderr == act.clean_expected_stderr