Tim Uckun writes:
> I am using a library which is emitting SQL like this SELECT COUNT(*)
> FROM batches LIMIT 15 OFFSET 15 the library fails because on postgres
> this query returns nothing (not even zero as a result). Presumably it
> returns some valid value on mysql and other databases.
FWIW,
Yea I figured it would need a subquery. I filed a ticket with the
library. Hopefully they will fix it.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On Fri, Aug 5, 2011 at 4:51 AM, Tim Uckun wrote:
> I am using a library which is emitting SQL like this SELECT COUNT(*)
> FROM batches LIMIT 15 OFFSET 15 the library fails because on postgres
> this query returns nothing (not even zero as a result). Presumably it
> returns some valid value on mys
Tim Uckun writes:
> I am using a library which is emitting SQL like this SELECT COUNT(*)
> FROM batches LIMIT 15 OFFSET 15 the library fails because on postgres
> this query returns nothing (not even zero as a result). Presumably it
> returns some valid value on mysql and other databases.
>
> Ot
My question is why would you put an offset in a query designed to return a row
count without grouping and ordering?
> Date: Fri, 5 Aug 2011 22:51:24 +1200
> Subject: [GENERAL] Select count with offset returns nothing.
> From: timuc...@gmail.com
> To: pgsql-general@postgresql.org
>
Hi,
I think problem is in OFFSET 15
It means return rows after row 15... because of SELECT COUNT(*)
FROM batches LIMIT 15 returns 1 row when you add OFFSET 15 - it returns
nothing... because of there is no more than 15 rows...
I am not sure u can do something else then to change library to rem
I am using a library which is emitting SQL like this SELECT COUNT(*)
FROM batches LIMIT 15 OFFSET 15 the library fails because on postgres
this query returns nothing (not even zero as a result). Presumably it
returns some valid value on mysql and other databases.
Other than hacking the library is