Re: Return SETOF or array from pl/python
От | Joshua D. Drake |
---|---|
Тема | Re: Return SETOF or array from pl/python |
Дата | |
Msg-id | 42D7EB7C.90301@commandprompt.com обсуждение исходный текст |
Ответ на | Re: Return SETOF or array from pl/python (Peter Fein <pfein@pobox.com>) |
Ответы |
Re: Return SETOF or array from pl/python
Re: Return SETOF or array from pl/python |
Список | pgsql-general |
>> >>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/
В списке pgsql-general по дате отправления: