Re: ORDER records based on parameters in IN clause

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: ORDER records based on parameters in IN clause
Дата
Msg-id 20050628045700.GA18147@winnie.fuhr.org
обсуждение исходный текст
Ответ на ORDER records based on parameters in IN clause  ("Riya Verghese" <riya.verghese@admissioncorp.com>)
Список pgsql-sql
On Mon, Jun 27, 2005 at 09:15:15AM -0700, Riya Verghese wrote:
>
> I have a stmt where the outer-query is limited by the results of the
> inner query. I would like the outer query to return records in the same
> order as the values provided in the IN clause (returned form the inner
> query). 

If you want a particular order then use ORDER BY.  The SQL standard
says that without an ORDER BY clause, row order is implementation-
dependent; the PostgreSQL documentation also says the same thing:

http://www.postgresql.org/docs/8.0/static/queries-order.html

"If sorting is not chosen, the rows will be returned in an unspecified
order.  The actual order in that case will depend on the scan and
join plan types and the order on disk, but it must not be relied on.
A particular output ordering can only be guaranteed if the sort step
is explicitly chosen."

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


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

Предыдущее
От: "Sim Zacks"
Дата:
Сообщение: Re: scroll cursor bug or me?
Следующее
От: "M.D.G. Lange"
Дата:
Сообщение: Re: Unique primary index?