Skip to content

Commit 02a0f23

Browse files
committed
Added/Updated tests\bugs\gh_7924_1_test.py: Checked on 6.0.0.219 after commit bcc53d43
1 parent 88ffda1 commit 02a0f23

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

tests/bugs/gh_7924_1_test.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#coding:utf-8
2+
3+
"""
4+
ID: issue-7924
5+
ISSUE: https://github.com/FirebirdSQL/firebird/issues/7924
6+
TITLE: ALTER TABLE ALTER COLUMN <textual_field> can not be changed properly in some cases
7+
NOTES:
8+
[22.01.2024] pzotov
9+
Checked on 6.0.0.219 (after commit https://github.com/FirebirdSQL/firebird/commit/bcc53d43c8cd0b904d2963173c153056f9465a09)
10+
"""
11+
12+
import pytest
13+
from firebird.qa import *
14+
15+
db = db_factory(charset = 'utf8')
16+
17+
test_script = """
18+
alter character set utf8 set default collation unicode_ci;
19+
alter character set win1250 set default collation win_cz_ci_ai;
20+
alter character set win1252 set default collation win_ptbr;
21+
alter character set win1257 set default collation win1257_ee;
22+
commit;
23+
24+
create table test(
25+
f01 varchar(10) character set win1252
26+
,f02 varchar(10) character set win1257
27+
,f03 varchar(10) character set win1251
28+
);
29+
commit;
30+
31+
32+
alter table test
33+
alter column f01 type varchar(10) character set win1250
34+
-----------------------------------------------------------
35+
,alter column f02 type varchar(10) character set win1252
36+
-----------------------------------------------------------
37+
,alter column f03 type varchar(10) character set win1257
38+
;
39+
commit;
40+
41+
-- 1. Check that SHOW TABLE will display proper character sets:
42+
show table test;
43+
44+
-- 2. All three statements below raised "Cannot transliterate" before fix:
45+
-- Statement failed, SQLSTATE = 22018
46+
-- arithmetic exception, numeric overflow, or string truncation
47+
-- -Cannot transliterate character between character sets
48+
-- Now all of them must PASS:
49+
insert into test(f01) values ('Ł');
50+
insert into test(f02) values ('Ð');
51+
insert into test(f03) values ('Ģ');
52+
"""
53+
54+
act = isql_act('db', test_script)
55+
56+
expected_stdout = """
57+
F01 VARCHAR(10) CHARACTER SET WIN1250 COLLATE WIN_CZ_CI_AI Nullable
58+
F02 VARCHAR(10) CHARACTER SET WIN1252 COLLATE WIN_PTBR Nullable
59+
F03 VARCHAR(10) CHARACTER SET WIN1257 COLLATE WIN1257_EE Nullable
60+
"""
61+
62+
@pytest.mark.version('>=6.0')
63+
def test_1(act: Action):
64+
act.expected_stdout = expected_stdout
65+
act.execute(combine_output = True)
66+
assert act.clean_stdout == act.clean_expected_stdout

0 commit comments

Comments
 (0)