|
| 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 | + TODO: check ability to insert into fields some data specific to appropriate collation and proper order of selected characters. |
| 11 | +""" |
| 12 | + |
| 13 | +import pytest |
| 14 | +from firebird.qa import * |
| 15 | + |
| 16 | +db = db_factory(charset = 'utf8') |
| 17 | + |
| 18 | +test_script = """ |
| 19 | + alter character set utf8 set default collation unicode_ci; |
| 20 | + alter character set win1250 set default collation win_cz_ci_ai; |
| 21 | + alter character set win1252 set default collation win_ptbr; |
| 22 | + alter character set win1257 set default collation win1257_ee; |
| 23 | + commit; |
| 24 | + |
| 25 | + create table test( |
| 26 | + f_init_1252 varchar(10) character set win1252 |
| 27 | + ,f_init_1257 varchar(10) character set win1257 |
| 28 | + ,f_init_utf8 varchar(10) character set utf8 |
| 29 | + ); |
| 30 | + commit; |
| 31 | +
|
| 32 | + alter table test |
| 33 | + alter column f_init_1252 to f_curr_1250 |
| 34 | + ,alter column f_curr_1250 type varchar(10) character set win1250 |
| 35 | + ----------------------------------------------------------- |
| 36 | + ,alter column f_init_1257 to f_curr_1252 |
| 37 | + ,alter column f_curr_1252 type varchar(10) character set win1252 |
| 38 | + ----------------------------------------------------------- |
| 39 | + ,alter column f_init_utf8 to f_curr_1257 |
| 40 | + ,alter column f_curr_1257 type varchar(10) character set win1257 |
| 41 | + ; |
| 42 | + commit; |
| 43 | + |
| 44 | + show table test; -------------------- [ 1 ] |
| 45 | +""" |
| 46 | + |
| 47 | +act = isql_act('db', test_script) |
| 48 | + |
| 49 | +expected_stdout = """ |
| 50 | + F_CURR_1250 VARCHAR(10) CHARACTER SET WIN1250 COLLATE WIN_CZ_CI_AI Nullable |
| 51 | + F_CURR_1252 VARCHAR(10) CHARACTER SET WIN1252 COLLATE WIN_PTBR Nullable |
| 52 | + F_CURR_1257 VARCHAR(10) CHARACTER SET WIN1257 COLLATE WIN1257_EE Nullable |
| 53 | +""" |
| 54 | + |
| 55 | +@pytest.mark.version('>=6.0') |
| 56 | +def test_1(act: Action): |
| 57 | + act.expected_stdout = expected_stdout |
| 58 | + act.execute(combine_output = True) |
| 59 | + assert act.clean_stdout == act.clean_expected_stdout |
0 commit comments