Re: Do Layered Views/Relations Preserve Sort Order ? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Do Layered Views/Relations Preserve Sort Order ?
Date
Msg-id CA+TgmoYC6GD8sWUKCY57gF8SZWjK--SWBQSwgCxUYKEbbCkt-w@mail.gmail.com
Whole thread Raw
In response to Do Layered Views/Relations Preserve Sort Order ?  (Charles Sheridan <cesheri@swbell.net>)
List pgsql-hackers
On Wed, Sep 9, 2015 at 7:53 PM, Charles Sheridan <cesheri@swbell.net> wrote:
> When there are several views defined on top of each other, are SELECTs on
> views that do not specify a SORT order guaranteed to preserve the cumulative
> sort order of the lower-level views ?
>
> Is the answer true for any arbitrarily large set of layered views?
>
> Is the answer the same if the layers of relations are a mix of views and
> tables ?

If a view definition includes an ORDER BY clause, the output of that
view will be sorted accordingly.  But if you do something with that
output, like join it to another table, then the join might disturb the
sort order.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Latent cache flush hazard in RelationInitIndexAccessInfo
Next
From: Robert Haas
Date:
Subject: Re: RLS open items are vague and unactionable