Re: offset and limit in update and subselect

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Timothy H(dot) Keitt" <Timothy(dot)Keitt(at)SUNYSB(dot)Edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: offset and limit in update and subselect
Date: 2001-02-24 22:07:54
Message-ID: 15319.983052474@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Timothy H. Keitt" <Timothy(dot)Keitt(at)SUNYSB(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-02-24 22:20:06 Re: A patch for xlog.c
Previous Message Tom Lane 2001-02-24 21:58:16 Re: pg_atoi() behavior change? Intentional?