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

51 lines
1.2 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-20 17:32:14 +01:00
"""
ID: issue-2434
ISSUE: 2434
TITLE: Broken foreign key handling for multi-segmented index using multi-level collations
DESCRIPTION:
JIRA: CORE-1997
FBTEST: bugs.core_1997
2022-01-20 17:32:14 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
init_script = """create table pk (
2021-04-26 20:07:00 +02:00
c1 varchar (5) character set utf8 collate unicode_ci,
c2 varchar (5) character set utf8 collate unicode_ci,
primary key (c1, c2)
);
commit;
create table fk (
c1 varchar (5) character set utf8 collate unicode_ci,
c2 varchar (5) character set utf8 collate unicode_ci,
foreign key (c1, c2) references pk
);
commit;
insert into pk values ('a', 'b');
insert into fk values ('A', 'b');
commit;
"""
2022-01-20 17:32:14 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
test_script = """delete from pk; -- should not be allowed
2021-04-26 20:07:00 +02:00
"""
2022-01-20 17:32:14 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
expected_stderr = """Statement failed, SQLSTATE = 23000
2021-04-26 20:07:00 +02:00
violation of FOREIGN KEY constraint "INTEG_2" on table "FK"
-Foreign key references are present for the record
-Problematic key value is ("C1" = 'a', "C2" = 'b')
"""
2022-01-20 17:32:14 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stderr = expected_stderr
act.execute()
assert act.clean_stderr == act.clean_expected_stderr
2021-04-26 20:07:00 +02:00