Re: [GENERAL] Passing a ROWTYPE to a function

2005-01-05 Thread Michael Fuhr
On Wed, Jan 05, 2005 at 05:04:03AM -0800, Eric Brown wrote: > I'm trying to write a function that takes a %ROWTYPE as an argument. The code you posted works in 8.0. Here's an item from the 8.0 Release Notes: * More support for composite types (row and record variables) in PL/pgSQL For examp

Re: [GENERAL] Passing a ROWTYPE to a function

2005-01-05 Thread Tom Lane
Eric Brown <[EMAIL PROTECTED]> writes: > CREATE OR REPLACE FUNCTION g2(int) RETURNS int LANGUAGE plpgsql AS ' > DECLARE item t1%ROWTYPE; > BEGIN > SELECT INTO item * FROM t1 WHERE x = $1; > RETURN g1(item); > END'; This works in 8.0 but not earlier releases --- there was not support in p

[GENERAL] Passing a ROWTYPE to a function

2005-01-05 Thread Eric Brown
I'm trying to write a function that takes a %ROWTYPE as an argument. I'm just not sure how to call it from another function. This is what I tried: CREATE TABLE t1 (x int, y int); INSERT INTO t1 VALUES (1, 2); CREATE OR REPLACE FUNCTION g1(t1) RETURNS int LANGUAGE plpgsql AS ' BEGIN RETURN $1.y; END