2015-01-05 Tom Lane <tgl@sss.pgh.pa.us>:
> What would make sense to me is to teach the planner about inlining
> SQL functions that include ORDER BY clauses, so that the performance
> issue of a double sort could be avoided entirely transparently to
> the user.
Another way of getting to the point where the extra check-node is not
needed in obvious cases, would be:
* Apply the current patch in some form.
* Later, add code that analyzes the query inside the function. If it
turns out that the result of the analysis implies the declared order,
don't add the check-node.
The analysis can in principle also be performed for other languages,
but that would most likely be way more complex for the typical "Turing
complete" languages.
Nicolas
--
A. Because it breaks the logical sequence of discussion.
Q. Why is top posting bad?