6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_3421_test.py

75 lines
2.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-3784
ISSUE: 3784
TITLE: [FB3] AV with "UPDATE OR INSERT"
DESCRIPTION:
JIRA: CORE-3421
"""
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 = """
2021-04-26 20:07:00 +02:00
create or alter procedure sp_test as begin end;
commit;
recreate table test(
id bigint constraint test_id_pk primary key using index test_id_pk,
s01 varchar(512)
);
commit;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
set term ^;
create or alter procedure sp_test( a_id type of column test.id, a_s01 type of column test.s01)
2022-01-22 21:59:15 +01:00
returns(o_id type of column test.id, o_s01 type of column test.s01)
2021-04-26 20:07:00 +02:00
as
begin
execute statement ('update or insert into test(id, s01) values( :x, :y ) returning id, s01')
( x := a_id, y := a_s01 )
into o_id, o_s01;
suspend;
end
^
set term ;^
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
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 = """
2021-04-26 20:07:00 +02:00
set list on;
set sqlda_display on;
set planonly;
set term ^;
2022-01-22 21:59:15 +01:00
execute block returns(o_id type of column test.id, o_s01 type of column test.s01)
2021-04-26 20:07:00 +02:00
as
begin
execute procedure sp_test(1, rpad('',512,'9876543210mnbvcxzasdfghjklpoiuytrewq')) returning_values o_id, o_s01;
suspend;
2022-01-22 21:59:15 +01:00
end
2021-04-26 20:07:00 +02:00
^
set term ;^
execute procedure sp_test(1, rpad('',512,'abcdefghjklmnopqrstuwwxyz012345678'));
select * from sp_test(1, rpad('',512,'0123456789abcdefghjklmnopqrstuwwxyz'));
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
act = isql_act('db', test_script, substitutions=[('^((?!sqltype|DTS_DIFF).)*$', ''),
('[ ]+', ' '), ('[\t]*', ' ')])
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
01: sqltype: 580 INT64 Nullable scale: 0 subtype: 0 len: 8
02: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 512 charset: 0 NONE
01: sqltype: 580 INT64 Nullable scale: 0 subtype: 0 len: 8
02: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 512 charset: 0 NONE
01: sqltype: 580 INT64 Nullable scale: 0 subtype: 0 len: 8
02: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 512 charset: 0 NONE
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@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