pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lou Picciano <loupicciano@comcast.net>
To: c k <shreeseva.learning@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Cc: pgsql-general@postgresql.org
Subject: Re: returning results from plsql function to plpythonu function
Date: Sat, 3 Dec 2011 17:55:25 +0000 (UTC)
Message-ID: <94892798.641712.1322934925178.JavaMail.root@sz0093a.westchester.pa.mail.comcast.net> (raw)
In-Reply-To: <CAN2Y=uPoWPZXJrw7djh6PwAqPTtc__-7LZH3O-7nn3Ctic=Psg@mail.gmail.com>

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" <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 

view thread (6+ messages)  latest in thread

Message-ID: <94892798.641712.1322934925178.JavaMail.root@sz0093a.westchester.pa.mail.comcast.net>
Permalink:  ../94892798.641712.1322934925178.JavaMail.root@sz0093a.westchester.pa.mail.comcast.net/
Also on:    postgresql.org/message-id/94892798.641712.1322934925178.JavaMail.root@sz0093a.westchester.pa.mail.comcast.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: loupicciano@comcast.net, shreeseva.learning@gmail.com, pgsql-general@postgresql.org
  Subject: Re: returning results from plsql function to plpythonu function
  In-Reply-To: <94892798.641712.1322934925178.JavaMail.root@sz0093a.westchester.pa.mail.comcast.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox