Re: Foreign Database Connectivity

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mlw <pgsql(at)mohawksoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Joe Conway <mail(at)joeconway(dot)com>
Subject: Re: Foreign Database Connectivity
Date: 2003-04-16 20:02:05
Message-ID: 29947.1050523325@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

mlw <pgsql(at)mohawksoft(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rob Butler 2003-04-16 20:50:47 Re: Many comments (related to "Are we losing momentum?")
Previous Message Tom Lane 2003-04-16 19:42:48 Re: Transaction problem?