Hi all, I am having problems with getaddrinfo in plpython. Pl/Python is the same as my system python (2.6), this is MacOS X. Here's what happens in the python prompt: >>> from _socket import * >>> import _socket >>> import sys >>> print _socket.__file__ /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/_socket.so >>> print sys.version 2.6.1 (r261:67515, Feb 11 2010, 15:47:53) [GCC 4.2.1 (Apple Inc. build 5646)] >>> ga = getaddrinfo('localhost',8088,0,SOCK_STREAM) >>> print ga [(30, 1, 6, '', ('::1', 8088, 0, 0)), (30, 1, 6, '', ('fe80::1%lo0', 8088, 0, 1)), (2, 1, 6, '', ('127.0.0.1', 8088))] In other words, everything is OK. (I am printing the version and the file just so it can be compared to the output from plpython). Now, let's do it in pl/python: SET client_min_messages='LOG'; CREATE OR REPLACE FUNCTION trycon(host VARCHAR) RETURNS text AS $$ from _socket import * import _socket import sys plpy.log(_socket.__file__) plpy.log(sys.version) ga = getaddrinfo(host,8088,0,SOCK_STREAM) plpy.log(str(ga)) return str(ga) $$ LANGUAGE plpythonu; SELECT trycon('localhost'); outputs: LOG: ('/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/_socket.so',) LOG: ('2.6.1 (r261:67515, Feb 11 2010, 15:47:53) \n[GCC 4.2.1 (Apple Inc. build 5646)]',) ERROR: PL/Python: PL/Python function "trycon" failed DETAIL: <class 'socket.gaierror'>: [Errno 8] nodename nor servname provided, or not known What am I missing? Thanks for the help in advance. -gg -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general