Re: Equivalence Classes when using IN

From: Kim Rose Carlsen <krc(at)hiper(dot)dk>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Equivalence Classes when using IN
Date: 2017-10-10 06:52:28
Message-ID: VI1PR05MB1709ABD41EFF09E4FAAFF4C3C7750@VI1PR05MB1709.eurprd05.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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?

I dont know if it makes any difference that the ORDER BY is used in a
DISTINCT ON clause. In this case the ORDER BY is important.

- Kim

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ramesh 2017-10-10 08:49:19 Re: Can master and slave on different PG versions?
Previous Message Kim Rose Carlsen 2017-10-10 06:48:09 Re: Equivalence Classes when using IN