EXTENSION dblink and postgres fdw:
*Foreign Data Wrapper
To access complete schema of server db instead of single table. Follow below steps:
CREATE EXTENSION postgres_fdw;
```
CREATE SERVER server_name FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'host_ip',
dbname 'db_name', port 'port_number');
```
```
CREATE USER MAPPING FOR CURRENT_USER
SERVER server_name
OPTIONS (user 'user_name', password 'password');
```
CREATE SCHEMA schema_name;
```
IMPORT FOREIGN SCHEMA schema_name_to_import_from_remote_db
FROM SERVER server_name
INTO schema_name;
```
SELECT * FROM schema_name.table_name;
This can be used to access multiple schema of remote DB.