Re: ARRAY vars (was Enable pl/python to return records based on multiple OUT params)
От | Hannu Krosing |
---|---|
Тема | Re: ARRAY vars (was Enable pl/python to return records based on multiple OUT params) |
Дата | |
Msg-id | 1225833459.7883.10.camel@huvostro обсуждение исходный текст |
Ответ на | Re: Enable pl/python to return records based on multiple OUT params ("David Blewett" <david@dawninglight.net>) |
Ответы |
Re: ARRAY vars (was Enable pl/python to return records based on multiple OUT params)
|
Список | pgsql-hackers |
On Tue, 2008-11-04 at 14:05 -0500, David Blewett wrote: > On Sat, Nov 1, 2008 at 7:52 AM, Hannu Krosing <hannu@2ndquadrant.com> wrote: > > On Sat, 2008-11-01 at 06:13 +0200, Hannu Krosing wrote: > >> attached is a patch which enables plpython to recognize function with > >> multiple OUT params as returning a record > > > > Overrides previous patch. > > > > Fixed some bugs, added regression tests. > > Hi Hannu: > > I was wondering if it would be possible to get plpython to convert IN > parameters of type ARRAY to Python lists? I see some example functions > here [1], but it would be nice if it was done automatically. This is one thing I definitely will do, praobably right after getting ANY* to work, maybe even before, if getting ANY* to work requires too many changes. One open question is how to translate arrays with non-default subscript values Quote: "Subscripted assignment allows creation of arrays that do not use one-based subscripts. For example one might assign to myarray[-2:7] to create an array with subscript values running from -2 to 7." Should I just shift it to standard python tuple, or would it be better to return it as a dictionary with keys from -2 to 7 sample: hannu=# create table ta(ia int[]); CREATE TABLE hannu=# insert into ta values('{27000,27000}'); INSERT 0 1 hannu=# update ta set ia[-2:1] = '{-2,-1,0,1}'; UPDATE 1 hannu=# select * from ta; ia -------------------------- [-2:2]={-2,-1,0,1,27000} (1 row) and if I do return a dictionary , the after this hannu=# update ta set ia[7:7] = '{7}'; UPDATE 1 hannu=# select * from ta; ia ------------------------------------------------ [-2:7]={-2,-1,0,1,27000,NULL,NULL,NULL,NULL,7} (1 row) should the returned python dict have keys 3-6 with None, or could they just be omitted ? Actually I have quite long todo list (attached) of what I'd like to do with pl/python, but I'm not sure how much will be accepted in 8.4 under current commitfest/feature freeze scheme. Anyway, I should put that up on wiki for comments. > David > > 1. http://archives.postgresql.org/pgsql-general/2007-01/msg01417.php > -- ------------------------------------------ Hannu Krosing http://www.2ndQuadrant.com PostgreSQL Scalability and Availability Services, Consulting and Training
Вложения
В списке pgsql-hackers по дате отправления: