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

120 lines
3.5 KiB
Python

#coding:utf-8
#
# id: bugs.core_4344
# title: Error "no current record for fetch operation" when table inner join procedure inner join table
# decription:
# tracker_id: CORE-4344
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """
create or alter procedure sp_get_f01(a_id int) returns(f01 int) as begin end;
create or alter procedure sp_get_f02(a_id int) returns(f01 int) as begin end;
create or alter procedure sp_get_f03(a_id int) returns(f01 int) as begin end;
create or alter procedure sp_get_f04(a_id int) returns(f01 int) as begin end;
create or alter procedure sp_get_f05(a_id int) returns(f01 int) as begin end;
recreate table test(
id int primary key using index test_pk
,f01 int
,f02 int
,f03 int
,f04 int
,f05 int
);
commit;
insert into test(id, f01, f02, f03, f04, f05) values( 1, 11, 22, 33, 44, 55);
insert into test(id, f01, f02, f03, f04, f05) values( 2, 111, 222, 333, 444, 555);
insert into test(id, f01, f02, f03, f04, f05) values( 3,1111,2222,3333,4444,5555);
commit;
set term ^;
create or alter procedure sp_get_f01(a_id int) returns(f01 int) as
begin
for select f01 from test where id = :a_id into f01 do suspend;
end
^
create or alter procedure sp_get_f02(a_id int) returns(f02 int) as
begin
for select f02 from test where id = :a_id into f02 do suspend;
end
^
create or alter procedure sp_get_f03(a_id int) returns(f03 int) as
begin
for select f03 from test where id = :a_id into f03 do suspend;
end
^
create or alter procedure sp_get_f04(a_id int) returns(f04 int) as
begin
for select f04 from test where id = :a_id into f04 do suspend;
end
^
create or alter procedure sp_get_f05(a_id int) returns(f05 int) as
begin
for select f05 from test where id = :a_id into f05 do suspend;
end
^
set term ;^
commit;
"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
test_script_1 = """
set list on;
select t1.id
from test t1
join sp_get_f01(t1.id) on 1=1
join test t2 using(id)
join sp_get_f02(t2.id) on 1=1
join test t3 using(id)
join sp_get_f03(t3.id) on 1=1
join test t4 using(id)
join sp_get_f04(t4.id) on 1=1
join test t5 using(id)
join sp_get_f05(t5.id) on 1=1
join sp_get_f04(t4.id) on 1=1
join sp_get_f03(t4.id) on 1=1
join sp_get_f05(t5.id) on 1=1
join sp_get_f04(t4.id) on 1=1
join sp_get_f03(t4.id) on 1=1
join test u5 using(id)
join test u4 using(id)
join sp_get_f02(t4.id) on 1=1
join sp_get_f02(t4.id) on 1=1
join sp_get_f02(t4.id) on 1=1
join test u3 using(id)
join test u2 using(id)
join sp_get_f01(t4.id) on 1=1
join sp_get_f01(t4.id) on 1=1
join sp_get_f01(t4.id) on 1=1
join test u1 using(id)
join sp_get_f01(t4.id) on 1=1
join test v1 using(id)
;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
ID 1
ID 2
ID 3
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout