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
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_4212
|
2023-10-05 15:48:58 +02:00
|
|
|
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
|
|
|
|
2023-10-05 15:48:58 +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 = """
|
2023-10-05 15:48:58 +02:00
|
|
|
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;
|
2023-10-05 15:48:58 +02:00
|
|
|
|
|
|
|
connect '$(DSN)';
|
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
alter table t2 drop constraint t2_fk;
|
2023-10-05 15:48:58 +02:00
|
|
|
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
|
|
|
|
2023-10-05 15:48:58 +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 = """
|
2023-10-05 15:48:58 +02:00
|
|
|
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
|
2023-10-05 15:48:58 +02:00
|
|
|
act.execute(combine_output = True)
|
2022-01-23 20:41:55 +01:00
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|