From: | Rory Campbell-Lange <rory(at)campbell-lange(dot)net> |
---|---|
To: | "Joshua b(dot) Jore" <josh(at)greentechnologist(dot)org> |
Cc: | Postgresql Novice List <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: auto update dates |
Date: | 2002-05-23 16:04:25 |
Message-ID: | 20020523160425.GC14520@campbell-lange.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On 23/05/02, Joshua b. Jore (josh(at)greentechnologist(dot)org) wrote:
> Check out some code I wrote at
> http://www.greentechnologist.org/political/Voter/dev/5_trig.sql. There
> are functions to keep a Created attribute invariant and update
> Modified as well.
Hi Joshua
Thanks for the mail.
I'm looking for something like your function and trigger on your page
here:
-- DROP FUNCTION UsersUpd();
CREATE FUNCTION UsersUpd() RETURNS OPAQUE AS '
BEGIN
UPDATE AuthNames SET Name = NEW.Name WHERE Name = OLD.Name;
NEW.Created = OLD.Created;
NEW.Modified = current_timestamp;
NEW.AuditSeq = nextval(''AuditSeq'');
RETURN NEW;
END;
' LANGUAGE 'plpgsql' WITH (isstrict);
-- SELECT DropTrigger('Users','UsersUpd');
CREATE TRIGGER UsersUpd BEFORE UPDATE ON Users
FOR EACH ROW EXECUTE PROCEDURE UsersUpd();
However my version of getting current_timestamp creates an error:
update ideas set title = 'three' where title ~ 'one';
NOTICE: Error occurred while executing PL/pgSQL function
update_date_time
NOTICE: line 3 at assignment
ERROR: Bad time external representation '16:11:45.820720+01'
Any ideas on why this may be?
Thanks for your help
Rory
--
Rory Campbell-Lange
<rory(at)campbell-lange(dot)net>
<www.campbell-lange.net>
From | Date | Subject | |
---|---|---|---|
Next Message | Joel Burton | 2002-05-23 16:45:06 | Re: auto update dates |
Previous Message | Rory Campbell-Lange | 2002-05-23 15:57:48 | Re: auto update dates |