Re: PL/Python adding support for multi-dimensional arrays
От | Dave Cramer |
---|---|
Тема | Re: PL/Python adding support for multi-dimensional arrays |
Дата | |
Msg-id | CADK3HHJ+LzpTg-T5CwjoRMLiNx6mcw=Hk3gbFHa8cpPF-y=XwQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: PL/Python adding support for multi-dimensional arrays (Dave Cramer <pg@fastcrypt.com>) |
Ответы |
Re: PL/Python adding support for multi-dimensional arrays
|
Список | pgsql-hackers |
On 26 September 2016 at 14:52, Dave Cramer <pg@fastcrypt.com> wrote:
This crashes with arrays with non-default lower bounds:
postgres=# SELECT * FROM test_type_conversion_array_int4('[2:4]={1,2,3}');
INFO: ([1, 2, <NULL>], <type 'list'>)
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.Attached patch fixes this bug, and adds a test for it.
I'd like to see some updates to the docs for this. The manual doesn't currently say anything about multi-dimensional arrays in pl/python, but it should've mentioned that they're not supported. Now that it is supported, should mention that, and explain briefly that a multi-dimensional array is mapped to a python list of lists.If the code passes I'll fix the docsIt seems we don't have any mention in the docs about arrays with non-default lower-bounds ATM. That's not this patch's fault, but it would be good to point out that the lower bounds are discarded when an array is passed to python.
I find the loop in PLyList_FromArray() quite difficult to understand. Are the comments there mixing up the "inner" and "outer" dimensions? I wonder if that would be easier to read, if it was written in a recursive-style, rather than iterative with stacks for the dimensions.Yes, it is fairly convoluted.
Вложения
В списке pgsql-hackers по дате отправления: