Subject Re: [firebird-support] String overflow
Author Mark Rotteveel
On Wed, 07 Dec 2011 09:22:13 -0300, Maximiliano Robaina
<maxi_robaina@...> wrote:
> Hi,
> I'm a little bit confuse here. This select statement raise this error:
>
> SELECT COUNT(*) FROM "AFILIADO" INNER JOIN "PERSONA" ON
> ("AFILIADO"."PER_ID" = "PERSONA"."PER_ID") WHERE "PERSONA"."FULL_NAME"
> CONTAINING
>
'0........................................................................................................................................'
>
> -802L, 'String overflow: value 137 bytes long cannot fit in character
> field of maximum length 111
>
> Obviously, FULL_NAME is a varchar(111).
>
> This select statement is part of a django (python) project. I'm using
> django-firebird built on top of kinterbasdb. The production server is a
> Windows 2003 Server with Firebird 2.1 SS.
>
> But, if I run this select, for example, using FlameRobin I don't get
> that error.
>
> Also, I test this in my laptop with Ubuntu 11.04 and Firebird 2.5 with
> the same result.
>
> What can be wrong?
>
> Any help will be appreciated.

Your containing condition is 137 characters. I suspect that this is not
the actual query sent, but that django sends a preparedstatement with a '?'
placeholder and sets the parameter to the value
'0........................................................................................................................................'

Firebird demands that parameters in comparisons have the same (or smaller)
size as the field used in the comparison.

Your could simulate this error in FlameRobin with execute statement (some
thing like:
EXECUTE STATEMENT 'SELECT COUNT(*) FROM "AFILIADO" INNER JOIN "PERSONA"
ON ("AFILIADO"."PER_ID" = "PERSONA"."PER_ID") WHERE "PERSONA"."FULL_NAME"
CONTAINING ?'
('0........................................................................................................................................')

This is a known problem, see also CORE-3559, CORE-251 and JDBC-132

Mark