From: Andrew Milne <amilne@solutioninc.com>
To: pgsql-sql@postgresql.org
Subject: Function ROWTYPE Parameter with NEW/OLD
Date: Mon, 17 Nov 2003 14:08:40 -0400
Message-ID: <001501c3ad35$d46708a0$8d101cac@solutionip.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: amilne@solutioninc.com
Subject: Re: Function ROWTYPE Parameter with NEW/OLD
In-Reply-To: <001501c3ad35$d46708a0$8d101cac@solutionip.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox