Search Postgresql Archives

plpython2u not getting any output -> on independent script I get the desired output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@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@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.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux