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

73 lines
1.8 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-21 18:49:26 +01:00
"""
ID: issue-3204
ISSUE: 3204
TITLE: If stored procedure or trigger contains query with PLAN ORDER it could fail
after disconnect of attachment where procedure/trigger executed first time
2022-01-21 18:49:26 +01:00
DESCRIPTION:
JIRA: CORE-2817
FBTEST: bugs.core_2817
2022-01-21 18:49:26 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
create sequence g;
create or alter procedure sp_test returns(cnt int) as begin end;
recreate table test(
x int,
s varchar(1000)
);
commit;
insert into test(x, s)
select gen_id(g,1), rpad('', 1000, uuid_to_char(gen_uuid()))
from rdb$types, rdb$types
rows 1000;
commit;
create index test_x on test(x);
create index test_s on test(s);
commit;
set term ^;
create or alter procedure sp_test(a_odd smallint) as
declare c_ord cursor for (
2021-11-16 19:44:53 +01:00
select s
from test
where mod(x, 2) = :a_odd
2021-04-26 20:07:00 +02:00
order by x
);
declare v_s type of column test.s;
begin
open c_ord;
while (1=1) do
begin
fetch c_ord into v_s;
if (row_count = 0) then leave;
update test set s = uuid_to_char(gen_uuid()) where current of c_ord;
end
close c_ord;
end
^ -- sp_test
set term ;^
2021-11-16 19:44:53 +01:00
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=2.5')
2022-01-21 18:49:26 +01:00
def test_1(act: Action):
with act.db.connect() as att2:
with act.db.connect() as att1:
2021-11-16 19:44:53 +01:00
cur1 = att1.cursor()
cur2 = att2.cursor()
cur1.execute('execute procedure sp_test(0)')
cur2.execute('execute procedure sp_test(1)')
att1.commit()
cur2.execute('execute procedure sp_test(1)')