From: Adrian Klaver <aklaver@attbi.com>
To: pgsql-general@postgresql.org
Subject: Trigger
Date: Thu, 28 Nov 2002 12:35:42 -0800
Message-ID: <200211281235.42714.aklaver@attbi.com> (raw)
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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: aklaver@attbi.com
Subject: Re: Trigger
In-Reply-To: <200211281235.42714.aklaver@attbi.com>
References: <200211281235.42714.aklaver@attbi.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