Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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; [CORE4744] #5049

Closed
firebird-automations opened this issue Apr 10, 2015 · 2 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

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
************************************************/

Commits: 193b892 FirebirdSQL/fbt-repository@79b5b00

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Beta 2 [ 10586 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Done successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants