Trigger
I have created the following function:
CREATE OR REPLACE FUNCTION validate_tag_number()
RETURNS OPAQUE AS '
BEGIN
IF new.tag_number=old.tag_number THEN
RAISE EXCEPTION " number is already present";
END IF;
RETURN NEW;
END;
'LANGUAGE 'plpgsql';
I used it to create a trigger as follows;
CREATE TRIGGER validate_tag_number BEFORE UPDATE ON tag_vendor FOR EACH ROW
EXECUTE PROCEDURE validate_tag_number();
If I do an update with a tag_number that does not exist everything is fine.
If I do an update with a preexisting number I get the following messages-
NOTICE: plpgsql:ERROR during compile of validate_tag_number line 3
ERROR: unterminated " in name "
I was expecting to get the "number is already present" error messsage.
Where is my error?
Thank you
Adrian Klaver
On Thu, 28 Nov 2002, Adrian Klaver wrote:
RAISE EXCEPTION " number is already present";
Try it as under
RAISE EXCEPTION ''number is already present'';
Tariq Muhammad
Liberty RMS
tariq@libertyrms.info
v:416-646-3304 x 111
c:416-993-1859
p:416-381-1457
On Thursday 28 November 2002 01:04 pm, Tariq Muhammad wrote:
Thank you. By focusing on the quotes you made me realize I was using double
quotes instead of escaped single quotes.
Show quoted text
On Thu, 28 Nov 2002, Adrian Klaver wrote:
RAISE EXCEPTION " number is already present";
Try it as under
RAISE EXCEPTION ''number is already present'';
Tariq Muhammad
Liberty RMS
tariq@libertyrms.info
v:416-646-3304 x 111
c:416-993-1859
p:416-381-1457---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)