Re: Why LIMIT and OFFSET are commutative

Поиск
Список
Период
Сортировка
От Lew
Тема Re: Why LIMIT and OFFSET are commutative
Дата
Msg-id YfydndBaOsdNfNfanZ2dnUVZ_gWdnZ2d@comcast.com
обсуждение исходный текст
Ответ на Re: Why LIMIT and OFFSET are commutative  (Lew <lew@lwsc.ehost-services.com>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Peter Bauer
Дата:
Сообщение: System Load analyze
Следующее
От: "Amit"
Дата:
Сообщение: Help Needed