Ever had that sinking feeling when you’re setting up logical replication and CREATE SUBSCRIPTION...
just kinda sat there? Maybe it eventually timed out?
I used to use foreign data wrappers to troubleshoot database-to-database connectivity problems, but using DBLINK is much easier. (Bonus: can be used to troubleshoot connectivity problems with foreign data wrappers, also!) Hat tip to Xof for sharing it.
-- Create the DBLINK extension in both databases
CREATE EXTENSION dblink;
-- From either side:
SELECT * FROM dblink (
'',
'SELECT 1'
) AS test(i int);
Example successful output:
gabrielle=# SELECT * FROM dblink (
'port=5433 dbname=gabrielle',
'SELECT 1'
) AS test(i int);
i
---
1
(1 row)