Re: offset and limit in update and subselect

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: offset and limit in update and subselect
Дата
Msg-id 15319.983052474@sss.pgh.pa.us
обсуждение исходный текст
Ответ на offset and limit in update and subselect  ("Timothy H. Keitt" <Timothy.Keitt@SUNYSB.Edu>)
Ответы Re: offset and limit in update and subselect  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
Список pgsql-hackers
"Timothy H. Keitt" <Timothy.Keitt@SUNYSB.Edu> writes:
> Basically, I need to update rows by offset from the beginning of the 
> table.

I think you'd better rethink your data design.  Tuple order in a table
is not a defined concept according to SQL.  Even if we allowed queries
such as you've described, the results would not be well-defined, but
would change at the slightest provocation.  The implementation feels
itself entitled to rearrange tuple order whenever the whim strikes it.

As the documentation tries hard to make plain, LIMIT/OFFSET are only
guaranteed to produce reproducible results if there's also an ORDER BY
that constrains the tuples into a unique ordering.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_atoi() behavior change? Intentional?
Следующее
От: Roberto Mello
Дата:
Сообщение: PL/SQL-to-PL/pgSQL-HOWTO + PL/pgSQL documentation