Function ROWTYPE Parameter with NEW/OLD

From: "Andrew Milne" <amilne(at)solutioninc(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Function ROWTYPE Parameter with NEW/OLD
Date: 2003-11-17 18:08:40
Message-ID: 001501c3ad35$d46708a0$8d101cac@solutionip.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 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

Browse pgsql-sql by date

  From Date Subject
Next Message Troels Arvin 2003-11-17 22:55:53 Re: Quota query with decent performance?
Previous Message Michele Bendazzoli 2003-11-17 18:00:27 Re: Multicolum index and primary key