5

I am trying to use the PostgreSQL foreign data wrapper (postgres_fdw) extension from an Azure DB for PostgreSQL instance. The foreign data wrapper should be supported as mentioned in Azure DB for PostgreSQL: https://learn.microsoft.com/en-us/azure/postgresql/concepts-extensions

I manage to create a server and a mapping for the user, but when I try to import a table or a schema I have the following error:

ERROR:  could not connect to server "<server with public hostname on AWS>"
DETAIL:  could not translate host name "<server with public hostname on AWS>" to address: Unknown host

When replacing the hostname with a public IP I get the following:

ERROR:  could not connect to server "<SERVER NAME>"
DETAIL:  could not connect to server: Network is down (0x00002742/10050)
    Is the server running on host "<public IP of the server" and accepting
    TCP/IP connections on port 5432?

In the firewall options of the Azure DB for PostgreSQL instance, I already have the AllowAllIps rule starting 0.0.0.0 and ending 255.255.255.255. is there any thing else to configure to get access to servers outside of Azure, DNS or firewall configuration?

Namux
  • 305
  • 5
  • 17

1 Answers1

3

Not entirely sure about this, but we were trying to do something like this the other day, and stumbled upon this (somewhat disheartening) quote:

"Currently, outbound connections from Azure Database for PostgreSQL are not supported, except for connections to other Azure Database for PostgreSQL servers."

Source: https://learn.microsoft.com/en-us/azure/postgresql/concepts-extensions#dblink-and-postgres_fdw

Frederik Struck-Schøning
  • 12,981
  • 8
  • 59
  • 68
  • Hey @Frederik Struck-Schøning, do u know if there's a workaround to this? – Bruno Warmling Feb 12 '21 at 18:13
  • Hi @BrunoWarmling, the documentation unfortunately is very clear about the fact, that the fdw-extension will only work between postgres-servers within Azure and within the same region (for the time being at least). Depending on what exactly you are trying to do, the "workaround" or solution would probably be some sort of synchronization of data between servers, either through a logical layer of some sort or in some scenarious it might be possible to use pg-replication. But these are very likely non-trivial ways and at least out of scope of this answer :) – Frederik Struck-Schøning Feb 13 '21 at 23:32