'LIMIT 0, 1' not compatible with PGSQL but ' LIMIT 1 OFFSET 0 ' compatible with mysql . I have tested with mysql and pgsql