Subject Re: [firebird-support] Re: Max length of SQL statement
Author Helen Borrie
At 11:32 PM 20/06/2007, Paul Gardner wrote:

[ ..snipped.. ]

>select case ID
> when 1 then 'ABC Supplier'
> when 2 then 'DEF Supplier'
> ......
> ......
> end, Many, Other, Invoice, Fields
> From Invoice
>Where ......
>Order by 1
>This allows the dataset returned to be sorted correctly and to run in a
>Quick Report. It's worked fine so far, and I've not seen any cases over
>100 suppliers (yet). Reasking his original question though, when will I
>hit the limit?
Actually, it has been amply pointed out that there is an absolute
limit to the number of items in an IN list of literals, regardless of
the limit on the length of a statement.

The statement length limit is 64 Kb, counting *bytes* and including
all whitespace. If you are passing parameters you have to take into
account the maximum size (in bytes) of any values that will be
slotted into them.

Note that this limit is too high for CREATE PROCEDURE | TRIGGER and
its relatives, which have a 48 Kb limit on the size of the BLR which
means, because BLR is more dense than PSQL, that the size limit on
the PSQL sources is lower than 48 Kb.