PL/PgSQL composite parameter usage?

From: Patrick Higgins <phiggins(at)brazen(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: PL/PgSQL composite parameter usage?
Date: 2003-12-11 19:58:09
Message-ID: 1071172688.24112.20.camel@phiggins.transzap.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael . 2003-12-11 20:14:00 ERROR: JOIN/USING types 'integer' and 'character varying' not matched
Previous Message Jeff Rogers 2003-12-11 19:49:03 set returning functions