2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
"""
|
|
|
|
ID: issue-2630
|
|
|
|
ISSUE: 2630
|
|
|
|
TITLE: RDB$VIEW_RELATIONS is not cleaned when altering a view
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-2202
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_2202
|
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
|
|
|
recreate table table_1 (id integer);
|
|
|
|
recreate table table_2 (id integer);
|
|
|
|
recreate table table_3 (id integer);
|
2022-01-21 18:49:26 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
create or alter view vw_table(id) as
|
|
|
|
select id from table_1;
|
|
|
|
commit;
|
2022-01-21 18:49:26 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
create or alter view vw_table(id) as
|
|
|
|
select id from table_2;
|
|
|
|
commit;
|
2022-01-21 18:49:26 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
create or alter view vw_table(id) as
|
|
|
|
select id
|
|
|
|
from table_3;
|
|
|
|
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 list on;
|
|
|
|
set width vew_name 31;
|
|
|
|
set width rel_name 31;
|
|
|
|
set width ctx_name 31;
|
|
|
|
select
|
|
|
|
rdb$view_name as vew_name
|
|
|
|
,rdb$relation_name as rel_name
|
|
|
|
,rdb$view_context
|
|
|
|
,rdb$context_name as ctx_name
|
|
|
|
from rdb$view_relations rv;
|
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 = """
|
|
|
|
VEW_NAME VW_TABLE
|
|
|
|
REL_NAME TABLE_3
|
2021-04-26 20:07:00 +02:00
|
|
|
RDB$VIEW_CONTEXT 1
|
2022-01-21 18:49:26 +01:00
|
|
|
CTX_NAME TABLE_3
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
@pytest.mark.version('>=3.0')
|
|
|
|
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
|
|
|
|