mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 21:43:06 +01:00
88 lines
1.9 KiB
Python
88 lines
1.9 KiB
Python
|
#coding:utf-8
|
||
|
#
|
||
|
# id: bugs.gh_6854
|
||
|
# title: Crash occurs when use SIMILAR TO ...
|
||
|
# decription:
|
||
|
# https://github.com/FirebirdSQL/firebird/issues/6854
|
||
|
#
|
||
|
# Confirmed crash on: 5.0.0.78; 4.0.0.2508; 3.0.8.33452
|
||
|
# Checked on: 5.0.0.79; 4.0.1.2517; 3.0.8.33474
|
||
|
#
|
||
|
# tracker_id:
|
||
|
# min_versions: ['3.0.8']
|
||
|
# versions: 3.0.8
|
||
|
# qmid: None
|
||
|
|
||
|
import pytest
|
||
|
from firebird.qa import db_factory, isql_act, Action
|
||
|
|
||
|
# version: 3.0.8
|
||
|
# resources: None
|
||
|
|
||
|
substitutions_1 = []
|
||
|
|
||
|
init_script_1 = """"""
|
||
|
|
||
|
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||
|
|
||
|
test_script_1 = """
|
||
|
set list on;
|
||
|
recreate table test(
|
||
|
id int generated by default as identity constraint pk_txt primary key
|
||
|
,txt varchar(1) character set utf8
|
||
|
);
|
||
|
|
||
|
insert into test(txt) values('A');
|
||
|
insert into test(txt) values('B');
|
||
|
|
||
|
set term ^;
|
||
|
execute block returns(
|
||
|
o_id int
|
||
|
,o_gds1 int
|
||
|
,o_gds2 int
|
||
|
) as
|
||
|
declare b boolean;
|
||
|
begin
|
||
|
for select id, txt from test as cursor c
|
||
|
do begin
|
||
|
begin
|
||
|
b = c.txt similar to 'A{0,1}';
|
||
|
when any do
|
||
|
begin
|
||
|
o_gds1 = gdscode;
|
||
|
end
|
||
|
end
|
||
|
|
||
|
begin
|
||
|
b = c.txt similar to 'A{X,1}';
|
||
|
when any do
|
||
|
begin
|
||
|
o_gds2 = gdscode;
|
||
|
end
|
||
|
end
|
||
|
o_id = c.id;
|
||
|
suspend;
|
||
|
|
||
|
end
|
||
|
end
|
||
|
^
|
||
|
set term ^;
|
||
|
"""
|
||
|
|
||
|
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||
|
|
||
|
expected_stdout_1 = """
|
||
|
O_ID 1
|
||
|
O_GDS1 <null>
|
||
|
O_GDS2 335544884
|
||
|
O_ID 2
|
||
|
O_GDS1 <null>
|
||
|
O_GDS2 335544884
|
||
|
"""
|
||
|
|
||
|
@pytest.mark.version('>=3.0.8')
|
||
|
def test_1(act_1: Action):
|
||
|
act_1.expected_stdout = expected_stdout_1
|
||
|
act_1.execute()
|
||
|
assert act_1.clean_stdout == act_1.clean_expected_stdout
|