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]);
> > ERROR:  invalid memory alloc request size 18446744073709551608
> > CONTEXT:  while creating return value
> > PL/Python function "incr"
> 
> Fixed with additional error check and regression test.  (The problem
> could be more simply demonstrated by returning any non-sequence from the
> function.)  Thanks for catching it.

My last email claimed that the regression test needed some additional changes
to its expected output, and further claimed that it had the regression test's
diff attached. As was helpfully pointed out off-list, it actually wasn't
attached. Trying again..

-- Josh
*** /home/josh/devel/pgsrc/pg85/src/pl/plpython/expected/plpython_types.out     
2009-12-01 20:39:52.000000000 -0700
--- /home/josh/devel/pgsrc/pg85/src/pl/plpython/results/plpython_types.out      
2009-12-01 20:40:04.000000000 -0700
***************
*** 580,582 ****
--- 580,589 ----
   {abc,def}
  (1 row)
  
+ CREATE FUNCTION test_type_conversion_array_error() RETURNS int[] AS $$
+ return 5
+ $$ LANGUAGE plpythonu;
+ SELECT * FROM test_type_conversion_array_error();
+ ERROR:  PL/Python: return value of function with array return type is not a 
Python sequence
+ CONTEXT:  while creating return value
+ PL/Python function "test_type_conversion_array_error"

======================================================================

Attachment: signature.asc
Description: Digital signature

Reply via email to