dblink does not resolve DNS, but works with IP

From: Mike Christensen <mike(at)kitchenpc(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: dblink does not resolve DNS, but works with IP
Date: 2013-05-15 04:17:02
Message-ID: CABs1bs3QHApudo0pLyJ-8f-7DKGvBPsHpXRyzq-ZU3FTbDWQYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If I have this:

CREATE OR REPLACE VIEW Link.Foo AS
select * from dblink(
'hostaddr=123.123.123.123 dbname=KitchenPC user=Website
password=secret',
'select * from Foo') as ...

Then it works. However, if I do:

CREATE OR REPLACE VIEW Link.Foo AS
select * from dblink(
'hostaddr=db.domain.com dbname=KitchenPC user=Website password=secret',
'select * from Foo') as ...

Then I get:

ERROR: could not establish connection
DETAIL: could not translate host name "db.domain.com" to address: Unknown
host

However, from a command prompt I can ping db.domain.com and get
123.123.123.123.

Does dblink just not support DNS resolution? I really don't want to hard
code IP addresses in my scripts. Thanks!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2013-05-15 04:24:13 Re: How to convert numbers into words in postgresql
Previous Message Jeff Janes 2013-05-15 03:57:00 Re: Running out of memory at vacuum