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