pl/pgsql Composite Parameter Question
| От | |
|---|---|
| Тема | pl/pgsql Composite Parameter Question |
| Дата | |
| Msg-id | 200201210419.2467@th00.opsion.fr обсуждение исходный текст |
| Ответы |
Re: pl/pgsql Composite Parameter Question
Re: pl/pgsql Composite Parameter Question |
| Список | 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 по дате отправления: