On Mon, 03 Sep 2012 10:09:12 -0000, "Fabiano" <[email protected]> wrote: > Hi all, > > create domain d1 varchar(100) character set utf8; > create table t1 (c1 d1, c2 d1); > alter table t1 add unique (c1, c2); > > create domain d2 varchar(100) character set utf8 collate unicode_ci_ai; > create table t2 (c1 d2, c2 d2); > alter table t2 add unique (c1, c2); > -- unsuccessful metadata update. key size exceeds implementation > restriction for index "RDB$2". > > Is this error expected? > > Firebird 2.5, database page size 4096.
As far as I know collations add additional information to each key, increasing the length. The maximum length of a key is +/- 1/4 of the page size (assuming a single key). For a normal UTF8 collation that would be 253 bytes (see http://www.firebirdsql.org/refdocs/langrefupd25-ddl-index.html#langrefupd25-tbl-max-indexable-strlen ). So in the normal UTF8 case your key is > 200 characters. Her I also assume there is some additional overhead as it is a compound index. I don't know the exact size increase for a collation (and I suspect it depends on the collation), but I guess this pushes it beyond the limit of 1015 bytes allowed per key. The simplest solution is to move to a greater page size. Another option of course is to check if you really need VARCHAR(100) for these columns. Mark
