Subject Re: [firebird-support] Max identifier length?
Author Kjell Rilbe
Martijn Tonies wrote:

> > Is it correct that FB stores identifier names in a system table with a
> > column width of 31 8-byte characters? It seems to me that this is the
>
> 8-bit?

:-) Yes, obviously!

> It stores names in UNICODE_FSS characterset.

Which is a variable length encoding, right?

> > 2. Any plans to increase the max length in general, regardless of
> > encoding?
>
> Yes.

Good! In 2.5 or 3.0 or later?

> > Yes, I do have use for longer names, and yes, I do hate that the max
> > length varies depending on the actual characater content.
>
> What gives you that idea?

Try this in a DB with default charset UTF8:

// Table name is 31 ASCII characters.
// Works fine.
create table "X234567890123456789012345678901" (
"Dummy" int
);

// Table name is 31 characters, but one of them is not ASCII.
// Fails - identifier too long.
create table "X23456789012345678901234567890Ä" (
"Dummy" int
);

// Table name is 30 characters, one of which is not ASCII.
// Works fine.
create table "X2345678901234567890123456789Ä" (
"Dummy" int
);

// Table name is 30 characters, two of which is not ASCII.
// Fails - identifier too long.
create table "X234567890123456789012345678ÖÄ" (
"Dummy" int
);

// Table name is 29 characters, two of which is not ASCII.
// Works fine.
create table "X23456789012345678901234567ÖÄ" (
"Dummy" int
);

This would, if I'm not misunderstanding things, show that the table name
can be max 31 bytes long, and it's stored in a format like UTF8 where
ASCII is stored as 8 bit/char, while Ä and Ö is stored as 16 bit/char. I
expect other codepoints to use three or more bytes, further reducing the
max number of codepoints that can be used in the identifier.

It would seems more "useful" if the max length were 31 Unicode codepoints.

Kjell
--
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64