6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_2155_test.py

62 lines
1.3 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-21 18:49:26 +01:00
"""
ID: issue-2586
ISSUE: 2586
TITLE: Join of SP with view or table may fail with "No current record for fetch operation"
DESCRIPTION:
JIRA: CORE-2155
FBTEST: bugs.core_2155
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
set term ^;
create or alter procedure sp_test(a_id int) returns (a_dup int) as
begin
a_dup = 2*a_id;
suspend;
end
^
set term ;^
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v_relations_a as
select rdb$relation_id, rdb$field_id
from rdb$relations;
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v_relations_b as
select dummy_alias.rdb$relation_id, dummy_alias.rdb$field_id
from rdb$relations as dummy_alias;
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
test_script = """
2021-04-26 20:07:00 +02:00
set planonly;
select v.rdb$relation_id, p.*
from v_relations_a v
INNER join sp_test(v.rdb$field_id) p on 1=1;
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
select v.rdb$relation_id, p.*
from v_relations_b v
INNER join sp_test(v.rdb$field_id) p on 1=1;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
PLAN JOIN (V RDB$RELATIONS NATURAL, P NATURAL)
PLAN JOIN (V DUMMY_ALIAS NATURAL, P NATURAL)
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-21 18:49:26 +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