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

85 lines
1.6 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID: issue-5234
ISSUE: 5234
TITLE: Dialect 1 casting date to string breaks when in the presence a domain with a check constraint
DESCRIPTION:
JIRA: CORE-4943
FBTEST: bugs.core_4943
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(sql_dialect=1)
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
-- Confirmed fail on build 2.5.5.26916.
-- Works fine on: 2.5.5.26933, 3.0.0.32052
set wng off;
set term ^;
create domain dm_without_chk as varchar(5);
^
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
create or alter procedure sp_test1
returns (
retDate varchar(25)
,out_without_chk dm_without_chk
) as
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
begin
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
out_without_chk = 'qwe';
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
retDate = cast('today' as date);
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
suspend;
end
^
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
create domain dm_with_check as varchar(5)
check (value is null or value in ('qwe', 'rty'))
^
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
create or alter procedure sp_test2
returns (
retDate varchar(25)
,out_with_check dm_with_check
) as
begin
out_with_check = 'rty';
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
retDate = cast('today' as date);
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
suspend;
end
^
set term ;^
commit;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
set list on;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
select iif(char_length(retDate)<=11, 1, 0) as sp_test1_format_ok
from sp_test1;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
select iif(char_length(retDate)<=11, 1, 0) as sp_test2_format_ok
from sp_test2;
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
SP_TEST1_FORMAT_OK 1
SP_TEST2_FORMAT_OK 1
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
@pytest.mark.version('>=3')
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