From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | ichBinRene <ichbinrene(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: plpython2u not getting any output -> on independent script I get the desired output |
Date: | 2012-09-25 15:02:31 |
Message-ID: | 5061C787.2000003@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 09/24/2012 08:27 PM, ichBinRene wrote:
> Hello everybody and thanks for your attention.
>
> I have this function:
> ###########################################################################################
> CREATE OR REPLACE FUNCTION check_current_xlog() RETURNS text
> AS
> $$
> import subprocess
> p = subprocess.Popen("ssh repuser(at)localhost -p 2000 \"psql -A -t -c
> 'select pg_current_xlog_location();' template1\"
> ",shell=True,stdout=subprocess.PIPE)
> out,err = p.communicate()
> return str(out)
> $$
> LANGUAGE plpython2u VOLATILE;
> ###########################################################################################
>
> *Problem:* *I'm not getting any output*
> select check_current_xlog();
> check_current_xlog
> --------------------
>
> (1 row)
>
> I checked with plpy.notice(out) and out is empty
>
> If I execute those instructions in a script like this one
> ##################################################################################################################################
> #!/usr/bin/env python
> import subprocess
> p = subprocess.Popen("ssh repuser(at)localhost -p 2000 \"psql -A -t -c
> 'select pg_current_xlog_location();' template1\"
> ",shell=True,stdout=subprocess.PIPE)
> out,err = p.communicate()
> print out
> ##################################################################################################################################
>
> I get the desired output:
> --------------------
> F/6CB78FC
> -------------------
>
> Any ideas will be highly appreciated. Greetings from Mexico.
I do not see anything obvious off hand, just some questions/observations:
1) Could there be permissions/environment issues. The user you are
running as in the OS shell is different from that in Postgres?
2) Do the SSH logs show anything that might be helpful?
3) It would be helpful though to know what version of Postgres you are
using. plpythonu has under gone a lot of changes over the last several
releases.
>
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Blackwell | 2012-09-25 15:05:15 | unique constraint with significant nulls? |
Previous Message | craig | 2012-09-25 14:50:09 | Re: Custom prompt |