Re: dblink does not resolve DNS, but works with IP

From: Mike Christensen <mike(at)kitchenpc(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: dblink does not resolve DNS, but works with IP
Date: 2013-05-15 05:14:43
Message-ID: CABs1bs0nZ06Z3Pt4dPxKLwAnqi0CumkgrTon7KMUzprgf0F4Vg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Though I'm a bit curious why there's a host and hostaddr. Why can't it
just resolve whatever you give it?

On Tue, May 14, 2013 at 9:31 PM, Mike Christensen <mike(at)kitchenpc(dot)com>wrote:

> Excellent! Thanks so much.
>
>
> On Tue, May 14, 2013 at 9:25 PM, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>wrote:
>
>> On 05/14/2013 09:17 PM, Mike Christensen wrote:
>>
>>> 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 <http://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
>>> <http://db.domain.com>" to address: Unknown host
>>>
>>>
>>> However, from a command prompt I can ping db.domain.com
>>> <http://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!
>>>
>>
>> See below for explanation of hostaddr and host. Short version, you are
>> looking for host:
>>
>> http://www.postgresql.org/**docs/9.2/interactive/libpq-**
>> connect.html#LIBPQ-**PARAMKEYWORDS<http://www.postgresql.org/docs/9.2/interactive/libpq-connect.html#LIBPQ-PARAMKEYWORDS>
>>
>>
>> --
>> Adrian Klaver
>> adrian(dot)klaver(at)gmail(dot)com
>>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vegard Bønes 2013-05-15 06:15:57 Re: Large amount of serialization errors in transactions
Previous Message Mike Christensen 2013-05-15 04:31:15 Re: dblink does not resolve DNS, but works with IP