Hello, I will create postgres_fdw and explain data transfer.
First of all, we create EXTENSION, the name of which we determine ourselves.
CREATE EXTENSION test;
We are creating a server for the machine that we will access to do the dblink task.
CREATE SERVER deneme FOREIGN DATA WRAPPER test OPTIONS (host 'xxx.xxx.xx.xx', dbname 'TEST', port '5432');
We are mapping users in two different environments to each other.
CREATE USER MAPPING FOR postgres SERVER cm96 OPTIONS (user 'Test' , password 'test123#');
We create schema on the machine where we set up dblink
CREATE SCHEMA Test;
We can move the data with the IMPORT FOREIGN command on the server we created.
IMPORT FOREIGN SCHEMA public FROM SERVER Test INTO Test;