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@libertyrms.info
v:416-646-3304 x 111
c:416-993-1859
p:416-381-1457