Move tables between databases PostgreSQL with a DBLINK



Move tables between databases PostgreSQL with a DBLINK

Move tables between databases PostgreSQL with a DBLINK

Blog:
http://bearsnack.co.uk

Move tables between databases PostgreSQL with a DBLINK

do $$ declare r record ;
begin
for r in select *
from dblink (‘host=localhost
user=postgres
password=password
dbname=source’,
‘select indexdef
from pg_indexes
where tablename = ”mytable”’) as linktable (
indexdef text ) loop
execute r.indexdef;
end loop;
end $$

Comments are closed.