Re: Foreign Database Connectivity - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Foreign Database Connectivity
Date
Msg-id 29947.1050523325@sss.pgh.pa.us
Whole thread Raw
In response to Re: Foreign Database Connectivity  (mlw <pgsql@mohawksoft.com>)
Responses Re: Foreign Database Connectivity  (Joe Conway <mail@joeconway.com>)
Re: Foreign Database Connectivity  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
mlw <pgsql@mohawksoft.com> writes:
> How about this: (a varient)

> CREATE [OR REPLACE] FUNCTION  name (args)
>     RETURNS setof  (mycol1 integer, mycol2 varchar)
>     LANGUAGE langname
>     .....
>     WITH (attribute, param1='param1', param2='param2',...)

> Now, what would be cool, is if there was a way for the RETURNS specifier 
> to be passed to the function in some easy to use preparsed form.

Just create a rowtype and declare the function as returning that.

With Joe's recent additions for polymorphic functions, it's even
possible for the function to discover what it's supposed to return
at runtime.  (Hey Joe, did we make that work for functions called
from the FROM clause?  If not, seems like something to fix up.)

> The "WITH"  attributes could provide one more attribute, a parameter 
> which could be passed to the function.

Actually, the way that you probably ought to build it is as a new PL
language type.  All the stuff you are thinking of as WITH parameters
would be inside the "function body" in some trivial syntax.  I think
this could likely even be built in 7.3, without the polymorphic
functions (PL handlers are already polymorphic ...)
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Transaction problem?
Next
From: "Rob Butler"
Date:
Subject: Re: Many comments (related to "Are we losing momentum?")