All,

In the past, I resolved CORE-1058 by making DYN_MOD aware of these 
attributes. Recently, Adriano has also fixed CORE-2426 in the same area.

However, this simple test still fails:

create table test (col char(10) character set win1251);
alter table test alter col type char(10) character set utf8;
-- no error is thrown, but charset of the column is still win1251

The first issue is that one would expect either the error to be raised 
or the change to happen, not a silent no-op as now.

The second one is that it does work with a domain:

create domain d_test char(10) character set utf8;
alter table test alter col type d_test;

I've found the reason in DDL_resolve_intl_type2() which ignores the 
specified charset/collation if its last argument = true. The comment in 
the header says that we don't support altering charset/collation. But 
now DYN handles them fine, and removing that "if (modifying)" block 
makes the test case working properly.

However, now I doubt whether it's correct at all. By design, our DDL 
doesn't touch data, so the every table change must be valid a priori. We 
have a number of validations for data types and string lengths, but I 
believe they're missing for charsets/collations.

What if someone changes the column with existing utf8 encoded data to 
win1251 but the data belongs to a different code page? It may make the 
table unreadable. It's easy to reproduce with changing the win1251 
column with some Cyrillic text into the ascii one.

Collations fortunately don't affect record storage but they may affect 
indices. What if there's an unique index on a column and its collation 
is changed to be case-insensitive? Doesn't it make the index invalid 
(uniqueness violated)?

I believe we need to brainstorm this. Should we rollback all these 
fixes? Should we allow them but add the proper consistency checks, e.g. 
allow ASCII->any-single-byte-or-utf8 and any->UTF8 conversions and 
disallow everything else? Should we add a DFW job to validate the 
existing data like we did for NOT NULL? Any other suggestions?

Right now our behaviour is very inconsistent, to say at least.


Dmitry


------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to