6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00

Added/Updated tests\bugs\core_4923_test.py: re-implemented, see notes.

This commit is contained in:
pavel-zotov 2023-12-01 22:58:14 +03:00
parent 2f7941adee
commit 60eff4140e

View File

@ -7,6 +7,18 @@ TITLE: Add ability to track domains rename in DDL triggers
DESCRIPTION:
JIRA: CORE-4923
FBTEST: bugs.core_4923
NOTES:
[01.12.2023] pzotov
New behaviour of ISQL was introduced after implementation of PR #7868: SET AUTOTERM.
Since that was implemented, ISQL handles comments (single- and multi-lined) as PART of statement that follows these comments.
In other words, ISQL in 6.x does not 'swallow' comments and sends them to engine together with statement that follows.
This means that such 'pair' (comment PLUS statement) can be 'unexpectedly' seen using monitor/logging features, including
rdb$get_context('DDL_TRIGGER', 'SQL_TEXT').
Currently this is not considered as a bug, see note by Adriano: https://groups.google.com/g/firebird-devel/c/AM8vlA3YJws
Because of this, we have (in this test) to either not use comments at all or filter them out by applying substitution which
will 'know' about some special text ('comment_tag') that must be suppressed.
Checked on 6.0.0.163
"""
import pytest
@ -14,7 +26,9 @@ from firebird.qa import *
db = db_factory()
test_script = """
COMMENT_TAG='DONT_SHOW_IN_OUTPUT'
test_script = f"""
recreate table ddl_log (
id integer generated by default as identity constraint pk_ddl_log primary key using index pk_ddl_log
,who_logs varchar(50)
@ -83,12 +97,13 @@ test_script = """
commit;
create domain dm_foo smallint not null; -- here TWO transactions will start: DML and DDL. Only Tx for DDL will be auto-committed.
-- {COMMENT_TAG} here TWO transactions will start: DML and DDL. Only Tx for DDL will be auto-committed:
create domain dm_foo smallint not null;
-- For each of following DDL statements (which are executed with AUTOCOMMIT mode) two triggers fire:
-- "ddl_log_befo" and "ddl_log_afte". Each trigger DOES write info about DDL changing to the log table
-- ("ddl_log") but it does this work in the same Tx as DDL. So, new content of DDL_LOG table can not
-- be seen by starting DML transaction and we should do one more COMMIT before querying it (see below).
-- {COMMENT_TAG} For each of following DDL statements (which are executed with AUTOCOMMIT mode) two triggers fire:
-- {COMMENT_TAG} "ddl_log_befo" and "ddl_log_afte". Each trigger DOES write info about DDL changing to the log table
-- {COMMENT_TAG} ("ddl_log") but it does this work in the same Tx as DDL. So, new content of DDL_LOG table can not
-- {COMMENT_TAG} be seen by starting DML transaction and we should do one more COMMIT before querying it (see below).
alter domain dm_foo type int;
alter domain dm_foo to dm_bar;
alter domain dm_bar type bigint;
@ -116,7 +131,7 @@ test_script = """
order by id;
"""
act = isql_act('db', test_script, substitutions=[('SQL_TEXT.*', '')])
act = isql_act('db', test_script, substitutions=[ ('SQL_TEXT.*', ''), (f'-- {COMMENT_TAG}.*', '') ])
expected_stdout = """
ID 2