I read in the documentation (section 37.4.3 of the 7.4 docs) that
"Parameters to a function can be composite types," but when I try to
call such a function, I get an error. I've attached my test functions
below. Can anyone tell me what's wrong? I've tried the same function
using RECORD types, and it also does not work. This is using 7.4
compiled from source on x86 Linux.
test=> CREATE TABLE tablea (a int, b int, c int);
CREATE TABLE
test=>
test=> CREATE OR REPLACE FUNCTION funca() RETURNS INTEGER AS '
test'> DECLARE
test'> v tablea;
test'> BEGIN
test'> v.a := 1;
test'> v.b := 2;
test'> v.c := 3;
test'> PERFORM funcb(v);
test'> RETURN NULL;
test'> END;
test'> ' LANGUAGE 'plpgsql';
CREATE FUNCTION
test=>
test=> CREATE OR REPLACE FUNCTION funcb(tablea) RETURNS INTEGER AS '
test'> BEGIN
test'> INSERT INTO tablea (a, b, c) VALUES ($1.a, $1.b, $1.c);
test'> RETURN NULL;
test'> END;
test'> ' LANGUAGE 'plpgsql';
CREATE FUNCTION
test=>
test=> SELECT funca();
ERROR: column "v" does not exist
CONTEXT: PL/pgSQL function "funca" line 7 at perform