Skip site navigation (1) Skip section navigation (2)

Re: PQhost() Returns NULL on Connection

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Keary Suska <hierophant(at)pcisys(dot)net>
Cc: Postgres-Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: PQhost() Returns NULL on Connection
Date: 2006-04-26 23:59:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Keary Suska <hierophant(at)pcisys(dot)net> writes:
> 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.

			regards, tom lane

In response to


pgsql-interfaces by date

Next:From: Volkan YAZICIDate: 2006-04-27 15:34:33
Subject: Re: PQhost() Returns NULL on Connection
Previous:From: Keary SuskaDate: 2006-04-26 20:08:40
Subject: PQhost() Returns NULL on Connection

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group