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

106 lines
1.9 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-3306
ISSUE: 3306
TITLE: Problem with dependencies between a procedure and a view using that procedure
DESCRIPTION:
JIRA: CORE-2923
FBTEST: bugs.core_2923
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
db = db_factory()
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 term ^;
2022-01-21 18:49:26 +01:00
create procedure sp_test returns (i smallint) as
begin
2021-04-26 20:07:00 +02:00
i = 32767;
2022-01-21 18:49:26 +01:00
suspend;
2021-04-26 20:07:00 +02:00
end
^
2022-01-21 18:49:26 +01:00
create view v0 as
select i
2021-04-26 20:07:00 +02:00
from sp_test
^
2022-01-21 18:49:26 +01:00
alter procedure sp_test returns (i int) as
begin
2021-04-26 20:07:00 +02:00
i = 32768;
2022-01-21 18:49:26 +01:00
suspend;
2021-04-26 20:07:00 +02:00
end
^
set term ;^
commit;
---
create table t1 (n1 smallint);
insert into t1(n1) values(32767);
commit;
2022-01-21 18:49:26 +01:00
create view v1 as
select *
2021-04-26 20:07:00 +02:00
from t1;
2022-01-21 18:49:26 +01:00
alter table t1 alter n1 type integer;
2021-04-26 20:07:00 +02:00
commit;
insert into t1(n1) values(32768);
commit;
---
create table t2 (n2 smallint);
insert into t2(n2) values(32767);
commit;
create domain d2 integer;
2022-01-21 18:49:26 +01:00
create view v2 as
2021-04-26 20:07:00 +02:00
select * from t2;
2022-01-21 18:49:26 +01:00
alter table t2 alter n2 type d2;
2021-04-26 20:07:00 +02:00
insert into t2(n2) values(32768);
commit;
---
set list on;
select '0' as test_no, v.* from v0 v
union all
select '1', v.* from v1 v
union all
select '2', v.* from v2 v
;
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
TEST_NO 0
I 32768
TEST_NO 1
I 32767
TEST_NO 1
I 32768
TEST_NO 2
I 32767
TEST_NO 2
I 32768
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