Subject Re: [firebird-support] Re: Error on UTF8 in concatenation?
Author Martijn Tonies
> --- Martijn Tonies wrote:
> > This SQL:
> > SELECT R.RDB$RELATION_ID || '=', R.RDB$RELATION_NAME
> > FROM RDB$RELATIONS R
> > ORDER BY 1 ASC
> >
> > returns this error on an UTF8 database:
> > arithmetic exception, numeric overflow, or string truncation
> >
> > If I remove the || '=' part, it works fine though.
>
> It also works if you remove ORDER BY clause. And it also works if you
> CAST first column to varchar:
>
> SELECT cast(R.RDB$RELATION_ID || '=' as varchar(33)), R.RDB$RELATION_NAME
> FROM RDB$RELATIONS R
> order by 1
>
> My guess is that Firebird tries to sort the first column as INTEGER
> since RDB$RELATION_ID is integer. However, when you add '=' it cannot
> be converted to integer anymore - and thus the error.

Hm, interesting. Sounds like a bug to me, given that it should sort
on the actual resultset column, not the value from the database, right?

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com