Re: inlining SQL functions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: inlining SQL functions
Date
Msg-id 28647.1270228367@sss.pgh.pa.us
Whole thread Raw
In response to inlining SQL functions  (Alexey Klyukin <alexk@commandprompt.com>)
Responses Re: inlining SQL functions
List pgsql-hackers
Alexey Klyukin <alexk@commandprompt.com> writes:
> Is there a reason why only a table free SQL functions are allowed to
> be inlined ?  I wonder why a simple SQL function containing only a
> SELECT * FROM table can't be expanded inline ?

If you're thinking of just replacing the call with a sub-SELECT
construct, that's no good in general because it would change the
semantics.  We can and do inline such things when the function
returns SETOF and is in the FROM list, but a regular scalar subselect
acts a bit differently than scalar SQL functions historically have.

Keep in mind also that there's not going to be a lot of benefit from
inlining other cases, since a subselect that's not in FROM is not
very optimizable.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Alpha release this week?
Next
From: Robert Haas
Date:
Subject: Re: Compile fail, alpha5 & gcc 4.3.3 in elog.c