On Mon, Nov 22, 2004 at 03:34:17PM -0500, Tom Lane wrote:
> 
> Thanks for the examples.  I extended this into a simple regression test
> which I've added to CVS.  If anyone would like to add some test cases
> for more interesting stuff (triggers and error handling come to mind),
> step right up ...

Here's another test case: a function that doesn't return what it's
supposed to return.

CREATE TYPE footype AS (x INTEGER, y INTEGER);

CREATE FUNCTION foo_good() RETURNS SETOF footype AS $$
return [
    {x => 1, y => 2},
    {x => 3, y => 4}
];
$$ LANGUAGE plperl;

SELECT * FROM foo_good();
 x | y 
---+---
 1 | 2
 3 | 4
(2 rows)

CREATE FUNCTION foo_bad() RETURNS SETOF footype AS $$
return [
    [1, 2],
    [3, 4]
];
$$ LANGUAGE plperl;

SELECT * FROM foo_bad();
server closed the connection unexpectedly

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to