Re: ARRAY vars (was Enable pl/python to return records based on multiple OUT params)

Поиск
Список
Период
Сортировка
От David Blewett
Тема Re: ARRAY vars (was Enable pl/python to return records based on multiple OUT params)
Дата
Msg-id 9d1f8d830811060810h5e023e28x79b04c6262d8d5af@mail.gmail.com
обсуждение исходный текст
Ответ на Re: ARRAY vars (was Enable pl/python to return records based on multiple OUT params)  (Hannu Krosing <hannu@2ndQuadrant.com>)
Список pgsql-hackers
On Tue, Nov 4, 2008 at 4:17 PM, Hannu Krosing <hannu@2ndquadrant.com> wrote:
> 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

I think changing the base type is bound to cause issues. For example,
suppose someone expects to be able to simply iterate over the array.
If they're assuming it's a list, they will expect the values to be
returned. If it's a dictionary, the keys will be. If you're going to
do that, you'd need to do a custom dict class that iterated over the
values I think.

David Blewett


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: plperl needs upgrade for Fedora 10
Следующее
От: Tom Lane
Дата:
Сообщение: Re: RAM-only temporary tables