|
37 | 37 | ======== |
38 | 38 | JIRA: CORE-6028 |
39 | 39 | FBTEST: bugs.core_6028 |
| 40 | +NOTES: |
| 41 | + [18.07.2025] pzotov |
| 42 | + 1. Regression did exist after SQL schemas introduction (letter to Alex and Adriano, 03.07.2025), |
| 43 | + see also: https://github.com/FirebirdSQL/firebird/issues/6278#issuecomment-3033249058 |
| 44 | + 2. Separated expected output for FB major versions prior/since 6.x. |
| 45 | + No substitutions are used to suppress schema and quotes. Discussed with dimitr, 24.06.2025 12:39. |
| 46 | + Checked on 6.0.0.1020; 5.0.3.1683; 4.0.6.3221; 3.0.13.33813 |
40 | 47 | """ |
41 | 48 |
|
42 | 49 | import pytest |
|
50 | 57 |
|
51 | 58 | act = python_act('db') |
52 | 59 |
|
53 | | -expected_stdout = """ |
54 | | - NO USER-DEFINED TRIGGERS IN JUST RESTORED DATABASE. |
55 | | - NO ACTIONS WAS LOGGED IN THE TABLE TLOG. |
56 | | - unsuccessful metadata update |
57 | | - -CREATE OR ALTER TRIGGER NEW_TRG_RDB_REL_FLDS_BI failed |
58 | | - -no permission for ALTER access to TABLE RDB$RELATION_FIELDS |
59 | | - -607 |
60 | | - (335544351, 336397272, 335544352) |
61 | | - unsuccessful metadata update |
62 | | - -CREATE OR ALTER TRIGGER NEW_TRG_MON_STM_BD failed |
63 | | - -no permission for ALTER access to TABLE MON$STATEMENTS |
64 | | - -607 |
65 | | - (335544351, 336397272, 335544352) |
66 | | - unsuccessful metadata update |
67 | | - -CREATE OR ALTER TRIGGER NEW_TRG_MON_ATT_BD failed |
68 | | - -no permission for ALTER access to TABLE MON$ATTACHMENTS |
69 | | - -607 |
70 | | - (335544351, 336397272, 335544352) |
71 | | -""" |
72 | | - |
73 | 60 | fbk_file = temp_file('core_6028_25.fbk') |
74 | 61 |
|
75 | | -ddl_probes = [""" |
76 | | - create or alter trigger new_trg_rdb_rel_flds_bi for rdb$relation_fields active before insert position 0 as |
77 | | - begin |
78 | | - insert into tlog(id, action) values( gen_id(g, 111), 'rdb$relation_fields: record is to be created' ); |
79 | | - end |
80 | | - """, """ |
81 | | - create or alter trigger new_trg_mon_stm_bd for mon$statements active before delete position 0 as |
82 | | - begin |
83 | | - insert into tlog(id, action) values( gen_id(g, 222), 'mon$statements: record is to be removed' ); |
84 | | - end |
85 | | - """, """ |
86 | | - create or alter trigger new_trg_mon_att_bd for mon$attachments active before delete position 0 as |
87 | | - begin |
88 | | - insert into tlog(id, action) values( gen_id(g, 333), 'mon$attachments: record is to be removed' ); |
89 | | - end |
90 | | - """] |
| 62 | +ddl_probes = ( |
| 63 | + """ |
| 64 | + create or alter trigger new_trg_rdb_rel_flds_bi for rdb$relation_fields active before insert position 0 as |
| 65 | + begin |
| 66 | + insert into tlog(id, action) values( gen_id(g, 111), 'rdb$relation_fields: record is to be created' ); |
| 67 | + end |
| 68 | + """ |
| 69 | + , |
| 70 | + """ |
| 71 | + create or alter trigger new_trg_mon_stm_bd for mon$statements active before delete position 0 as |
| 72 | + begin |
| 73 | + insert into tlog(id, action) values( gen_id(g, 222), 'mon$statements: record is to be removed' ); |
| 74 | + end |
| 75 | + """ |
| 76 | + , |
| 77 | + """ |
| 78 | + create or alter trigger new_trg_mon_att_bd for mon$attachments active before delete position 0 as |
| 79 | + begin |
| 80 | + insert into tlog(id, action) values( gen_id(g, 333), 'mon$attachments: record is to be removed' ); |
| 81 | + end |
| 82 | + """ |
| 83 | +) |
91 | 84 |
|
92 | 85 | @pytest.mark.version('>=3.0.5') |
93 | 86 | def test_1(act: Action, fbk_file: Path, db_tmp: Database, capsys): |
@@ -137,8 +130,45 @@ def test_1(act: Action, fbk_file: Path, db_tmp: Database, capsys): |
137 | 130 | print(e) |
138 | 131 | print(e.sqlcode) |
139 | 132 | print(e.gds_codes) |
140 | | - # Check |
141 | 133 | act.reset() |
142 | | - act.expected_stdout = expected_stdout |
| 134 | + |
| 135 | + expected_stdout_5x = """ |
| 136 | + NO USER-DEFINED TRIGGERS IN JUST RESTORED DATABASE. |
| 137 | + NO ACTIONS WAS LOGGED IN THE TABLE TLOG. |
| 138 | + unsuccessful metadata update |
| 139 | + -CREATE OR ALTER TRIGGER NEW_TRG_RDB_REL_FLDS_BI failed |
| 140 | + -no permission for ALTER access to TABLE RDB$RELATION_FIELDS |
| 141 | + -607 |
| 142 | + (335544351, 336397272, 335544352) |
| 143 | + unsuccessful metadata update |
| 144 | + -CREATE OR ALTER TRIGGER NEW_TRG_MON_STM_BD failed |
| 145 | + -no permission for ALTER access to TABLE MON$STATEMENTS |
| 146 | + -607 |
| 147 | + (335544351, 336397272, 335544352) |
| 148 | + unsuccessful metadata update |
| 149 | + -CREATE OR ALTER TRIGGER NEW_TRG_MON_ATT_BD failed |
| 150 | + -no permission for ALTER access to TABLE MON$ATTACHMENTS |
| 151 | + -607 |
| 152 | + (335544351, 336397272, 335544352) |
| 153 | + """ |
| 154 | + |
| 155 | + expected_stdout_6x = """ |
| 156 | + NO USER-DEFINED TRIGGERS IN JUST RESTORED DATABASE. |
| 157 | + NO ACTIONS WAS LOGGED IN THE TABLE TLOG. |
| 158 | + CREATE OR ALTER TRIGGER "SYSTEM"."NEW_TRG_RDB_REL_FLDS_BI" failed |
| 159 | + -Cannot CREATE/ALTER/DROP TRIGGER in SYSTEM schema |
| 160 | + -901 |
| 161 | + (336397272, 336068927) |
| 162 | + CREATE OR ALTER TRIGGER "SYSTEM"."NEW_TRG_MON_STM_BD" failed |
| 163 | + -Cannot CREATE/ALTER/DROP TRIGGER in SYSTEM schema |
| 164 | + -901 |
| 165 | + (336397272, 336068927) |
| 166 | + CREATE OR ALTER TRIGGER "SYSTEM"."NEW_TRG_MON_ATT_BD" failed |
| 167 | + -Cannot CREATE/ALTER/DROP TRIGGER in SYSTEM schema |
| 168 | + -901 |
| 169 | + (336397272, 336068927) |
| 170 | + """ |
| 171 | + |
| 172 | + act.expected_stdout = expected_stdout_5x if act.is_version('<6') else expected_stdout_6x |
143 | 173 | act.stdout = capsys.readouterr().out |
144 | 174 | assert act.clean_stdout == act.clean_expected_stdout |
0 commit comments