Re: Select count with offset returns nothing.

From: Michael Black <michaelblack75052(at)hotmail(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select count with offset returns nothing.
Date: 2011-08-05 11:23:52
Message-ID: BLU144-W35442BB8CACB55AFBFB88FA3C0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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: timuckun(at)gmail(dot)com
> To: pgsql-general(at)postgresql(dot)org
>
> 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 there anything I can do?
>
> Oddly enough SELECT count(*) FROM batches LIMIT 15 returns the full
> count of the table. Presumably the count has to be done on a subquery
> right?
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jerry Sievers 2011-08-05 11:33:47 Re: Select count with offset returns nothing.
Previous Message Jerry Sievers 2011-08-05 11:20:01 Re: Postgresql problem with update double precision