How to connect two PostgreSQL databases in two different locations There is a project running on PostgreSQL with postgres_fdw. Due to legal reason some user data should be stored only in the remote db on the remote server in the closed country. Now the table that is connected to the remote server becomes unavailable when we lose connection to the remote database and storage.
The main database must be available even if the remote database crashed. It should not crash the main database. 
How to connect two different databases from different locations to ensure data integrity (now it implemented on postgres_fdw)?

And the main requirement of our customer, the data should storage at a remote database only.

A materialized view not suitable, because it stores physically data at main server side.

Any ideas?
I would create a materialized view on the foreign tables.

You can refresh the materialized view while the remote database is available and use it in between.