Function ROWTYPE Parameter with NEW/OLD

Поиск
Список
Период
Сортировка
Искать

Function ROWTYPE Parameter with NEW/OLD

От:
"Andrew Milne" <amilne@solutioninc.com>
Дата:
Postgres 7.2.1

I'm trying to create a function that takes a ROWTYPE parameter that I can
then call from a rule by passing NEW/OLD, but am having problems.


CREATE OR REPLACE FUNCTION "some_boolean_function" (mytablename) RETURNS
boolean AS '       DECLARE               mytable ALIAS FOR $1;       BEGIN              -- IF SOME CONDITION RETURN TRUE ELSE RETURN FALSE;       END;'       LANGUAGE 'plpgsql';

This works fine.

CREATE RULE some_rule AS ON UPDATE TO mytablename WHERE
(some_boolean_function(new, old)) DO INSTEAD (some other statements);

It cacks on the new and old parameters - misunderstanding on my part?
potential bug?  I have to check most of the fields in this table, so would
rather pass the whole record rather than individual fields.

Thanks,

Andrew


FAQ