Subject Re: [firebird-support] FB 3.0 SQL Error.
Author Hugo Eyng
Thank you for your answer Mark.

You are right, 31 characters.

And I agree that is not a good idea truncating like FB 2.5.

I tested under FB 2.5.2.26539 and IBExpert.

In the sql:

select cd_ent as id_column_name_larger_than_31_test1, tp_ent as id_column_name_larger_than_31_test2
from dm100

IbExpert returned:

 id_column_name_larger_than_31_t  for the first column    and
id_column_name_larger_than_31_1 for the second column

Hugo Eyng

On 23/12/2014 15:46, Mark Rotteveel mark@... [firebird-support] wrote:
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

-- 


Atenciosamente,

Hugo Eyng