Trigger and Trigger function, Part 2 - Mailing list pgsql-novice

From Matt Iskra
Subject Trigger and Trigger function, Part 2
Date
Msg-id s2b299f8.080@gwia
Whole thread Raw
Responses Re: Trigger and Trigger function, Part 2  (Michael Fuhr <mike@fuhr.org>)
Re: Trigger and Trigger function, Part 2  (John DeSoi <desoi@pgedit.com>)
List pgsql-novice
Thanks for the assistance Michael Fuhr and Dr. DeSoi. The recoded function is much more what I wanted to anyway - one
genericfunction 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
toshow you. This is why I am so stumped - the samples from the documentation do not work for me. Could this be an
installationor 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

pgsql-novice by date:

Previous
From:
Date:
Subject: Re: multiple inserts
Next
From: Michael Fuhr
Date:
Subject: Re: Trigger and Trigger function, Part 2