From: | Oliver Elphick <olly(at)lfix(dot)co(dot)uk> |
---|---|
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:46:25 |
Message-ID: | 1038523584.13298.745.camel@linda.lfix.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 2002-11-28 at 21:55, Adrian Klaver wrote:
> I have created the following function:
...
> IF new.tag_number=old.tag_number THEN
> RAISE EXCEPTION ''Number is already present '';
...
> 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?
NEW contains the whole changed record; OLD contains the record before
the change. If you "update values other than the tag_number", the
tag_number is not changed, therefore the condition is true.
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"The earth is the LORD'S, and the fullness thereof; the
world, and they that dwell therein." Psalms 24:1
From | Date | Subject | |
---|---|---|---|
Next Message | Tariq Muhammad | 2002-11-28 22:49:12 | Re: Trigger once again |
Previous Message | Holger Klawitter | 2002-11-28 22:45:51 | Re: Why does everyone think MySQL is easier? |