Merlin Moncure <mmoncure@gmail.com> writes:
> On Wed, Jul 29, 2015 at 12:53 PM, Joe Conway <mail@joeconway.com> wrote:
>> Ok, gotcha. So Tom's nearby comment about allowing the
>> "p_rowtype%TYPE" syntax to be used in the CAST is spot on (as usual).
>> In other words, to get a complete solution for you we would need to
>> make both things work, so you could do this inside plpgsql:
>> select * from cast(dblink(connstr, sql) as p_rowtype%TYPE);
> Would this be a pl/pgsql only solution?
Well, it would depend on how we fixed %TYPE, but my thought is that
we should teach the core parser to accept variable%TYPE anywhere that
a suitable "variable" is in scope. The core already allows related
syntaxes in some utility commands, but not within DML commands.
(I am not sure offhand if the existing core syntax is exactly compatible
with what plpgsql does, though; and that could be a problem.)
regards, tom lane