odd psql behaviour on OSX
i am running postgresql 7.2 for OSX (10.1.4?) that was pre-built by marc
liyange (thank you very much mr. liyange!). whenever i'm working on my local
machine everything works gloriously. but when i attempt to use psql to
attach to a remote host i always receive the error message of "unknown
host".
i will type in a command line of
$psql -h 192.168.1.128 -U myName myDBName
and get back
psql: unknown host:192.168.1.128
that server responds when i ping it. i have tried adding entries into my
hosts file and restarting the system but that didn't help either. i have
tried the -p 4532 option to specify the port but that doesn't work either.
when i use dbvisualizer with the postgresql jdbc driver i can connect with
no problems. when i try psql on a win2k machine using cygin i can connect
with no problems. this leads me to believe that there is an issue with psql
accessing the network on osx.
any ideas and/or suggestions?
rjsjr
You have you add your client's ip in the $PGDATA/pg_hba.conf
That should do it.
i am running postgresql 7.2 for OSX (10.1.4?) that was pre-built by marc
liyange (thank you very much mr. liyange!). whenever i'm working on my
local
machine everything works gloriously. but when i attempt to use psql to
attach to a remote host i always receive the error message of "unknown
host".i will type in a command line of
$psql -h 192.168.1.128 -U myName myDBNameand get back
psql: unknown host:192.168.1.128that server responds when i ping it. i have tried adding entries into my
hosts file and restarting the system but that didn't help either. i have
tried the -p 4532 option to specify the port but that doesn't work either.when i use dbvisualizer with the postgresql jdbc driver i can connect with
no problems. when i try psql on a win2k machine using cygin i can connect
with no problems. this leads me to believe that there is an issue with
psql
Show quoted text
accessing the network on osx.
any ideas and/or suggestions?
rjsjr
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
would that result in the "unknown host" message i'm getting with the OSX
psql or would that result in the "no user myName is listed in the
pg_hba.conf file for IP address xxxx" that i'm getting with the cygwin
version of psql?
rjsjr
Show quoted text
-----Original Message-----
From: PG Explorer [mailto:pgmail@pgexplorer.com]
Sent: Wednesday, April 24, 2002 4:53 PM
To: Robert J. Sanford, Jr.; pgsql-general@postgresql.org
Subject: Re: [GENERAL] odd psql behaviour on OSXYou have you add your client's ip in the $PGDATA/pg_hba.conf
That should do it.
i am running postgresql 7.2 for OSX (10.1.4?) that was pre-built by marc
liyange (thank you very much mr. liyange!). whenever i'm working on mylocal
machine everything works gloriously. but when i attempt to use psql to
attach to a remote host i always receive the error message of "unknown
host".i will type in a command line of
$psql -h 192.168.1.128 -U myName myDBNameand get back
psql: unknown host:192.168.1.128that server responds when i ping it. i have tried adding entries into my
hosts file and restarting the system but that didn't help either. i have
tried the -p 4532 option to specify the port but that doesn'twork either.
when i use dbvisualizer with the postgresql jdbc driver i can
connect with
no problems. when i try psql on a win2k machine using cygin i
can connect
with no problems. this leads me to believe that there is an issue with
psql
accessing the network on osx.
any ideas and/or suggestions?
rjsjr
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
"Robert J. Sanford, Jr." <rsanford@nolimitsystems.com> writes:
i am running postgresql 7.2 for OSX (10.1.4?) that was pre-built by marc
liyange (thank you very much mr. liyange!). whenever i'm working on my local
machine everything works gloriously. but when i attempt to use psql to
attach to a remote host i always receive the error message of "unknown
host".
i will type in a command line of
$psql -h 192.168.1.128 -U myName myDBName
and get back
psql: unknown host:192.168.1.128
Odd. It works fine for me with either host names or host numbers
(I'm using OS X 10.1 on a G3 laptop). Normally I'd be inclined to blame
misconfiguration of your DNS setup, but if you can contact the remote
host with other programs then that answer may not hold water.
Is the message spelled exactly that way? The closest thing I can find
in the source code is "unknown host name: %s", which is reported after
a gethostbyname() failure. If you've transcribed the message accurately
then it must be coming from some OSX-specific subroutine. But if it is
reporting gethostbyname() failure then I'd bet something is wrong with
your lookupd configuration (see "man lookupd").
regards, tom lane
Robert J. Sanford, Jr. sez:
} i am running postgresql 7.2 for OSX (10.1.4?) that was pre-built by marc
} liyange (thank you very much mr. liyange!). whenever i'm working on my local
} machine everything works gloriously. but when i attempt to use psql to
} attach to a remote host i always receive the error message of "unknown
} host".
}
} i will type in a command line of
} $psql -h 192.168.1.128 -U myName myDBName
}
} and get back
} psql: unknown host:192.168.1.128
}
} that server responds when i ping it. i have tried adding entries into my
} hosts file and restarting the system but that didn't help either. i have
} tried the -p 4532 option to specify the port but that doesn't work either.
Incidentally, MacOS X normally ignores the /etc/hosts file. If you want to
set up that sort of thing, you need to do it in NetInfo Manager.app (or
with niutil) to add an entry to /machines.
} when i use dbvisualizer with the postgresql jdbc driver i can connect with
} no problems. when i try psql on a win2k machine using cygin i can connect
} with no problems. this leads me to believe that there is an issue with psql
} accessing the network on osx.
}
} any ideas and/or suggestions?
I am using the same package and version without any such difficulties. I
suspect that it is a DNS issue. See if it has the same problem if you add a
period to the end of the host. This will make the DNS lookup behave a bit
differently (I forget exactly what it shortcuts... maybe just expanding
with search domains, maybe all lookups altogether on a numeric address).
Thus:
psql -h 192.168.1.128. -U myName myDBName
} rjsjr
--Greg
okay, i'm doing a little more testing and i have some oddities. i'm hoping
to get some additional help with the additional info i'm providing here.
i'm testing in two different networks - at home and at work. each of the
networks has postgres server on it. both of the servers have a public and
private ip address for each of the networks. the private ip address for both
is a 192.168.69.xxx and the public ip address is, well, a public ip address.
the network at home is a cable modem network with a linksys router/firewall
that is assigning dynamic ip addresses. the router passes requests coming
from outside through the port that i have selected to the machine running
postgres. when i attempt to use psql to access the private ip address i get
the unknown host error listed below. when i attempt to use psql to access
the public ip address it responds and lets me in!
the network at work is running a bunch of cisco routers and switches and all
that good sort of stuff that i have no control over. when i attempt to
access the private ip address from my osx machine it fails to connect with
the unknown host error. when i try to connect to the public ip address it
also fails with the same error. when i try to connect to either the public
or private ip addresses from a windows machine running cygwin (i've tried
from both at work and at home) it works just fine.
i have loaded up the netinfo manager application listed below but i have no
idea as to what to do with it. i'm not a unix guy by any stretch of the
imagination. not afraid of it, just don't any experience with it but willing
to learn.
from my network at work i have explicitly set the DNS servers but still no
joy.
i can still ping the server and get a response but psql is not seeing it.
aaaaaauuuuuuugggggghhhhhhhh!
so why can i see the one public ip address but not the other or the two
private ip addresses?
many thanks!
rjsjr
Show quoted text
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Gregory Seidman
Sent: Wednesday, April 24, 2002 10:48 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] odd psql behaviour on OSXRobert J. Sanford, Jr. sez:
} i am running postgresql 7.2 for OSX (10.1.4?) that was pre-built by marc
} liyange (thank you very much mr. liyange!). whenever i'm
working on my local
} machine everything works gloriously. but when i attempt to use psql to
} attach to a remote host i always receive the error message of "unknown
} host".
}
} i will type in a command line of
} $psql -h 192.168.1.128 -U myName myDBName
}
} and get back
} psql: unknown host:192.168.1.128
}
} that server responds when i ping it. i have tried adding entries into my
} hosts file and restarting the system but that didn't help either. i have
} tried the -p 4532 option to specify the port but that doesn't
work either.Incidentally, MacOS X normally ignores the /etc/hosts file. If you want to
set up that sort of thing, you need to do it in NetInfo Manager.app (or
with niutil) to add an entry to /machines.} when i use dbvisualizer with the postgresql jdbc driver i can
connect with
} no problems. when i try psql on a win2k machine using cygin i
can connect
} with no problems. this leads me to believe that there is an
issue with psql
} accessing the network on osx.
}
} any ideas and/or suggestions?I am using the same package and version without any such difficulties. I
suspect that it is a DNS issue. See if it has the same problem if
you add a
period to the end of the host. This will make the DNS lookup behave a bit
differently (I forget exactly what it shortcuts... maybe just expanding
with search domains, maybe all lookups altogether on a numeric address).
Thus:psql -h 192.168.1.128. -U myName myDBName
} rjsjr
--Greg---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
i don't know if i have said this before but i can use dbvisualizer with the
postgres jdbc library to connect to either of the machines successfully both
internally and externally.
i was talking to both my boss and my network admin and they were wondering
if there is something to do with configuring access to non-routable IP's
under OSX...
what do i need to do with netinfo manager, just try and add in a machine?
rjsjr
Show quoted text
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Robert J.
Sanford, Jr.
Sent: Thursday, April 25, 2002 3:21 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] odd psql behaviour on OSXokay, i'm doing a little more testing and i have some oddities. i'm hoping
to get some additional help with the additional info i'm providing here.i'm testing in two different networks - at home and at work. each of the
networks has postgres server on it. both of the servers have a public and
private ip address for each of the networks. the private ip
address for both
is a 192.168.69.xxx and the public ip address is, well, a public
ip address.the network at home is a cable modem network with a linksys
router/firewall
that is assigning dynamic ip addresses. the router passes requests coming
from outside through the port that i have selected to the machine running
postgres. when i attempt to use psql to access the private ip
address i get
the unknown host error listed below. when i attempt to use psql to access
the public ip address it responds and lets me in!the network at work is running a bunch of cisco routers and
switches and all
that good sort of stuff that i have no control over. when i attempt to
access the private ip address from my osx machine it fails to connect with
the unknown host error. when i try to connect to the public ip address it
also fails with the same error. when i try to connect to either the public
or private ip addresses from a windows machine running cygwin (i've tried
from both at work and at home) it works just fine.i have loaded up the netinfo manager application listed below but
i have no
idea as to what to do with it. i'm not a unix guy by any stretch of the
imagination. not afraid of it, just don't any experience with it
but willing
to learn.from my network at work i have explicitly set the DNS servers but still no
joy.i can still ping the server and get a response but psql is not seeing it.
aaaaaauuuuuuugggggghhhhhhhh!
so why can i see the one public ip address but not the other or the two
private ip addresses?many thanks!
rjsjr
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Gregory Seidman
Sent: Wednesday, April 24, 2002 10:48 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] odd psql behaviour on OSXRobert J. Sanford, Jr. sez:
} i am running postgresql 7.2 for OSX (10.1.4?) that waspre-built by marc
} liyange (thank you very much mr. liyange!). whenever i'm
working on my local
} machine everything works gloriously. but when i attempt to use psql to
} attach to a remote host i always receive the error message of "unknown
} host".
}
} i will type in a command line of
} $psql -h 192.168.1.128 -U myName myDBName
}
} and get back
} psql: unknown host:192.168.1.128
}
} that server responds when i ping it. i have tried addingentries into my
} hosts file and restarting the system but that didn't help
either. i have
} tried the -p 4532 option to specify the port but that doesn't
work either.Incidentally, MacOS X normally ignores the /etc/hosts file. If
you want to
set up that sort of thing, you need to do it in NetInfo Manager.app (or
with niutil) to add an entry to /machines.} when i use dbvisualizer with the postgresql jdbc driver i can
connect with
} no problems. when i try psql on a win2k machine using cygin i
can connect
} with no problems. this leads me to believe that there is an
issue with psql
} accessing the network on osx.
}
} any ideas and/or suggestions?I am using the same package and version without any such difficulties. I
suspect that it is a DNS issue. See if it has the same problem if
you add a
period to the end of the host. This will make the DNS lookupbehave a bit
differently (I forget exactly what it shortcuts... maybe just expanding
with search domains, maybe all lookups altogether on a numeric address).
Thus:psql -h 192.168.1.128. -U myName myDBName
} rjsjr
--Greg---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
okay, i added in the machine to netinfo manager and now it works. i can
use psql to hit the internal address at work using either the ip address
or the name that i labelled it as in netinfo manager. i can also hit the
public ip at home from here at work.
when i get home i will see if i can hit the home server's private ip as
well as the work server public ip.
i have to say that i don't understand why psql could not see the servers
without this. actually, i'm guessing from previous emails that it isn't
psql but one of the system libs that psql uses that needs some addresses
to be explicity mapped. i just don't understand.
rjsjr
Show quoted text
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Robert J.
Sanford, Jr.
Sent: Thursday, April 25, 2002 3:41 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] odd psql behaviour on OSXi don't know if i have said this before but i can use
dbvisualizer with the
postgres jdbc library to connect to either of the machines
successfully both
internally and externally.i was talking to both my boss and my network admin and they were wondering
if there is something to do with configuring access to non-routable IP's
under OSX...what do i need to do with netinfo manager, just try and add in a machine?
rjsjr
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Robert J.
Sanford, Jr.
Sent: Thursday, April 25, 2002 3:21 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] odd psql behaviour on OSXokay, i'm doing a little more testing and i have some oddities.
i'm hoping
to get some additional help with the additional info i'm providing here.
i'm testing in two different networks - at home and at work. each of the
networks has postgres server on it. both of the servers have apublic and
private ip address for each of the networks. the private ip
address for both
is a 192.168.69.xxx and the public ip address is, well, a public
ip address.the network at home is a cable modem network with a linksys
router/firewall
that is assigning dynamic ip addresses. the router passesrequests coming
from outside through the port that i have selected to the
machine running
postgres. when i attempt to use psql to access the private ip
address i get
the unknown host error listed below. when i attempt to use psqlto access
the public ip address it responds and lets me in!
the network at work is running a bunch of cisco routers and
switches and all
that good sort of stuff that i have no control over. when i attempt to
access the private ip address from my osx machine it fails toconnect with
the unknown host error. when i try to connect to the public ip
address it
also fails with the same error. when i try to connect to either
the public
or private ip addresses from a windows machine running cygwin
(i've tried
from both at work and at home) it works just fine.
i have loaded up the netinfo manager application listed below but
i have no
idea as to what to do with it. i'm not a unix guy by any stretch of the
imagination. not afraid of it, just don't any experience with it
but willing
to learn.from my network at work i have explicitly set the DNS servers
but still no
joy.
i can still ping the server and get a response but psql is not
seeing it.
aaaaaauuuuuuugggggghhhhhhhh!
so why can i see the one public ip address but not the other or the two
private ip addresses?many thanks!
rjsjr
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf OfGregory Seidman
Sent: Wednesday, April 24, 2002 10:48 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] odd psql behaviour on OSXRobert J. Sanford, Jr. sez:
} i am running postgresql 7.2 for OSX (10.1.4?) that waspre-built by marc
} liyange (thank you very much mr. liyange!). whenever i'm
working on my local
} machine everything works gloriously. but when i attempt touse psql to
} attach to a remote host i always receive the error message
of "unknown
} host".
}
} i will type in a command line of
} $psql -h 192.168.1.128 -U myName myDBName
}
} and get back
} psql: unknown host:192.168.1.128
}
} that server responds when i ping it. i have tried addingentries into my
} hosts file and restarting the system but that didn't help
either. i have
} tried the -p 4532 option to specify the port but that doesn't
work either.Incidentally, MacOS X normally ignores the /etc/hosts file. If
you want to
set up that sort of thing, you need to do it in NetInfo
Manager.app (or
with niutil) to add an entry to /machines.
} when i use dbvisualizer with the postgresql jdbc driver i can
connect with
} no problems. when i try psql on a win2k machine using cygin i
can connect
} with no problems. this leads me to believe that there is an
issue with psql
} accessing the network on osx.
}
} any ideas and/or suggestions?I am using the same package and version without any such
difficulties. I
suspect that it is a DNS issue. See if it has the same problem if
you add a
period to the end of the host. This will make the DNS lookupbehave a bit
differently (I forget exactly what it shortcuts... maybe just
expanding
with search domains, maybe all lookups altogether on a
numeric address).
Thus:
psql -h 192.168.1.128. -U myName myDBName
} rjsjr
--Greg---------------------------(end of
broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
"Robert J. Sanford, Jr." <rsanford@nolimitsystems.com> writes:
i have to say that i don't understand why psql could not see the servers
without this. actually, i'm guessing from previous emails that it isn't
psql but one of the system libs that psql uses that needs some addresses
to be explicity mapped. i just don't understand.
Me either. You'd likely have more luck asking about it in an OS X
hackers' forum than here, though. Just tell 'em the program is trying
to look up so-and-so with gethostbyname(), and getting a failure return.
regards, tom lane
"Robert J. Sanford, Jr." <rsanford@nolimitsystems.com> writes:
okay, i added in the machine to netinfo manager and now it works.
BTW --- although I don't recall mucking with "netinfo manager" (don't
even know what that is), I do have a DNS server configured in
System Preferences/Network. Wonder if that makes a difference?
regards, tom lane
On Thu, Apr 25, 2002 at 05:50:00PM -0400, Tom Lane wrote:
"Robert J. Sanford, Jr." <rsanford@nolimitsystems.com> writes:
i have to say that i don't understand why psql could not see the servers
without this. actually, i'm guessing from previous emails that it isn't
psql but one of the system libs that psql uses that needs some addresses
to be explicity mapped. i just don't understand.Me either. You'd likely have more luck asking about it in an OS X
hackers' forum than here, though. Just tell 'em the program is trying
to look up so-and-so with gethostbyname(), and getting a failure return.
Uhm, I've not looked at this bit of psql source code and I've never
worked with OS X, so I may be completely off-base here, but noones
mentioned this possibility yet.
gethostbyname(3) is specced to take a hostname and return hostent.
If you pass it the string "192.168.1.1" it is specced to look up the
*hostname* 192.168.1.1 and return the addresses associated with that
hostname.
This is hidden by the fact that some system resolver libraries
recognise a query for a dotted-quad address and fake up a response,
and still more so by some recursive resolvers that'll do the same
thing.
The robust way to parse a hostname/address passed in by a user is to
attempt an inet_aton or inet_pton on it, and only if that fails attempt
a gethostbyname(3).
Is it possible that this is causing the symptoms here?
Cheers,
Steve
On 4/25/02 at 6:22 PM, tgl@sss.pgh.pa.us (Tom Lane) wrote:
i did try that and it didn't help any...
Show quoted text
"Robert J. Sanford, Jr." <rsanford@nolimitsystems.com> writes:
okay, i added in the machine to netinfo manager and now it
works.BTW --- although I don't recall mucking with "netinfo manager"
(don't even know what that is), I do have a DNS server configured
in System Preferences/Network. Wonder if that makes a
difference?regards, tom lane
Steve Atkins <steve@blighty.com> writes:
gethostbyname(3) is specced to take a hostname and return hostent.
If you pass it the string "192.168.1.1" it is specced to look up the
*hostname* 192.168.1.1 and return the addresses associated with that
hostname.
This is hidden by the fact that some system resolver libraries
recognise a query for a dotted-quad address and fake up a response,
and still more so by some recursive resolvers that'll do the same
thing.
In practice, it works on every platform I've ever heard of (as shown
by the fact that we've not gotten any complaints about psql being
unable to resolve numeric addresses --- at least not till this one).
More to the point, it *does* work on OS X too. I just tested it
yesterday. Why is it not working for Robert? Darn if I know.
regards, tom lane
please also remember that it was not all of the dotted quads that
were failing. testing against two public ip addresses and two non-
routable addresses one of the two public ip addresses was working.
that leads me to believe that it isn't a dotted quad issue but a
configuration issue.
some time later today i'm going to follow tom lane's advice and
start posting to an osx hacker list or two or four to see if they
know what's going on. i'm thinking some sort of configuration
issue since adding the machines to the netinfo manager made them
work all of the sudden.
rjsjr
Show quoted text
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Steve Atkins
Sent: Thursday, April 25, 2002 6:04 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] odd psql behaviour on OSXOn Thu, Apr 25, 2002 at 05:50:00PM -0400, Tom Lane wrote:
"Robert J. Sanford, Jr." <rsanford@nolimitsystems.com> writes:
i have to say that i don't understand why psql could not see
the servers
without this. actually, i'm guessing from previous emails
that it isn't
psql but one of the system libs that psql uses that needs
some addresses
to be explicity mapped. i just don't understand.
Me either. You'd likely have more luck asking about it in an OS X
hackers' forum than here, though. Just tell 'em the program is trying
to look up so-and-so with gethostbyname(), and getting a failure return.Uhm, I've not looked at this bit of psql source code and I've never
worked with OS X, so I may be completely off-base here, but noones
mentioned this possibility yet.gethostbyname(3) is specced to take a hostname and return hostent.
If you pass it the string "192.168.1.1" it is specced to look up the
*hostname* 192.168.1.1 and return the addresses associated with that
hostname.This is hidden by the fact that some system resolver libraries
recognise a query for a dotted-quad address and fake up a response,
and still more so by some recursive resolvers that'll do the same
thing.The robust way to parse a hostname/address passed in by a user is to
attempt an inet_aton or inet_pton on it, and only if that fails attempt
a gethostbyname(3).Is it possible that this is causing the symptoms here?
Cheers,
Steve---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)