Issue Details (XML | Word | Printable)

Key: CORE-4744
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Pavel Zotov
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

ALTER DATABASE SET DEFAULT CHARACTER SET: 1) take effect only for once for current attachment; 2) does not check that new char set exists untill it will be used;

Created: 10/Apr/15 09:40 AM   Updated: 28/May/15 04:29 PM
Component/s: Charsets/Collation
Affects Version/s: None
Fix Version/s: 3.0 Beta 2

QA Status: Done successfully


 Description  « Hide
Scenario and its output for illustrating the problem:
==================

create database 'localhost/3333:C:\FBTESTING\qa\fbt-repo\tmp\db_cset_utf8.fdb' default character set utf8;

set list on;

select rdb$character_set_name from rdb$database;

/************************************************
                        ::: STDOUT :::

RDB$CHARACTER_SET_NAME UTF8
************************************************/

commit;

create or alter view v_table_field_cset as
select
   rf.rdb$relation_name tab_name
  ,rf.rdb$field_name fld_name
  ,cs.rdb$character_set_name fld_cset
  ,rb.RDB$CHARACTER_SET_NAME db_default_cset
from rdb$relation_fields rf
join rdb$fields ff on rf.rdb$field_source = ff.rdb$field_name
join rdb$character_sets cs on ff.rdb$character_set_id = cs.rdb$character_set_id
cross join rdb$database rb
;
commit;

-------- CHANGE DATABASE DEFAULT CHARSET, COMMAND # 1 --------

alter database set default character set dos850;
commit;

create table tab_850( txt_850 varchar(10)); commit;
select * from v_table_field_cset where tab_name=upper('tab_850');

/************************************************
                        ::: STDOUT :::

TAB_NAME TAB_850
FLD_NAME TXT_850
FLD_CSET DOS850 ---- yes, changed. But this is last time for current attachment.
DB_DEFAULT_CSET DOS850
************************************************/

-------- CHANGE DATABASE DEFAULT CHARSET, COMMAND # 2 --------

alter database set default character set dos866;
commit;

create table tab_866( txt_866 varchar(10)); commit;
select * from v_table_field_cset where tab_name=upper('tab_866');

/************************************************
                        ::: STDOUT :::

TAB_NAME TAB_866
FLD_NAME TXT_866
FLD_CSET DOS850 ---- field charset remains OLD!
DB_DEFAULT_CSET DOS866
************************************************/

-------- CHANGE DATABASE DEFAULT CHARSET, COMMAND # 3 --------

alter database set default character set win1252;
commit;

create table tab_1252( txt_1252 varchar(10)); commit;
select * from v_table_field_cset where tab_name=upper('tab_1252');

/************************************************
                        ::: STDOUT :::

TAB_NAME TAB_1252
FLD_NAME TXT_1252
FLD_CSET DOS850 ---- field charset remains OLD!
DB_DEFAULT_CSET WIN1252

************************************************/

-------- CHANGE DATABASE DEFAULT CHARSET TO NON-EXISTED VALUE --------

alter database set default character set FOO_BAR_8859_4;
commit; -- PASSED!

-- Now make reconnect:
connect 'localhost/3333:C:\FBTESTING\qa\fbt-repo\tmp\db_cset_utf8.fdb' user 'sysdba' password 'masterke';

create table tab_foo( txt_8859_4 varchar(10) );

/************************************************
                        ::: STDERR :::

Statement failed, SQLSTATE = HY004
unsuccessful metadata update
-CREATE TABLE TAB_FOO failed
-Dynamic SQL Error
-SQL error code = -204
-Data type unknown
-CHARACTER SET FOO_BAR_8859_4 is not defined
************************************************/


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.