Re: dblink: add polymorphic functions.
От | Tom Lane |
---|---|
Тема | Re: dblink: add polymorphic functions. |
Дата | |
Msg-id | 31673.1438186649@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: dblink: add polymorphic functions. (Corey Huinker <corey.huinker@gmail.com>) |
Список | pgsql-hackers |
Corey Huinker <corey.huinker@gmail.com> writes: > On Wed, Jul 29, 2015 at 10:48 AM, Tom Lane <tgl@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
В списке pgsql-hackers по дате отправления: