Hi Lukas.

We found an strange behavior on the jOOQ query builder related to limit and
offset order of application. Happens that if we have this query expression:

somequery.offset(100).limit(10)

the offset is just ignored. And I'm pretty sure (viewing the jOOQ code)
that it is always ignored if it is used before limit:

    @Override
    public final SelectImpl offset(int offset) {
        if (limit != null) {
            getQuery().addLimit(offset, limit);
        }
        else if (limitParam != null) {
            getQuery().addLimit(offset, limitParam);
        }
        return this;
    }

I know, this seems to be documented as expected behavior but in practice is
very unexpected, because in SQL, limit and offset can be interchanged the
order without any problem:

test=# select x from generate_series(1,100) as x offset 10 limit 2;
 x
----
 11
 12

Thanks!

Andrey

-- 
Andrey Antukh - Андрей Антух - <[email protected]>
http://www.niwi.nz
https://github.com/niwinz

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to