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

107 lines
3.1 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-3088
ISSUE: 3088
TITLE: System triggers on view with check option are not removed
DESCRIPTION:
JIRA: CORE-2685
FBTEST: bugs.core_2685
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(charset='UTF8')
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
-- Updated code: made STDOUT independent of Firebird version
-- Note about SIMILAR TO: one need here to specify backslash TWICE inside escape clause,
-- e.g: ... escape '\\' (fbt_run feature ?)
set list on;
set width dep_name1 10;
set width dep_name2 10;
set width dep_name3 10;
set width dep_name4 10;
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v1 as select 1 id from rdb$database;
commit;
recreate table test_table (id integer, caption varchar(10));
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
------ block 1 -----
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v1 as
select id, caption from test_table where id > 0;
commit;
2022-01-21 18:49:26 +01:00
select upper(left(rdb$dependent_name,5)) dep_name1
2021-04-26 20:07:00 +02:00
from rdb$database b
2022-01-21 18:49:26 +01:00
left join rdb$dependencies d on
2021-04-26 20:07:00 +02:00
d.rdb$depended_on_name = upper( 'v1' )
and trim(d.rdb$dependent_name) similar to upper('check\\_[[:digit:]]+') escape '\\'
;
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
------ block 2 -----
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v1 as select id ,caption from test_table where id > 0
with check option;
commit;
2022-01-21 18:49:26 +01:00
select upper(left(rdb$dependent_name,5)) dep_name2
2021-04-26 20:07:00 +02:00
from rdb$database
left join rdb$dependencies d on
d.rdb$depended_on_name = upper( 'v1' )
and trim(d.rdb$dependent_name) similar to upper('check\\_[[:digit:]]+') escape '\\'
;
------ block 3 -----
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v1 as select id, caption from test_table where id > 0
with check option;
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v1 as select id, caption from test_table where id > 0
with check option;
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v1 as select id,caption from test_table where id > 0
with check option;
commit;
2022-01-21 18:49:26 +01:00
select upper(left(rdb$dependent_name,5)) dep_name3
2021-04-26 20:07:00 +02:00
from rdb$database
2022-01-21 18:49:26 +01:00
left join rdb$dependencies d on
2021-04-26 20:07:00 +02:00
d.rdb$depended_on_name = upper( 'v1' )
and trim(d.rdb$dependent_name) similar to upper('check\\_[[:digit:]]+') escape '\\'
;
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
------ block 4 -----
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v1 as select id,caption from test_table where id > 0;
create or alter view v1 as select id from test_table where id > 0;
commit;
2022-01-21 18:49:26 +01:00
select upper(left(rdb$dependent_name,5)) dep_name4
2021-04-26 20:07:00 +02:00
from rdb$database
2022-01-21 18:49:26 +01:00
left join rdb$dependencies d on
2021-04-26 20:07:00 +02:00
d.rdb$depended_on_name = upper( 'v1' )
and trim(d.rdb$dependent_name) similar to upper('check\\_[[:digit:]]+') escape '\\'
;
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
DEP_NAME1 <null>
DEP_NAME2 CHECK
DEP_NAME2 CHECK
DEP_NAME2 CHECK
DEP_NAME3 CHECK
DEP_NAME3 CHECK
DEP_NAME3 CHECK
2022-01-21 18:49:26 +01:00
DEP_NAME4 <null>
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