Re: TODO request: multi-dimensional arrays in PL/pythonU

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: TODO request: multi-dimensional arrays in PL/pythonU
Date: 2013-08-15 16:50:56
Message-ID: 520D06F0.5030809@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> There is no way to know how many dimensions the function expects to get
> back. (float[][] doesn't actually mean anything.) So when converting
> the return value back to SQL, you'd have to guess, is the first element
> convertible to float (how do you know?), if not, does it support the
> sequence protocol, if yes, so let's try to construct a multidimensional
> array. What if the first element is a float but the second is not?
>
> It would be useful to have a solution for that, but it would need to be
> more principled than what I just wrote.

Well, PL/R is able to return multi-dim arrays. So we have some code
precedent for this. Mind you, there's fewer checks required for PL/R,
because like Postgres it requires each dimension of the array to have
identical length and all items to be the same type.

Given that, it might be easier to support this first for numpy, which
also has the same restrictions.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2013-08-15 16:54:43 Re: CREATE TRANSFORM syntax (was Re: [PATCH] Add transforms feature)
Previous Message Magnus Hagander 2013-08-15 16:46:55 Re: psql missing tab completion for extensions