2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
"""
|
|
|
|
ID: issue-4740
|
2023-10-05 17:09:17 +02:00
|
|
|
ISSUE: https://github.com/FirebirdSQL/firebird/issues/4740
|
2022-01-23 20:41:55 +01:00
|
|
|
TITLE: Regression: Can not run ALTER TABLE DROP CONSTRAINT <FK_name> after recent changes in svn
|
2023-10-05 17:09:17 +02:00
|
|
|
DESCRIPTION:
|
2022-01-23 20:41:55 +01:00
|
|
|
JIRA: CORE-4418
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_4418
|
2022-04-28 18:57:18 +02:00
|
|
|
NOTES:
|
2023-10-05 17:09:17 +02:00
|
|
|
[28.04.2022] pzotov
|
|
|
|
Comfirmed problem on 3.0.0.31099.
|
2022-04-28 18:57:18 +02:00
|
|
|
Checked on 5.0.0.488, 4.0.1.2692, 3.0.8.33535.
|
2023-10-05 17:09:17 +02:00
|
|
|
|
|
|
|
[05.10.2023] pzotov
|
|
|
|
Removed SHOW command. It is enough for this test just to show 'Completed' message when all FK have been dropped because set bail = ON.
|
|
|
|
Checked on 6.0.0.66, 5.0.0.1235, 4.0.4.2998, 3.0.12.33713.
|
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
|
|
|
|
2022-04-28 18:57:18 +02:00
|
|
|
substitutions = [
|
|
|
|
('SPECIFIC_ATTR_BLOB_ID.*', 'SPECIFIC_ATTR_BLOB_ID')
|
|
|
|
,('COLL-VERSION=\\d+.\\d+(;ICU-VERSION=\\d+.\\d+)?.*', 'COLL-VERSION=<attr>')
|
|
|
|
]
|
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-04-28 18:57:18 +02:00
|
|
|
db = db_factory(charset='UTF8')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
test_script = """
|
2023-10-05 17:09:17 +02:00
|
|
|
set bail on;
|
|
|
|
set heading off;
|
|
|
|
|
|
|
|
/*
|
2022-04-28 18:57:18 +02:00
|
|
|
create or alter view v_coll_info as
|
|
|
|
select
|
|
|
|
rc.rdb$collation_name
|
|
|
|
,rc.rdb$collation_attributes
|
|
|
|
,rc.rdb$base_collation_name
|
|
|
|
,rc.rdb$specific_attributes as specific_attr_blob_id
|
|
|
|
,rs.rdb$character_set_name
|
|
|
|
,rs.rdb$number_of_characters
|
|
|
|
,rs.rdb$bytes_per_character
|
|
|
|
from rdb$collations rc
|
|
|
|
join rdb$character_sets rs on rc.rdb$character_set_id = rs.rdb$character_set_id
|
|
|
|
where
|
|
|
|
rc.rdb$system_flag is distinct from 1
|
|
|
|
;
|
|
|
|
commit;
|
2023-10-05 17:09:17 +02:00
|
|
|
*/
|
2022-04-28 18:57:18 +02:00
|
|
|
|
|
|
|
create collation nums_coll for utf8 from unicode case insensitive 'NUMERIC-SORT=1';
|
|
|
|
create domain dm_nums as varchar(20) character set utf8 collate nums_coll;
|
|
|
|
create domain dm_ids as bigint;
|
|
|
|
commit;
|
|
|
|
|
|
|
|
recreate table tm(
|
|
|
|
id dm_ids,
|
|
|
|
nm dm_nums,
|
|
|
|
constraint tm_pk primary key(id)
|
|
|
|
);
|
|
|
|
|
|
|
|
recreate table td(
|
|
|
|
id dm_ids,
|
|
|
|
pid dm_ids,
|
|
|
|
nm dm_nums,
|
|
|
|
constraint td_pk primary key(id),
|
|
|
|
constraint td_fk foreign key(pid) references tm
|
|
|
|
);
|
|
|
|
|
|
|
|
set autoddl off;
|
|
|
|
commit;
|
|
|
|
|
|
|
|
alter table td drop constraint td_fk;
|
|
|
|
alter table td drop constraint td_pk;
|
|
|
|
alter table tm drop constraint tm_pk;
|
2023-10-05 17:09:17 +02:00
|
|
|
commit;
|
2022-04-28 18:57:18 +02:00
|
|
|
|
2023-10-05 17:09:17 +02:00
|
|
|
select 'Completed.' from rdb$database;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
act = isql_act('db', test_script, substitutions=substitutions)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
expected_stdout = """
|
2023-10-05 17:09:17 +02:00
|
|
|
Completed.
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-23 20:41:55 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
2023-10-05 17:09:17 +02:00
|
|
|
act.execute(combine_output = True)
|
2022-01-23 20:41:55 +01:00
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|