Hi *,

there's currently no way of altering collation of field in 2.5.4, right?
I checked all the possible documentation on firebirdsql.org and haven't
found a way. So only system table modification seems to be an option.

Let's have these two tables:
create table parent (
    id bigint not null,
    code varchar(512) character set utf8 not null collate utf8
);
create table foobar (
    id bigint not null,
    id_master bigint not null,
    code computed by ((select code from parent where id = id_master))
);

Now the collation ids for both CODE column are 0, as expected:
select rdb$collation_id
from rdb$relation_fields
where rdb$field_name = 'CODE' and rdb$relation_name = 'PARENT';
select rdb$collation_id
from rdb$relation_fields
where rdb$field_name = 'CODE' and rdb$relation_name = 'FOOBAR';

Now I'll change the collation of PARENT.CODE:
update rdb$relation_fields
set rdb$collation_id = 3
where rdb$field_name = 'CODE' and rdb$relation_name = 'PARENT';

And "recreate" the FOOBAR.CODE (I'm using alter to avoid hitting
dependencies):
alter table foobar alter code computed by ((select code from parent
where id = id_master));

Now the collation id for PARENT.CODE is 3, as expected. But FOOBAR.CODE
is still 0. It doesn't even help if I "recreate" from and to:
alter table foobar alter code computed by ((select code from parent
where id = id_master + 1));
alter table foobar alter code computed by ((select code from parent
where id = id_master));

I know this is quite dirty. But I need to be able to change collation on
a field and - lucky me - the field is used in another (computed) field.
Is there a way to force system tables to "sync"? Or other way to change
collation?

-- 
Mgr. Jiří Činčura
Independent IT Specialist

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to