From: | Tariq Muhammad <tmuhamma(at)libertyrms(dot)com> |
---|---|
To: | Adrian Klaver <aklaver(at)attbi(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Trigger once again |
Date: | 2002-11-28 22:49:12 |
Message-ID: | Pine.LNX.4.21.0211281736470.21997-100000@genesis.int.libertyrms.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 28 Nov 2002, Adrian Klaver wrote:
> The trigger seems to work to well. If I update values other than the
> tag_number I get the 'Number is already present' message. I am somewhat
> confused as their is no new.tag_number value being passed to the function.
> Can anyone set me straight?
Try it by validating 2 columns, that should do the trick:
CREATE OR REPLACE FUNCTION validate_tag_number()
RETURNS OPAQUE AS '
BEGIN
IF new.tag_number=old.tag_number and new.other_column=old.other_column THEN
RAISE EXCEPTION ''Tag is already present '';
END IF;
RETURN NEW;
END;
'LANGUAGE 'plpgsql';
If that doesn't work then send me the schema of your table and I will work
on it.
Tariq Muhammad
Liberty RMS
tariq(at)libertyrms(dot)info
v:416-646-3304 x 111
c:416-993-1859
p:416-381-1457
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-11-28 23:09:49 | Re: Trigger once again |
Previous Message | Oliver Elphick | 2002-11-28 22:46:25 | Re: Trigger once again |