Re: [GENERAL] Equivalence Classes when using IN

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: [GENERAL] Equivalence Classes when using IN
Дата
Msg-id CAKJS1f8NUcfNKy7Yvfjhd0=+Ztf=cgkHWs475ouPhFoLxoHnTw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Equivalence Classes when using IN  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [GENERAL] Equivalence Classes when using IN
Re: [GENERAL] Equivalence Classes when using IN
Список pgsql-general
On 10 October 2017 at 02:51, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> David Rowley <david.rowley@2ndquadrant.com> writes:
>> It's pretty bad practice to have ORDER BY in views. I kinda wish we
>> didn't even allow it, but that ship sailed many years ago...
>
> I think it's actually disallowed by the SQL spec (although so are
> many other things we support).  IMO it's a useful facility to have
> for views that are meant for direct presentation to clients ---
> but if you'd like joins to the view to be optimized, you don't
> want an ORDER BY in there.

If the only reason that is_simple_subquery() rejects subqueries with
ORDER BY is due to wanting to keep the order by of a view, then
couldn't we make is_simple_subquery() a bit smarter and have it check
if the subquery is going to be joined to something else, which likely
would destroy the order, or at least it would remove any guarantees of
it.

Something like the attached?

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] startup process stuck in recovery
Следующее
От: Christophe Pettus
Дата:
Сообщение: Re: [GENERAL] startup process stuck in recovery