Subject Error when using UTF8 charset during metadata queries?
Author Martijn Tonies
Hi Jason,

I'm connecting via Database Workbench to an UTF8 charset database.

When I do this:
select
*
from
UTF8TEST

in a (wrapped) TIBODataset, I get:
arithmetic exception, numeric overflow, or string truncation

with a trace of:
SELECT S.RDB$FIELD_NAME
, I.RDB$RELATION_NAME
FROM RDB$RELATION_CONSTRAINTS C
, RDB$INDICES I
, RDB$INDEX_SEGMENTS S
WHERE C.RDB$CONSTRAINT_TYPE = 'PRIMARY KEY'
AND C.RDB$RELATION_NAME = I.RDB$RELATION_NAME
AND C.RDB$INDEX_NAME = I.RDB$INDEX_NAME
AND I.RDB$INDEX_NAME = S.RDB$INDEX_NAME
ORDER BY I.RDB$RELATION_NAME ASC
, S.RDB$FIELD_POSITION ASC

SELECT S.RDB$FIELD_NAME
FROM RDB$RELATION_CONSTRAINTS C
, RDB$INDICES I
, RDB$INDEX_SEGMENTS S
WHERE C.RDB$CONSTRAINT_TYPE = 'PRIMARY KEY'
AND C.RDB$RELATION_NAME = I.RDB$RELATION_NAME
AND C.RDB$INDEX_NAME = I.RDB$INDEX_NAME
AND I.RDB$INDEX_NAME = S.RDB$INDEX_NAME
AND I.RDB$RELATION_NAME = ? /* RDB$RELATION_NAME */
ORDER BY S.RDB$FIELD_POSITION ASC

PARAMS = [ Version 1 SQLd 1 SQLn 1
[RDB$RELATION_NAME] = 'UTF8TEST
' ]


SELECT UTF8TEST.*
, UTF8TEST.RDB$DB_KEY
from
UTF8TEST

PLAN (UTF8TEST NATURAL)

SELECT R.RDB$FIELD_NAME
, R.RDB$RELATION_NAME
FROM RDB$RELATION_FIELDS R
, RDB$FIELDS F
WHERE R.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME
AND F.RDB$COMPUTED_SOURCE IS NOT NULL
AND NOT R.RDB$RELATION_NAME STARTING WITH 'RDB$'
ORDER BY 1 ASC


SELECT R.RDB$RELATION_ID || '=', R.RDB$RELATION_NAME
FROM RDB$RELATIONS R
ORDER BY 1 ASC

PLAN SORT ((R NATURAL))


Whenever I retry the query in the Query Editor, it works fine. So it appears
IBO is raising the error in the last metadata query, because it doesn't
execute
those anymore.

A second attempt gives me this trace:

SELECT UTF8TEST.*
, UTF8TEST.RDB$DB_KEY
from
UTF8TEST

PLAN (UTF8TEST NATURAL)



Got a clue?

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