Search Postgresql Archives

Re: Return SETOF or array from pl/python

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

 





I am not an everyday python programmer but I am pretty sure that you are
trying to return a list in arf(). You can't return a list you have to
return the array type which is why arf2 works.


Ok.  How does one convert a python list to a PGSql array then?  Is there
a better way to do it than what I did in arf2?

I don't think you can with plPython at least not without reformatting the list within the function itself.



The reasons srf works is because you are just returning text in general
regardless that it is formatting to a list.


How does one return a set then?  I want as my output:

You would actually have to have a set. What I believe you are trying to
do is transform a list to a result set. I don't think you can do that without some additional programming within the function.

Somebody may know of a better way but what I would think would happen is this:

Break up list, insert each value of list into a temp table as a row, return set of temp table.

Sincerely,

Joshua D. Drake



SELECT * FROM srf();

             srf
 -------------------------
  'one'
  'two'
  'three'
 (3 rows)



--
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[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