Trigger and Function Question - Mailing list pgsql-novice

From Jeff Umstead
Subject Trigger and Function Question
Date
Msg-id 3ADE1B28.29753.D7E625@localhost
Whole thread Raw
Responses Re: Trigger and Function Question  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
I'm new to PostgreSQL and while it's been fairly straight forward
setting up, creating databases, tables, etc, I'm having trouble
understanding the correct creation of triggers and functions.

I have several tables with a timestamp field that I would like to use
a trigger to update whenever a row is updated.

I've created a function as follows

OS: Caldera OpenLinux eServer 2.3
PostgreSQL Version: 7.0.3

Create Function f_set_updated()
returns opaque
as 'Begin
    new.updated = current_timestamp;
    return new;
End;'
language 'plpgsql';

which return the Create message meaning it was accepted and created.

Next I created a trigger as follows

create trigger trig_t_user_updated
after update
on t_user
for each row
execute procedure f_set_updated();

This returned Create.

When I try to update table t_user:
    update t_user set midint='X' where user_id = 'mmortar';
I get the following error:

010418.22:47:10.789 [29762] ERROR:  fmgr_info: function 25479: cache
lookup failed
ERROR:  fmgr_info: function 25479: cache lookup failed

What am I doing wrong??
What are some good reference books, sites to use as I'm learning?

Thank you

Jeff Umstead
jumstead@timlsoftware.com

pgsql-novice by date:

Previous
From: "Albert REINER"
Date:
Subject: Re: looping through records...
Next
From: Tom Lane
Date:
Subject: Re: Trigger and Function Question