Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 5B3B9682EAD for ; Sat, 3 Dec 2011 13:55:44 -0400 (AST) Received: from qmta12.westchester.pa.mail.comcast.net ([76.96.59.227]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RWtoK-0001tZ-Ji for pgsql-admin@postgresql.org; Sat, 03 Dec 2011 17:55:43 +0000 Received: from omta23.westchester.pa.mail.comcast.net ([76.96.62.74]) by qmta12.westchester.pa.mail.comcast.net with comcast id 4gEl1i0041c6gX85ChvUwM; Sat, 03 Dec 2011 17:55:28 +0000 Received: from sz0093.wc.mail.comcast.net ([76.96.58.151]) by omta23.westchester.pa.mail.comcast.net with comcast id 4hvT1i01i3FmDic3jhvTe3; Sat, 03 Dec 2011 17:55:27 +0000 Date: Sat, 3 Dec 2011 17:55:25 +0000 (UTC) From: Lou Picciano To: c k Cc: pgsql-admin , pgsql-general@postgresql.org Message-ID: <94892798.641712.1322934925178.JavaMail.root@sz0093a.westchester.pa.mail.comcast.net> In-Reply-To: Subject: Re: returning results from plsql function to plpythonu function MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_641711_69766492.1322934925149" X-Originating-IP: [76.117.178.80] X-Mailer: Zimbra 6.0.13_GA_2934 (ZimbraWebClient - FF3.0 (Mac)/6.0.13_GA_2934) X-Pg-Spam-Score: -3.1 (---) X-Archive-Number: 201112/20 X-Sequence-Number: 38778 ------=_Part_641711_69766492.1322934925149 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit CP - You're missing a line in the middle; one which will extract specific content(s) from $results. Because, yes, without such a line, python will only return the object reference. Lou Picciano ----- Original Message ----- From: "c k" To: "pgsql-admin" , pgsql-general@postgresql.org Sent: Saturday, December 3, 2011 12:50:16 PM Subject: [ADMIN] returning results from plsql function to plpythonu function Hello friends, I am checking some logic which includes two functions. One is plsql function which returns text. Second function is plpythonu and contains one statement which outputs notice e.g. results = plpy.execute("select * from software.func1();") plpy.notice("%s" % col for col in results[0]) The same result is returned as a final return as notice. But it does not outputs the correct result which is returned from func1 (text in this case). Rather it outputs notice as NOTICE: at 0xb578cb6c> It doesn't prints the correct notice even by using plpy.notice("%s" %results) What can be the problem here? Thanks for help. C P Kulkarni ------=_Part_641711_69766492.1322934925149 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit
CP - You're missing a line in the middle; one which will extract specific content(s) from $results.

Because, yes, without such a line, python will only return the object reference.

Lou Picciano


From: "c k" <shreeseva.learning@gmail.com>
To: "pgsql-admin" <pgsql-admin@postgresql.org>, pgsql-general@postgresql.org
Sent: Saturday, December 3, 2011 12:50:16 PM
Subject: [ADMIN] returning results from plsql function to plpythonu function

Hello friends,
I am checking some logic which includes two functions. One is plsql function which returns text. Second function is plpythonu and contains one statement which outputs notice

e.g.
results = plpy.execute("select * from software.func1();")
plpy.notice("%s" % col for col in results[0])

The same result is returned as a final return as notice. But it does not outputs the correct result which is returned from func1 (text in this case). Rather it outputs notice as
NOTICE:  <generator object <genexpr> at 0xb578cb6c>
It doesn't prints the correct notice even by using
plpy.notice("%s" %results)

What can be the problem here?
Thanks for help.


C P Kulkarni
------=_Part_641711_69766492.1322934925149--