Re: order by not working in view ? - Mailing list pgsql-general

From Tom Lane
Subject Re: order by not working in view ?
Date
Msg-id 5555.1586443297@sss.pgh.pa.us
Whole thread Raw
In response to order by not working in view ?  (David Gauthier <davegauthierpg@gmail.com>)
List pgsql-general
David Gauthier <davegauthierpg@gmail.com> writes:
> In the copy/paste below, first 2 lines returned by a select on the view,
> why didn't it sort on start_datetime correctly ?

Putting an ORDER BY in a view is a bit dangerous (last I looked,
it wasn't even legal in standard SQL).  Yeah, the view will sort,
but there is nothing compelling the calling query to preserve
the ordering.

EXPLAIN would give you more info, but I'm betting that the IN is being
converted to a semijoin and then done with a non-order-preserving join
method.

            regards, tom lane



pgsql-general by date:

Previous
From: Stephen Frost
Date:
Subject: Re: full text
Next
From: "David G. Johnston"
Date:
Subject: Re: order by not working in view ?