[sc34wg3] TMQL: limit / offset

Robert Barta rho at devc.at
Fri Feb 27 10:04:09 EST 2009


On Sun, Nov 30, 2008 at 09:47:37PM +0100, Lars Heuer wrote:

> Production [51] "select expression" provides an optional "offset"
> and an optional "limit" clause.  I wonder if it wouldn't make sense
> to switch these from
>     [offset] [limit]
> to
>     [limit] [offset]

I cannot see much argument in favour of either alternative. Except
maybe that the latter is slightly against the flow of thinking.

> and maybe go one step further and disallow "offset" if "limit" is
> not provided.

The way I understand this problem is that limit and offset are ways to
slice the result list. In terms of, say, Python one could have

    List[n:m]
    List[n:]
    List[:m]
    List[:]

One might argue that Python may be a bit more modern (well), than SQL
(1970) which has it exactly as you propose.

So both, lower end (aka offset) and upper end (offset + limit) can be
optional. Independently, and I honest would not like to loose that
orthogonality. It makes sense to me to write

  SELECT ..  OFFSET 10

and expect all but the first 10. Or

  SELECT ..  LIMIT 10

to expect the first 10.

So what is _your_ rationale?

\rho


More information about the sc34wg3 mailing list