Corey Huinker <corey.huin...@gmail.com> writes:
> On Wed, Jul 29, 2015 at 10:48 AM, Tom Lane <t...@sss.pgh.pa.us> wrote:
>> Not sure why inserting a variable name is so much better than inserting a
>> type name?

> In a polymorphic function, I don't know the return type. It's whatever type
> was specified on the function call.

> Say I've written a function with a function like
>     outer_polymorphic_function(p_rowtype anyelement,p1 ,p2,p3, ...) returns
> setof anyelement

> And inside that function is a series (probably a handful, but potentially
> thousands) of async dblink calls, and their corresponding calls to
> dblink_get_result(), which currently return setof record, each of which
> needs to be casted to whatever anyelement happens to be given this
> execution.

Yeah.  I would argue that the appropriate fix for that involves allowing
the "p_rowtype%TYPE" syntax to be used in the CAST.  I think right now
you can only use %TYPE in DECLARE sections, but that's a limitation that
causes problems in more situations than just this one.

Mind you, making that work might be less than trivial :-( ... but it would
have uses well beyond dblink().

                        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to