Function ROWTYPE Parameter with NEW/OLD - Mailing list pgsql-sql

From Andrew Milne
Subject Function ROWTYPE Parameter with NEW/OLD
Date
Msg-id 001501c3ad35$d46708a0$8d101cac@solutionip.com
Whole thread Raw
List pgsql-sql
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
TRUEELSE 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



pgsql-sql by date:

Previous
From: Yasir Malik
Date:
Subject: Re: Addition and subtraction on BIT type
Next
From: "Randolf Richardson, DevNet SysOp 29"
Date:
Subject: Re: Array fields in Postgresql...