PL/PgSQL composite parameter usage? - Mailing list pgsql-general

From Patrick Higgins
Subject PL/PgSQL composite parameter usage?
Date
Msg-id 1071172688.24112.20.camel@phiggins.transzap.com
Whole thread Raw
Responses Re: PL/PgSQL composite parameter usage?
List pgsql-general
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



pgsql-general by date:

Previous
From: "Matt Gordon"
Date:
Subject: VACUUM ANALYZE -vs- ANALYZE on an insert-only table.
Next
From: jisaacks@yahoo.com (John Isaacks)
Date:
Subject: Re: Making a tree with "millions and millions" of dynamic nodes