From: | Lew <lew(at)lwsc(dot)ehost-services(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Why LIMIT and OFFSET are commutative |
Date: | 2007-11-26 15:10:07 |
Message-ID: | YfydndBaOsdNfNfanZ2dnUVZ_gWdnZ2d@comcast.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Andrus wrote:
>> Under what interpretation would the results differ?
>
> Results must differ for easy creation of LinQ-PostgreSQL driver.
> If results are always the same , PostgreSQL should not allow to use both
> order of clauses.
Um, no, and your original post had nothing to do with LINQ.
My answer was only about SQL.
Your LINQ problems have to be solved in LINQ.
> Nicholas explains:
>
> Assuming the ordering is the same on each of them (because Skip and Take
> make no sense without ordering, LINQ to SQL will create an order for you,
> which irritates me to no end, but that's a separate thread), they will
> produce different results.
Irrelevant. The SQL definitions of these clauses is the SQL definition. LINQ
is a separate issue.
Again, the *SQL* definition says, quoting the PG docs at
<http://www.postgresql.org/docs/8.2/interactive/queries-limit.html>
> If both OFFSET and LIMIT appear, then OFFSET rows are skipped
> *before starting to count the LIMIT rows that are returned.*
(emphasis added)
That's SQL, my friend. OFFSET first, then LIMIT. Irrespective of the order
in the query statement. It is what it is. SQL doesn't depend on LINQ for its
semantics.
--
Lew
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Larsen | 2007-11-26 15:14:42 | Re: replication in Postgres |
Previous Message | Tom Lane | 2007-11-26 15:02:43 | initdb for RC1 (was Re: [GENERAL] possible to create multivalued index from xpath() results in 8.3?) |