ACTUAL capacity of field declared in character set UTF8 can be reduced by 
changing to character set NONE, table data are unavaliable after this.
------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: CORE-4730
                 URL: http://tracker.firebirdsql.org/browse/CORE-4730
             Project: Firebird Core
          Issue Type: Bug
            Reporter: Pavel Zotov


set autoddl off;
recreate table test(id int);
commit;

set term ^;
execute block as
begin
  execute statement 'drop domain dmxx'; 
when any do begin end
end
^
set term ;^
commit;

create domain dmxx varchar(15) character set none;
commit;

alter table test add s01 varchar(8) character set utf8;
commit;
insert into test(id, s01) values( 1, 'qwertyui');
insert into test(id, s01) values( 2, 'âêûėżöé');
insert into test(id, s01) values( 3, 'öüčřžéèê');
commit;
select id, s01, char_length(s01) s01_char_length, octet_length(s01) s01_octecs 
from test;

alter table test alter column s01 type dmxx;
commit;
show table test;

select * from test;


Result in WI-T3.0.0.31756:
~~~~~~~~~~~~~~~~~~~~~

          ID S01      S01_CHAR_LENGTH   S01_OCTECS 
============ ======== =============== ============ 
           1 qwertyui               8            8 
           2 âêûėżöé                7           14 
           3 öüčřžéèê               8           16 

ID                              INTEGER Nullable 
S01                             (DMXX) VARCHAR(15) Nullable -- <<< table DDL 
has been changes SUCCESSFULLY despite data with more than 15 octets in it ?

          ID S01             
============ =============== 
           1 qwertyui        
           2 âêûėżöé  
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 15, actual 32


Result in WI-V2.5.4.26853:
~~~~~~~~~~~~~~~~~~~~~

          ID S01                              S01_CHAR_LENGTH   S01_OCTECS 
============ ================================ =============== ============ 
           1 qwertyui                                       8            8 
           2 âêûėżöé                                 7           14 
           3 öüčřžéèê                               8           16 

Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-New size specified for column S01 must be at least 32 characters.

ID                              INTEGER Nullable 
S01                             VARCHAR(8) CHARACTER SET UTF8 Nullable 

          ID S01                              
============ ================================ 
           1 qwertyui                         
           2 âêûėżöé                   
           3 öüčřžéèê                 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to