Trigger and Function Question

Поиск
Список
Период
Сортировка
От Jeff Umstead
Тема Trigger and Function Question
Дата
Msg-id 3ADE1B28.29753.D7E625@localhost
обсуждение исходный текст
Ответы Re: Trigger and Function Question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: "Albert REINER"
Дата:
Сообщение: Re: looping through records...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Trigger and Function Question