Page 1 of 1

Postgresql dblink

Posted: Tue 10 Dec 2013 10:43
by wusir01
Hi,
I've a problem with postgresql dblink. I'm working on database synchronization. I have one master database1 hosted on host1 and a slave database2 hosted on host2. the 2 databases have not the same tables columns (differences between tables data model). on each changes operated on database1 (hoste1) I want to replicate it on a specific column and specific table on database2 (host2) using dblink. can someone help me please ??

Re: Postgresql dblink

Posted: Tue 10 Dec 2013 10:57
by alexa
You have to map the columns manually. Please refer to the 'How To: Map Columns' and 'How To: Map Tables and Views' topics in the product's Help documentation for details.

Re: Postgresql dblink

Posted: Tue 10 Dec 2013 11:11
by wusir01
select dblink_connect_u('conn104', 'hostaddr=192.168.1.104 port=5432 dbname=db104 user=postgres password=postgres');

select dblink_connect_u('conn105', 'hostaddr=192.168.1.105 port=5432 dbname=db105 user=postgres password=postgres');


select dblink_exec('conn105',
'insert into db105.table1(col1, col2) select * from dblink('conn104', 'select * from db104.table2')
return (id int, colx varchar);');

Re: Postgresql dblink

Posted: Wed 11 Dec 2013 15:00
by alexa
Please try specifying the queries in the 'Custom Queries Mapping' dialog box. dbForge may compare them, however, there is no guarantee that it can synchronize them. Please see the 'Custom Queries Mapping Dialog Box' topic in the product's Help documentation.

Also, you could try to explicitly connect to the Source and Target databases without using dblinks and perform comparison/synchronization.