From: Martín Marqués <martin@bugs.unl.edu.ar>
To: Markus Bertheau ☭ <twanger@bluetwanger.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: SELECT * FROM foo OFFSET -1 LIMIT 1
Date: Mon, 27 Jun 2005 14:17:28 -0300
Message-ID: <200506271417.28851.martin@bugs.unl.edu.ar> (raw)
In-Reply-To: <1119886449.29687.3.camel@dicaprio.akademie1.de>
References: <1119886449.29687.3.camel@dicaprio.akademie1.de>
El Lun 27 Jun 2005 12:34, Markus Bertheau ☭ escribió:
> Hi,
>
> is there a reason that
>
> SELECT * FROM t1 OFFSET -1 LIMIT 1
>
> does not return 0 rows? Accordingly
>
> SELECT * FROM t1 OFFSET -1 LIMIT 2
>
> should return 1 row, imo.
From the docs:
The LIMIT clause consists of two independent sub-clauses:
LIMIT { count | ALL }
OFFSET start
count specifies the maximum number of rows to return, while start specifies
the number of rows to skip before starting to return rows. When both are
specified, start rows are skipped before starting to count the count rows to
be returned.
How do you skip -1 rows?
--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
---------------------------------------------------------
Martín Marqués | Programador, DBA
Centro de Telemática | Administrador
Universidad Nacional
del Litoral
---------------------------------------------------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: martin@bugs.unl.edu.ar, twanger@bluetwanger.de
Subject: Re: SELECT * FROM foo OFFSET -1 LIMIT 1
In-Reply-To: <200506271417.28851.martin@bugs.unl.edu.ar>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox