Re: Problem with pl/python procedure connecting to the internet - Mailing list pgsql-general

From Tom Lane
Subject Re: Problem with pl/python procedure connecting to the internet
Date
Msg-id 15257.1440352194@sss.pgh.pa.us
Whole thread Raw
In response to Re: Problem with pl/python procedure connecting to the internet  (Igor Sosa Mayor <joseleopoldo1792@gmail.com>)
Responses Re: Problem with pl/python procedure connecting to the internet
Re: Problem with pl/python procedure connecting to the internet
List pgsql-general
Igor Sosa Mayor <joseleopoldo1792@gmail.com> writes:
> Adrian Klaver <adrian.klaver@aklaver.com> writes:
>> Or more to the point how where they built?

> just installed with postgresql which comes with archlinux. I did not
> built anything. But, really: I dont think the problem is plpython2u o 3:
> 1. I have in my system both and both have the same libraries (in this
>    case, geopy);
> 2. other procedures with plpython (2 or 3) which DO NOT CONNECT to the
>    internet work perfectly.

Well, that hardly proves that Python code that *does* connect to the net
would work.  The possibility that you're using a different Python version
inside Postgres and it's broken for network access is one you should take
very seriously.

However, what this smells like to me is a permissions problem.  I think
you were way too quick to dismiss the idea that SELinux (or something
just like it) is restricting outbound internet connections from Postgres.
It's standard for SELinux to be configured so that network-accessible
daemons like Postgres are locked down harder than the very same code
would be treated when being invoked from the command line --- and network
access would be one of the prime candidates to be disabled by default.

Have you poked around under /var/log/ to see if the kernel logs anything
when the connection attempt doesn't work?  For that matter, have you
checked the postmaster log to see what Postgres logs about it?

            regards, tom lane


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Problem with pl/python procedure connecting to the internet
Next
From: John R Pierce
Date:
Subject: Re: Problem with pl/python procedure connecting to the internet