Trigger and Function Question

From: "Jeff Umstead" <jumstead(at)timlsoftware(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Trigger and Function Question
Date: 2001-04-19 03:54:32
Message-ID: 3ADE1B28.29753.D7E625@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)timlsoftware(dot)com

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2001-04-19 04:58:04 Re: Trigger and Function Question
Previous Message Albert REINER 2001-04-18 21:31:26 Re: looping through records...