pl/pgsql Composite Parameter Question - Mailing list pgsql-general

From
Subject pl/pgsql Composite Parameter Question
Date
Msg-id 200201210419.2467@th00.opsion.fr
Whole thread Raw
Responses Re: pl/pgsql Composite Parameter Question  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: pl/pgsql Composite Parameter Question  (Holger Krug <hkrug@rationalizer.com>)
List pgsql-general
Dear all,

Because pl/pgsql accepts at most 16 parameters, I am
trying to feed pl/pgsql function with the whole
record as its parameter.
"Example 24-4. A PL/pgSQL Function on Composite Type"
says I am allowed to do that but I get the error:

mydb=# insert into test values('a');
ERROR:  NEW used in non-rule query

What key points have I missed? Please!

CN
===========================
CREATE TABLE test(c1 TEXT);

--test1() will be called not only by insert event.
Thus, it is here:
CREATE FUNCTION test1(test) RETURNS BOOL AS '
BEGIN
  InRec ALIAS FOR $1;
  RAISE NOTICE ''%'',InRec.c1;
  RETURN TRUE;
END;' LANGUAGE 'plpgsql';

CREATE FUNCTION tftest() RETURNS OPAQUE AS '
BEGIN
  PERFORM test1(NEW);
  RETURN NEW;
END;' LANGUAGE 'plpgsql';

CREATE TRIGGER TriggerTest AFTER INSERT ON test FOR
EACH ROW EXECUTE PROCEDURE tftest();

--------------------------------------------------------
You too can have your own email address from Eurosport.
http://www.eurosport.com






pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Password type ?
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] PostgreSQL Licence: GNU/GPL