Re: [HACKERS] PL/Python array support

2009-12-10 Thread Peter Eisentraut
On tis, 2009-12-01 at 20:53 -0700, Joshua Tolley wrote: > This patch doesn't include any documentation; my reading of the PL/Python docs > suggests that's probably acceptable, as the existing docs don't talk about its > array handling. That said, it might be useful to include an example, to show >

Re: [HACKERS] PL/Python array support

2009-12-02 Thread Joshua Tolley
On Fri, Nov 20, 2009 at 12:00:24AM +0200, Peter Eisentraut wrote: > On fre, 2009-11-13 at 18:46 +0300, Teodor Sigaev wrote: > > CREATE OR REPLACE FUNCTION incr(stuff int[]) RETURNS int[] AS $$ > > for x in stuff: > > yield x+1 > > $$ > > LANGUAGE 'plpythonu'; > > > > # select incr(ARRAY[1,2,3

Re: [HACKERS] PL/Python array support

2009-12-01 Thread Joshua Tolley
On Fri, Nov 20, 2009 at 12:00:24AM +0200, Peter Eisentraut wrote: > On fre, 2009-11-13 at 18:46 +0300, Teodor Sigaev wrote: > > CREATE OR REPLACE FUNCTION incr(stuff int[]) RETURNS int[] AS $$ > > for x in stuff: > > yield x+1 > > $$ > > LANGUAGE 'plpythonu'; > > > > # select incr(ARRAY[1,2,3

Re: [HACKERS] PL/Python array support

2009-11-19 Thread Peter Eisentraut
On fre, 2009-11-13 at 18:46 +0300, Teodor Sigaev wrote: > CREATE OR REPLACE FUNCTION incr(stuff int[]) RETURNS int[] AS $$ > for x in stuff: > yield x+1 > $$ > LANGUAGE 'plpythonu'; > > # select incr(ARRAY[1,2,3]); > ERROR: invalid memory alloc request size 18446744073709551608 > CONTEXT: w

Re: [HACKERS] PL/Python array support

2009-11-13 Thread Teodor Sigaev
CREATE OR REPLACE FUNCTION incr(stuff int[]) RETURNS int[] AS $$ for x in stuff: yield x+1 $$ LANGUAGE 'plpythonu'; # select incr(ARRAY[1,2,3]); ERROR: invalid memory alloc request size 18446744073709551608 CONTEXT: while creating return value PL/Python function "incr" Suppose, it could

Re: [HACKERS] PL/Python array support

2009-11-12 Thread Peter Eisentraut
On ons, 2009-11-04 at 16:02 +0200, Peter Eisentraut wrote: > Here is a patch to support arrays in PL/Python as parameters and > return values. Slightly updated version with fixed reference counting. diff --git a/src/pl/plpython/expected/plpython_types.out b/src/pl/plpython/expected/plpython_types.

Re: [HACKERS] PL/Python array support

2009-11-04 Thread Peter Eisentraut
On ons, 2009-11-04 at 09:44 -0500, Robert Haas wrote: > On Wed, Nov 4, 2009 at 9:02 AM, Peter Eisentraut wrote: > > Here is a patch to support arrays in PL/Python as parameters and return > > values. It converts an array parameter to a Python "list", and converts > > a Python "sequence" return va

Re: [HACKERS] PL/Python array support

2009-11-04 Thread Robert Haas
On Wed, Nov 4, 2009 at 9:02 AM, Peter Eisentraut wrote: > Here is a patch to support arrays in PL/Python as parameters and return > values.  It converts an array parameter to a Python "list", and converts > a Python "sequence" return value back to an array. This is probably a stupid question, but

[HACKERS] PL/Python array support

2009-11-04 Thread Peter Eisentraut
Here is a patch to support arrays in PL/Python as parameters and return values. It converts an array parameter to a Python "list", and converts a Python "sequence" return value back to an array. I have settled on two implementation restrictions for the moment: - Only supports one-dimensional arr