Trigger and Trigger function, Part 2

From: Matt Iskra <Matt(dot)Iskra(at)doj(dot)ca(dot)gov>
To: pgsql-novice(at)postgresql(dot)org
Subject: Trigger and Trigger function, Part 2
Date: 2005-06-17 16:37:23
Message-ID: s2b299f8.080@gwia
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thanks for the assistance Michael Fuhr and Dr. DeSoi. The recoded function is much more what I wanted to anyway - one generic function that could be used on multiple tables through their respective triggers. The new function I am trying is:

CREATE FUNCTION
oc.upd_last_touch()
RETURNS TRIGGER AS
$upd_last_touch$
BEGIN
NEW.last_touch := current_timestamp;
RETURN NEW;
END;
$upd_last_touch$
LANGUAGE 'plpgsql' VOLATILE;

However, PostgreSQL is STILL giving me a syntex error on line two of the above function. The exact text is:

ERROR: syntax error at or near "FUNCTION" at character 16.

This error gives me nightmares of QBasic from 1982. Syntex error indeed. I have included a screenshot from pgAdmin III to show you. This is why I am so stumped - the samples from the documentation do not work for me. Could this be an installation or configuration issue? Does anyone see why this is not working for me?

--Matthew

CONFIDENTIALITY NOTICE: This communication with its contents may contain
confidential and/or legally privileged information. It is solely for the
use of the intended recipient(s). Unauthorized interception, review, use
or disclosure is prohibited and may violate applicable laws including
the Electronic Communications Privacy Act. If you are not the intended
recipient, please contact the sender and destroy all copies of the
communication.

Attachment Content-Type Size
image/png 18.0 KB

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2005-06-17 17:21:11 Re: Trigger and Trigger function, Part 2
Previous Message operationsengineer1 2005-06-17 15:48:32 Re: multiple inserts