Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs - Mailing list pgsql-hackers

From Atri Sharma
Subject Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs
Date
Msg-id CAOeZViccEW9RQYzVpyre941_Td3fvvAJZjuYdNf6MdiQ_mtaSw@mail.gmail.com
Whole thread Raw
In response to Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs
List pgsql-hackers


On Tue, Jan 6, 2015 at 12:43 PM, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> wrote:
On 06-01-2015 PM 04:08, Atri Sharma wrote:
> On Tue, Jan 6, 2015 at 12:29 PM, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp


I read what Ashutosh says as that a clause like IMMUTABLE does not
entail a node execution. Reading manual for CREATE FUNCTION:

<manual>
IMMUTABLE
STABLE
VOLATILE

These attributes inform the query optimizer about the behavior of the
function.
</manual>

They declare the shape of the kind of output the function produces and
planner simply trusts the declaration meaning it does not add a node to
check if, say, an IMMUTABLE function did not actually modify the
database or that it is returning the same output for a given input.

Though, I have no strong opinion on whether one thing is good or the
other or whether they cover some particular use case all the same.
Perhaps you can say that better.


Personally, I think returning non ordered rows when ORDER BY clause is specifically specified by user is a gross violation of security and could lead to major user application breakdowns, since the application will trust that postgres will return the rows in order since ORDER BY was specified. Of course, what Ashutosh suggested makes the patch much simpler, but I would rather not go down that road. 



pgsql-hackers by date:

Previous
From: Atri Sharma
Date:
Subject: Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs
Next
From: David G Johnston
Date:
Subject: Re: Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs