Subject | Re: [firebird-support] Changing collation |
---|---|
Author | Ann Harrison |
Post date | 2017-06-28T20:58:39Z |
On Tue, Jun 27, 2017 at 1:39 PM, Tomasz Tyrakowski t.tyrakowski@... [firebird-support] <firebird-support@yahoogroups.com> wrote:,
Is it possible to change the collation of a varchar column in place
(without making a temporary column, copying data, dropping the original
column, making it anew and copying the data back)?Not if you have indexes, a declared primary key, or a declared uniqueconstraint. The index keys are a transformation of the value into a formatthat produces the desired ordering through binary comparisons.Would setting
RDB$RELATION_FIELDS.RDB$ COLLATION do the trick (and is it safe to do)?Not safe, won't work, and will produce very odd results on range queries on anyindex. Or, say, a query that causes Firebird to return rows in index order.I've got several old production databases which have different
collations on different columns (probably by mistake) and would like to
sort it out.However messy with inter-column dependencies, the only way to make thechange is to create a new column with the desired collation, copy the data,drop the old column, recreate the old column with the new collation andrepopulate it.Also, does the RDB$RELATION_FIELDS.RDB$ COLLATION somehow depend on the
default character set of the database, or is it universal (i.e. does the
collation code from RDB$RELATION_FIELDS.RDB$ COLLATION always mean the
same, or does a single code mean different collations in databases with
different default character sets)?The format of the keys depends on the character set - different character setshave different meanings for some byte values, which collate differently.Good luck,Ann