2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
"""
|
|
|
|
ID: issue-6308
|
|
|
|
ISSUE: 6308
|
|
|
|
TITLE: Change behavior of skipped and repeated wall times within time zones
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-6058
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_6058
|
2022-01-26 21:10:46 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
-- Change behavior of skipped and repeated wall times within time zones
|
|
|
|
-- Within time zones, some wall times does not exist (DST starting) or repeats twice (DST ending).
|
|
|
|
|
|
|
|
set heading off;
|
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
-- is repeated twice (fall backward), but it must be interpreted as 1:30 AM UTC-04 instead of 1:30 AM UTC-05"
|
2021-04-26 20:07:00 +02:00
|
|
|
select timestamp '2017-11-05 01:30 America/New_York' from rdb$database;
|
|
|
|
select timestamp '2017-11-05 01:30 -04' from rdb$database;
|
|
|
|
select datediff(
|
2022-01-26 21:10:46 +01:00
|
|
|
second from
|
2021-04-26 20:07:00 +02:00
|
|
|
timestamp '2017-11-05 01:30 America/New_York'
|
2022-01-26 21:10:46 +01:00
|
|
|
to
|
2021-04-26 20:07:00 +02:00
|
|
|
timestamp '2017-11-05 01:30 -04'
|
|
|
|
) from rdb$database;
|
|
|
|
|
|
|
|
|
|
|
|
-- does not exist, but it must be interpreted as 2:30 AM UTC-05 (equivalent to 3:30 AM UTC-04)"
|
|
|
|
select timestamp '2017-03-12 02:30 America/New_York' from rdb$database;
|
|
|
|
select timestamp '2017-03-12 02:30 -05' from rdb$database;
|
|
|
|
select datediff(
|
2022-01-26 21:10:46 +01:00
|
|
|
second from
|
2021-04-26 20:07:00 +02:00
|
|
|
timestamp '2017-03-12 02:30 America/New_York'
|
2022-01-26 21:10:46 +01:00
|
|
|
to
|
2021-04-26 20:07:00 +02:00
|
|
|
timestamp '2017-03-12 02:30 -05'
|
|
|
|
) from rdb$database;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
2017-11-05 01:30:00.0000 America/New_York
|
|
|
|
2017-03-12 03:30:00.0000 America/New_York
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2022-01-26 21:10:46 +01:00
|
|
|
|
|
|
|
expected_stderr = """
|
2021-04-26 20:07:00 +02:00
|
|
|
Statement failed, SQLSTATE = 22009
|
|
|
|
Invalid time zone offset: -04 - must use format +/-hours:minutes and be between -14:00 and +14:00
|
|
|
|
Statement failed, SQLSTATE = 22009
|
|
|
|
Invalid time zone offset: -04 - must use format +/-hours:minutes and be between -14:00 and +14:00
|
|
|
|
Statement failed, SQLSTATE = 22009
|
|
|
|
Invalid time zone offset: -05 - must use format +/-hours:minutes and be between -14:00 and +14:00
|
|
|
|
Statement failed, SQLSTATE = 22009
|
|
|
|
Invalid time zone offset: -05 - must use format +/-hours:minutes and be between -14:00 and +14:00
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=4.0')
|
2022-01-26 21:10:46 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.expected_stderr = expected_stderr
|
|
|
|
act.execute()
|
|
|
|
assert (act.clean_stderr == act.clean_expected_stderr and
|
|
|
|
act.clean_stdout == act.clean_expected_stdout)
|