Subject Re: 1500 values in IN (...) clause fails
Author karolbieniaszewski
--- In firebird-support@yahoogroups.com, Kjell Rilbe <kjell.rilbe@...> wrote:
>
> Hi,
>
> I just bumped up ECO to select up to 1500 objects from persistence in
> one go, resulting in a select like this:
>
> SELECT "Uppgift_A"."ECO_ID",
> "Uppgift_A"."ECO_TYPE",
> "Uppgift_A"."Hållare"
> FROM "Uppgift" "Uppgift_A"
> WHERE "Uppgift_A"."Hållare" IN (601089, 601092, ...)
>
> I checked that it put exactly 1500 values in there, but FB fails:
>
> Message: isc_dsql_prepare failed
>
> SQL Message : -901
> Unsuccessful execution caused by system error that does not preclude
> successful execution of subsequent statements
>
> Engine Code : 335544569
> Engine Message :
> Dynamic SQL Error
> SQL error code = -901
> Implementation limit exceeded
> Too many values (more than 1500) in member list to match against
>
>
> So, either I've been misinformed or there's a bug in FB. Either FB
> should support 1500 and has a bug, limiting it to 1499. Or FB is
> supposed to support up to BUT NOT INCLUDING 1500 values, in which case
> every place I've seen this limit mentioned has been incorrect.
>
> So, which is it?
>
> Not that it matters very much, it just nags me that it seems wrong.
>
> Kjell
> --
> ------------------------------
> Kjell Rilbe
> DataDIA AB
> E-post: kjell.rilbe@...
> Telefon: 08-761 06 55
> Mobil: 0733-44 24 64
>
>
> [Non-text portions of this message have been removed]
>

Having 1500 values in "in" is not good choice
but try change this to

in (
SELECT 601089 FROM RDB$DATABASE
UNION
SELECT 601092 FROM RDB$DATABASE
...
)

but better will be to fill some temporary table with this data

Karol Bieniaszewski