Re: PQhost() Returns NULL on Connection

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: Postgres-Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: PQhost() Returns NULL on Connection
Date: 2006-04-27 16:25:57
Message-ID: C0764CB5.29156%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

on 4/26/06 5:59 PM, tgl(at)sss(dot)pgh(dot)pa(dot)us purportedly said:

>> Why would PQhost() return NULL on a valid connection?
>
> One reason why would be if you'd selected the server by hostaddr rather
> than host. Returning a host name in this case would require a DNS
> lookup, and since the entire point of the hostaddr feature is to avoid
> DNS lookups, I don't think that's a particularly great idea.
>
> These functions are really defined as "give me back the connection
> options that were specified", anyway, not "peek inside to see what
> values are actually in use". So a NULL for an unspecified option
> seems reasonable to me.

I wasn't sure, because the behavior is not consistent. For instance,
PQport() will return a value regardless of the connection type and
parameters passed to connect.

Also, there doesn't appear to be a way to retrieve hostaddr even if
specified, so I thought maybe the PQhost() was more generic. E.g. the lib
could return an address if specified and not have to do a wasteful DNS
lookup.

Considering that the connection status functions exist to retrieve parameter
values, it would at least be good to have access to all of them, and not
just a selection of them.

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Greg Sabino Mullane 2006-05-08 13:25:38 DBD::Pg 1.49 released
Previous Message Volkan YAZICI 2006-04-27 15:34:33 Re: PQhost() Returns NULL on Connection