Subject Re: [firebird-support] FB 3.0 SQL Error.
Author Mark Rotteveel
On 23-12-2014 18:25, Hugo Eyng hugoeyng@... [firebird-support] wrote:
> In FB 3.0.0 I received the error message: Name longer than database
> column size.
>
> SELECT I.CD_TIPO_MOVIMENTO_ESTOQUE *AS* CD_TIPO_MOVIMENTO_ESTOQUE_COMPRA
> FROM MyTable
>
> CD_TIPO_MOVIMENTO_ESTOQUE_COMPRA (31 characters large)

32 characters

> Ok. I Understood the message. My column has more than 30 characters.

More than 31

> But, in FB 2.5 , a column larger than 30 characters was truncated or
> replaced by a number
> at the end of the column name.
> CD_TIPO_MOVIMENTO_ESTOQUE_COMPRA ->CD_TIPO_MOVIMENTO_ESTOQUE_COMPR
> or
> CD_TIPO_MOVIMENTO_ESTOQUE_COMPRA -> CD_TIPO_MOVIMENTO_ESTOQUE_COMP1
> to avoid duplication field.

Firebird 2.5 silently **truncates** the column name to the first 31
characters (tested with 2.5.3 Update 1). It doesn't apply a numbered
alias if there are multiple columns that truncate to the same name: you
simply get multiple columns with the same alias.

I would consider that a really big bug. A lot of applications expect
that the alias that is used in the query is also the alias that is to be
used for obtaining the value from the result set. Renaming columns
breaks those applications (either hard because of errors, or worse
silently because you get the wrong value (from the wrong column)).

> Is there some kind of setting that cause FB 3.0.0 acting like FB 2.5 in
> this situation?

Not that I know of.

Mark
--
Mark Rotteveel