I am using dblink to move certain data between databases. Everything is save and sound but I am wondering if there is a more convenient way to define the column definition l
You might need to make sure that your types are always in sync but this should work:
SELECT (t1::test).*
FROM dblink('dbname=remote', 'select * from test') AS t1;
The key is that often you need parentheses to ensure that the parser knows you are dealing with tuples.
For example this works for me:
CREATE TABLE test (id int, test bool);
select (t1::test).* from (select 1, true) t1;
But this throws a syntax error:
select t1::test.* from (select 1, true) t1;