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

From Tom Lane
Subject Re: Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs
Date
Msg-id 5741.1420492496@sss.pgh.pa.us
Whole thread Raw
In response to Re: Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Responses Re: Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs
List pgsql-hackers
Jim Nasby <Jim.Nasby@bluetreble.com> writes:
> Related... I'd like to see a way to inline a function that does something like:

> CREATE FUNCTION foo(text) RETURNS int LANGUAGE sql AS $$
> SELECT a FROM b WHERE lower(b.c) = lower($1)
> $$

The reason that's not inlined ATM is that the semantics wouldn't be the
same (ie, what happens if the SELECT returns more than one row).  It's
possible they would be the same if we attached a LIMIT 1 to the function's
query, but I'm not 100% sure about that offhand.  I'm also not real sure
that you'd still get good performance if there were an inserted LIMIT;
that would disable at least some optimizations.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs
Next
From: Robert Haas
Date:
Subject: Re: event trigger test exception message