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

From: "David Blewett" <david(at)dawninglight(dot)net>
To: "Hannu Krosing" <hannu(at)2ndquadrant(dot)com>
Cc: "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ARRAY vars (was Enable pl/python to return records based on multiple OUT params)
Date: 2008-11-06 16:10:39
Message-ID: 9d1f8d830811060810h5e023e28x79b04c6262d8d5af@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 4, 2008 at 4:17 PM, Hannu Krosing <hannu(at)2ndquadrant(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2008-11-06 16:13:16 Re: RAM-only temporary tables
Previous Message Tom Lane 2008-11-06 16:09:23 Re: patch to fix client only builds