Re: ordering of selected rows from an ordered subselect

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: ordering of selected rows from an ordered subselect
Date: 2007-02-17 15:24:34
Message-ID: 20070217152434.GA3623@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, Feb 17, 2007 at 03:02:06PM +0530, Rajesh Kumar Mallah wrote:
>
> select id , name , expensive_func(name) from
> ( select id , name from tab order by c1 desc limit 15) as foo ;
>
> is it guaranteed that the final result is order by c1 ?

No, because expensive_func(name) might do something that alters it,
no? All things considered, it's a pretty good _bet_ it will be
ordered as you wish, though.

A

--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca
The whole tendency of modern prose is away from concreteness.
--George Orwell

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2007-02-17 16:31:34 Re: ordering of selected rows from an ordered subselect
Previous Message A. Kretschmer 2007-02-17 15:00:33 Re: sub-limiting a query