2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
"""
|
|
|
|
ID: issue-4666
|
|
|
|
ISSUE: 4666
|
|
|
|
TITLE: Error "no current record for fetch operation" when table inner join procedure inner join table
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-4344
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_4344
|
2022-01-23 20:41:55 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
init_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
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;
|
2022-01-23 20:41:55 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
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;
|
2022-01-23 20:41:55 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
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;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
db = db_factory(init=init_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
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)
|
|
|
|
;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
ID 1
|
|
|
|
ID 2
|
|
|
|
ID 3
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-23 20:41:55 +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
|
|
|
|