All,
Currently PL/python has 1 dimension hardcoded for returning arrays:
create or replace function nparr ()
returns float[][]
language plpythonu
as $f$
from numpy import array
x = ((1.0,2.0),(3.0,4.0),(5.0,6.0),)
return x
$f$;
josh=# select nparr()
;
ERROR: invalid input syntax for type double precision: "(1.0, 2.0)"
CONTEXT: while creating return value
PL/Python function "nparr"
josh=#
I'd like to add the following TODO to the TODO list:
PL/Python
[] Allow functions to return multi-dimensional arrays from lists or
numpy arrays.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com