Re: Select count with offset returns nothing.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tim Uckun <timuckun(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select count with offset returns nothing.
Date: 2011-08-05 15:16:56
Message-ID: 2712.1312557416@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tim Uckun <timuckun(at)gmail(dot)com> 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, I just tried it on mysql 5.5.2, and got results similar to
Postgres: the limit/offset are considered to apply to the single
aggregated row, not the aggregate's input rows as that library
seems to be expecting. I wonder what database they were using
for testing ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Travers 2011-08-05 15:26:12 Re: Postgresql problem with update double precision
Previous Message Tom Lane 2011-08-05 14:55:08 Re: Temp table visibility