2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
#
|
|
|
|
# id: functional.basic.db.28
|
|
|
|
# title: Empty DB - RDB$TRIGGER_MESSAGES
|
|
|
|
# decription: Check for correct content of RDB$TRIGGER_MESSAGES in empty database.
|
|
|
|
# tracker_id:
|
|
|
|
# min_versions: []
|
2021-12-22 20:25:10 +01:00
|
|
|
# versions: 3.0, 4.1
|
2021-04-26 20:07:00 +02:00
|
|
|
# qmid: functional.basic.db.db_28
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
from firebird.qa import db_factory, isql_act, Action
|
|
|
|
|
|
|
|
# version: 3.0
|
|
|
|
# resources: None
|
|
|
|
|
|
|
|
substitutions_1 = [('RDB\\$TRIGGER_NAME[\\s]+RDB\\$TRIGGER.*', 'RDB\\$TRIGGER_NAME RDB\\$TRIGGER')]
|
|
|
|
|
|
|
|
init_script_1 = """"""
|
|
|
|
|
|
|
|
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
|
|
|
|
|
|
|
test_script_1 = """
|
|
|
|
set list on;
|
|
|
|
set count on;
|
|
|
|
set blob all;
|
|
|
|
select * from rdb$trigger_messages order by rdb$trigger_name, rdb$message_number;
|
2021-12-22 20:25:10 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
|
|
|
|
|
|
|
expected_stdout_1 = """
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_1
|
|
|
|
RDB$MESSAGE_NUMBER 0
|
|
|
|
RDB$MESSAGE existing_priv_mod
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_10
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE primary_key_ref
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_10
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE primary_key_notnull
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_12
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE ref_cnstrnt_notfound
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_12
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE foreign_key_notfound
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_13
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE ref_cnstrnt_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_14
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE check_cnstrnt_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_15
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE check_cnstrnt_del
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_17
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE integ_index_seg_del
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_18
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE integ_index_seg_mod
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_19
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE integ_index_del
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_2
|
|
|
|
RDB$MESSAGE_NUMBER 0
|
|
|
|
RDB$MESSAGE systrig_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_20
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE integ_index_mod
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_20
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE integ_index_deactivate
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_20
|
|
|
|
RDB$MESSAGE_NUMBER 3
|
|
|
|
RDB$MESSAGE integ_deactivate_primary
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_21
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE check_trig_del
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_22
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE check_trig_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_23
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE cnstrnt_fld_del
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_24
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE cnstrnt_fld_rename
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_24
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE integ_index_seg_mod
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_25
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE rel_cnstrnt_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_26
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE constaint_on_view
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_26
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE invld_cnstrnt_type
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_26
|
|
|
|
RDB$MESSAGE_NUMBER 3
|
|
|
|
RDB$MESSAGE primary_key_exists
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_3
|
|
|
|
RDB$MESSAGE_NUMBER 0
|
|
|
|
RDB$MESSAGE systrig_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_31
|
|
|
|
RDB$MESSAGE_NUMBER 0
|
|
|
|
RDB$MESSAGE no_write_user_priv
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_32
|
|
|
|
RDB$MESSAGE_NUMBER 0
|
|
|
|
RDB$MESSAGE no_write_user_priv
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_33
|
|
|
|
RDB$MESSAGE_NUMBER 0
|
|
|
|
RDB$MESSAGE no_write_user_priv
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_36
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE integ_index_seg_mod
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 0
|
|
|
|
RDB$MESSAGE grant_obj_notfound
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE grant_fld_notfound
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE grant_nopriv
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 3
|
|
|
|
RDB$MESSAGE nonsql_security_rel
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 4
|
|
|
|
RDB$MESSAGE nonsql_security_fld
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 5
|
|
|
|
RDB$MESSAGE grant_nopriv_on_base
|
|
|
|
|
|
|
|
|
|
|
|
Records affected: 35
|
2021-12-22 20:25:10 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2021-12-22 20:25:10 +01:00
|
|
|
@pytest.mark.version('>=3.0,<4.1')
|
2021-04-28 12:42:11 +02:00
|
|
|
def test_1(act_1: Action):
|
2021-04-26 20:07:00 +02:00
|
|
|
act_1.expected_stdout = expected_stdout_1
|
|
|
|
act_1.execute()
|
2021-12-22 20:25:10 +01:00
|
|
|
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
|
|
|
|
|
|
|
# version: 4.1
|
|
|
|
# resources: None
|
|
|
|
|
|
|
|
substitutions_2 = [('RDB\\$TRIGGER_NAME[\\s]+RDB\\$TRIGGER.*', 'RDB\\$TRIGGER_NAME RDB\\$TRIGGER')]
|
|
|
|
|
|
|
|
init_script_2 = """"""
|
|
|
|
|
|
|
|
db_2 = db_factory(sql_dialect=3, init=init_script_2)
|
|
|
|
|
|
|
|
test_script_2 = """
|
|
|
|
set list on;
|
|
|
|
set count on;
|
|
|
|
set blob all;
|
|
|
|
select * from rdb$trigger_messages order by rdb$trigger_name, rdb$message_number;
|
|
|
|
"""
|
|
|
|
|
|
|
|
act_2 = isql_act('db_2', test_script_2, substitutions=substitutions_2)
|
|
|
|
|
|
|
|
expected_stdout_2 = """
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_1
|
|
|
|
RDB$MESSAGE_NUMBER 0
|
|
|
|
RDB$MESSAGE existing_priv_mod
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_10
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE primary_key_ref
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_10
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE primary_key_notnull
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_12
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE ref_cnstrnt_notfound
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_12
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE foreign_key_notfound
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_13
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE ref_cnstrnt_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_14
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE check_cnstrnt_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_15
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE check_cnstrnt_del
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_17
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE integ_index_seg_del
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_18
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE integ_index_seg_mod
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_19
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE integ_index_del
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_2
|
|
|
|
RDB$MESSAGE_NUMBER 0
|
|
|
|
RDB$MESSAGE systrig_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_20
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE integ_index_mod
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_20
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE integ_index_deactivate
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_20
|
|
|
|
RDB$MESSAGE_NUMBER 3
|
|
|
|
RDB$MESSAGE integ_deactivate_primary
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_21
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE check_trig_del
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_22
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE check_trig_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_23
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE cnstrnt_fld_del
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_24
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE cnstrnt_fld_rename
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_24
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE integ_index_seg_mod
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_25
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE rel_cnstrnt_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_26
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE constaint_on_view
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_26
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE invld_cnstrnt_type
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_26
|
|
|
|
RDB$MESSAGE_NUMBER 3
|
|
|
|
RDB$MESSAGE primary_key_exists
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_3
|
|
|
|
RDB$MESSAGE_NUMBER 0
|
|
|
|
RDB$MESSAGE systrig_update
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_36
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE integ_index_seg_mod
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 0
|
|
|
|
RDB$MESSAGE grant_obj_notfound
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 1
|
|
|
|
RDB$MESSAGE grant_fld_notfound
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 2
|
|
|
|
RDB$MESSAGE grant_nopriv
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 3
|
|
|
|
RDB$MESSAGE nonsql_security_rel
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 4
|
|
|
|
RDB$MESSAGE nonsql_security_fld
|
|
|
|
|
|
|
|
RDB$TRIGGER_NAME RDB$TRIGGER_9
|
|
|
|
RDB$MESSAGE_NUMBER 5
|
|
|
|
RDB$MESSAGE grant_nopriv_on_base
|
|
|
|
|
|
|
|
|
|
|
|
Records affected: 32
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
@pytest.mark.version('>=4.1')
|
|
|
|
def test_2(act_2: Action):
|
|
|
|
act_2.expected_stdout = expected_stdout_2
|
|
|
|
act_2.execute()
|
|
|
|
assert act_2.clean_stdout == act_2.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|