could not connect to server "postgres_someDB" RRS feed

  • Question

  • Working on Azure PostGresSQL, trying to import a table present in another database of postgres from a diferrent database.

    bBoth the databases are on same server.

    create EXTENSION postgres_fdw;

    CREATE SERVER postgresPtDB FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host '', dbname 'Product', port '5432');
    CREATE USER MAPPING FOR xxxx SERVER postgres_PtDB OPTIONS (user 'xxxx'password 'dxxxx');
    IMPORT FOREIGN SCHEMA rw limit to (abc) FROM SERVER postgres_PtDB INTO rw;
    CREATE foreign TABLE "abcde"







    SERVER postgres_PtDB;

    Till this point all the statements worked perfect and even created table since i can see it if I expand the database.

    But, when I do this I see the error could not connect to server "postgres_ptdb"

    select*from "abcde"

    Any leads is appreciated. Thanks :)


    Thursday, December 5, 2019 11:57 PM

All replies

  • Hi Aravind,

    I see that the postgres_ptdb extension v. 1.0 is supported: PostgreSQL extensions in Azure Database for PostgreSQL - Single Server

    But what I would like to verify is if you have the network access from Azure services enabled: Connecting from Azure

    There should be the ability to enable Azure services to connect to your PostgreSQL instance. Please verify that this is enabled.


    Friday, December 6, 2019 3:38 AM
  • Hello Mike, 

    Yes, The access has been enabled already and still I had encountered the above problem.

    The server I am connecting to is something like this ""



    Friday, December 6, 2019 2:41 PM
  • Could you try something for me. Please do the following:

    1. Perform an nslookup (from a cmd prompt)
    2. Take the resulting IP Address and add that to the Allow List

    If the above does not resolve this issue, I can have this issue investigated further by enabling a one-time incident ticket if you currently do not have an Azure Support Plan.



    Monday, December 9, 2019 7:11 PM
  • Please let me know if you need further assistance for this issue.



    Friday, December 13, 2019 5:51 PM
  • Just checking in to see if the above answer(s) helped.


    If this answers your query, do click “Mark as Answer” and Up-Vote for the same which might be beneficial to other community members reading this thread .

    And, if you have any further query do let us know. 

    Friday, December 20, 2019 2:38 AM