6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/bugs/core_4212_test.py

47 lines
1.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-23 20:41:55 +01:00
"""
ID: issue-4537
ISSUE: 4537
TITLE: Dropping FK on GTT crashes server
DESCRIPTION:
JIRA: CORE-4212
FBTEST: bugs.core_4212
NOTES:
[05.10.2023] pzotov
Confirmed crash on 3.0.0.30566 Alpha1.
Removed SHOW command. It is enough for this test just to try to insert record in the 'T2' table after dropping FK.
2022-01-23 20:41:55 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
db = db_factory(charset = 'win1251')
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
test_script = """
set list on;
create global temporary table t1 (text_id varchar(8) not null primary key);
create global temporary table t2 (text_id varchar(8));
alter table t2 add constraint t2_fk foreign key (text_id) references t1 (text_id);
2021-04-26 20:07:00 +02:00
commit;
connect '$(DSN)';
2022-01-23 20:41:55 +01:00
alter table t2 drop constraint t2_fk;
commit;
insert into t2(text_id) values('qwerty');
select * from t2;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
act = isql_act('db', test_script, substitutions = [ ('[ \t]+', ''), ] )
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
expected_stdout = """
TEXT_ID qwerty
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute(combine_output = True)
2022-01-23 20:41:55 +01:00
assert act.clean_stdout == act.clean_expected_stdout