From dc257d8e17dd3d216e2a9c6c7fae3b28957c5d71 Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Sat, 25 Feb 2023 13:13:59 +0300 Subject: [PATCH] Added/Updated tests\bugs\gh_6869_test.py: Checked on 5.0.0.959 - all OK. --- tests/bugs/gh_6869_test.py | 64 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/bugs/gh_6869_test.py diff --git a/tests/bugs/gh_6869_test.py b/tests/bugs/gh_6869_test.py new file mode 100644 index 00000000..11fc54e9 --- /dev/null +++ b/tests/bugs/gh_6869_test.py @@ -0,0 +1,64 @@ +#coding:utf-8 + +""" +ID: issue-6869 +ISSUE: https://github.com/FirebirdSQL/firebird/issues/6869 +TITLE: Domain CHECK-expression can be ignored when we DROP objects that are involved in it +NOTES: + [25.02.2023] pzotov + Confirmed bug on 5.0.0.520. + Checked on 5.0.0.959 - all OK. +""" + +import pytest +from firebird.qa import * + +init_script = """ + create domain dm_int as int; + create table test(i dm_int); + + set term ^; + create function fn_test(a_id dm_int) returns dm_int as + begin + return ( select min(i) from test ); + end + ^ + set term ;^ + alter domain dm_int add constraint check ( value = (select fn_test(max(i)) from test) ); + commit; +""" +db = db_factory(init = init_script) + +test_script = """ + set term ^; + execute block as + begin + execute statement 'drop table test'; -- PASSED, despite having two dependent objects (function and domain expr.) + execute statement 'drop function fn_test'; -- PASSED, despite having dependent object (domain expr.) + end + ^ + set term ;^ + commit; +""" + +act = isql_act('db', test_script) + +expected_stderr = """ + Statement failed, SQLSTATE = 42000 + unsuccessful metadata update + -cannot delete + -COLUMN TEST.I + -there are 1 dependencies + + Statement failed, SQLSTATE = 42000 + unsuccessful metadata update + -cannot delete + -COLUMN TEST.I + -there are 1 dependencies +""" + +@pytest.mark.version('>=5.0') +def test_1(act: Action): + act.expected_stderr = expected_stderr + act.execute() + assert act.clean_stderr == act.clean_expected_stderr