6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_3650_test.py

68 lines
1.5 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-4001
ISSUE: 4001
TITLE: recreation of collation for utf8 from unicode with option NUMERIC-SORT=1 leads to FB death
DESCRIPTION:
JIRA: CORE-3650
FBTEST: bugs.core_3650
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
recreate table tns(f int); -- drop dependencies if any
commit;
set term ^;
execute block as
begin
execute statement 'drop collation ns_coll;';
when any do begin end
end^
set term ;^
commit;
create collation ns_coll for utf8 from unicode 'NUMERIC-SORT=1';
recreate table tns(s varchar(50) character set utf8 collate ns_coll);
commit;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
recreate table tns(f int); -- drop dependencies if any
commit;
set term ^;
execute block as
begin
execute statement 'drop collation ns_coll;';
when any do begin end
end^
set term ;^
commit;
create collation ns_coll for utf8 from unicode 'NUMERIC-SORT=1';
rollback; -- !!NB!!
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
set term ^;
execute block as
begin
execute statement 'drop collation ns_coll;';
when any do begin end
end^
set term ;^
2022-01-22 21:59:15 +01:00
commit; -- this commit kills FB service
2021-04-26 20:07:00 +02:00
show collation;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stderr = """
2021-04-26 20:07:00 +02:00
There are no user-defined collations in this database
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +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