arrays of rows and dblink

From: Torsten Förtsch <torsten(dot)foertsch(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: arrays of rows and dblink
Date: 2014-04-30 17:52:01
Message-ID: 53613841.9060703@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

we have the ROW type and we have arrays. We also can create arrays of
rows like:

select array_agg(r)
from (values (1::int, 'today'::timestamp, 'a'::text),
(2, 'yesterday', 'b')) r(a,b,c);
array_agg
-------------------------------------------------------------------
{"(1,\"2014-04-30 00:00:00\",a)","(2,\"2014-04-29 00:00:00\",b)"}

Now I want to execute that query via dblink on a remote server. How do I
specify the result type?

select tb.* from dblink( 'dbname=postgres', $$
select array_agg(r)
from (values (1::int, 'today'::timestamp, 'a'::text),
$$) tb( WHAT DO I PUT HERE? )

Thanks,
Torsten

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G Johnston 2014-04-30 18:19:00 Re: arrays of rows and dblink
Previous Message Elanchezhiyan Elango 2014-04-30 17:49:27 Re: Vacuuming strategy