Skip site navigation (1) Skip section navigation (2)

Re: Trigger and Trigger function, Part 2

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Matt Iskra <Matt(dot)Iskra(at)doj(dot)ca(dot)gov>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Trigger and Trigger function, Part 2
Date: 2005-06-17 17:21:11
Message-ID: 20050617172111.GA73750@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-novice
On Fri, Jun 17, 2005 at 09:37:23AM -0700, Matt Iskra wrote:
> 
>   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.

I created an oc schema and used psql to copy the above code into a
database with no problems.  Have you tried using psql instead of
pgAdmin III?

In the image you attached, there's a marker on the left side of the
line that contains oc.upd_last_touch(), and it looks like the cursor
is just after the dot.  Are those significant, perhaps showing where
the problem is?  I don't use pgAdmin III -- does it have trouble
with schema-qualified function names?  What happens if you omit
"oc." and make the function name simply upd_last_touch?

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

pgsql-novice by date

Next:From: Matt IskraDate: 2005-06-17 17:32:53
Subject: Trigger and Trigger function, Part 3 - success!
Previous:From: Matt IskraDate: 2005-06-17 16:37:23
Subject: Trigger and Trigger function, Part 2

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group