mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
Added/Updated tests\bugs\core_2426_test.py: Removed SHOW command for check result because its output often changes. Query to RDB$ tables is used instead.
This commit is contained in:
parent
a663a98925
commit
94ddcc30cf
@ -7,6 +7,9 @@ TITLE: Alter table not respecting collation
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-2426
|
||||
FBTEST: bugs.core_2426
|
||||
NOTES:
|
||||
[05.10.2023] pzotov
|
||||
Removed SHOW command for check result because its output often changes. Query to RDB$ tables is used instead.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
@ -14,24 +17,88 @@ from firebird.qa import *
|
||||
|
||||
db = db_factory()
|
||||
|
||||
test_script = """-- create domain A_DOMAIN VARCHAR(14) CHARacter SET WIN1252 COLLATE WINPT_BR;
|
||||
create domain A_DOMAIN VARCHAR(14) CHARacter SET WIN1252;
|
||||
create domain B_DOMAIN VARCHAR(14) CHARacter SET ISO8859_1 COLLATE PT_BR;
|
||||
test_script = """
|
||||
set term ^;
|
||||
create or alter procedure sp_get_table_fields_info(a_table rdb$relation_name) returns (
|
||||
table_name type of column rdb$relations.rdb$relation_name
|
||||
,field_name type of column rdb$relation_fields.rdb$field_name
|
||||
,field_cset_id type of column rdb$fields.rdb$character_set_id
|
||||
,field_coll_id type of column rdb$fields.rdb$collation_id
|
||||
,field_cset_len type of column rdb$fields.rdb$character_length
|
||||
,field_cset_name type of column rdb$character_sets.rdb$character_set_name
|
||||
,field_coll_name type of column rdb$collations.rdb$collation_name
|
||||
) as
|
||||
begin
|
||||
for
|
||||
select
|
||||
:a_table
|
||||
,rf.rdb$field_name as field_name
|
||||
,f.rdb$character_set_id as field_cset_id
|
||||
,f.rdb$collation_id as field_coll_id
|
||||
,f.rdb$character_length as field_cset_len
|
||||
,c.rdb$character_set_name as cset_name
|
||||
,k.rdb$collation_name as field_coll_name
|
||||
from rdb$relation_fields rf
|
||||
join rdb$fields f on rf.rdb$field_source = f.rdb$field_name
|
||||
join rdb$character_sets c on f.rdb$character_set_id = c.rdb$character_set_id
|
||||
join rdb$collations k on c.rdb$character_set_id = k.rdb$character_set_id and f.rdb$collation_id = k.rdb$collation_id
|
||||
where rf.rdb$relation_name = upper(:a_table)
|
||||
order by
|
||||
field_name
|
||||
,field_cset_id
|
||||
,field_coll_id
|
||||
into
|
||||
table_name
|
||||
,field_name
|
||||
,field_cset_id
|
||||
,field_coll_id
|
||||
,field_cset_len
|
||||
,field_cset_name
|
||||
,field_coll_name
|
||||
do begin
|
||||
suspend;
|
||||
end
|
||||
end ^
|
||||
set term ;^
|
||||
commit;
|
||||
create domain dm_test_1252 varchar(14) character set win1252;
|
||||
create domain dm_test_iso8859_1 varchar(14) character set iso8859_1 collate pt_br;
|
||||
|
||||
create table t (FIELD_A VARCHAR(14) CHARacter SET WIN1252 not null COLLATE WIN1252);
|
||||
alter table t alter field_a type b_domain;
|
||||
alter table t add primary key (FIELD_A);
|
||||
create table tmain (
|
||||
field_a varchar(14) character set win1252 not null collate win1252
|
||||
);
|
||||
alter table tmain alter field_a type dm_test_iso8859_1;
|
||||
alter table tmain add primary key (field_a);
|
||||
|
||||
create table t2 (FK B_DOMAIN REFERENCES t(FIELD_A));
|
||||
show table t; -- colattion changes to de_de
|
||||
create table tdetl (field_b dm_test_iso8859_1 references tmain(field_a));
|
||||
--show table t; -- colattion changes to de_de
|
||||
commit;
|
||||
|
||||
set list on;
|
||||
set count on;
|
||||
select * from sp_get_table_fields_info('TMAIN');
|
||||
select * from sp_get_table_fields_info('TDETL');
|
||||
"""
|
||||
|
||||
act = isql_act('db', test_script)
|
||||
|
||||
expected_stdout = """FIELD_A (B_DOMAIN) VARCHAR(14) CHARACTER SET ISO8859_1 Not Null
|
||||
COLLATE PT_BR
|
||||
CONSTRAINT INTEG_2:
|
||||
Primary key (FIELD_A)
|
||||
expected_stdout = """
|
||||
TABLE_NAME TMAIN
|
||||
FIELD_NAME FIELD_A
|
||||
FIELD_CSET_ID 21
|
||||
FIELD_COLL_ID 16
|
||||
FIELD_CSET_LEN 14
|
||||
FIELD_CSET_NAME ISO8859_1
|
||||
FIELD_COLL_NAME PT_BR
|
||||
Records affected: 1
|
||||
TABLE_NAME TDETL
|
||||
FIELD_NAME FIELD_B
|
||||
FIELD_CSET_ID 21
|
||||
FIELD_COLL_ID 16
|
||||
FIELD_CSET_LEN 14
|
||||
FIELD_CSET_NAME ISO8859_1
|
||||
FIELD_COLL_NAME PT_BR
|
||||
Records affected: 1
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3')
|
||||
|
Loading…
Reference in New Issue
Block a user