Re: trigger on table

Поиск
Список
Период
Сортировка
Искать
От
Hano de la Rouviere
Тема
Re: trigger on table
Дата
Msg-id
000a01c1b552$f228a420$05faa8c0@edios
Список
Дерево обсуждения
trigger on table "Graham Vickrage" <graham@digitalplanit.com>
Re: trigger on table Karel Zak <zakkr@zf.jcu.cz>
Re: trigger on table "Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
TryCREATE FUNCTION set_item_last_updated () RETURNS OPAQUE AS 'BEGINNEW.last_updated = now();RETURN NEW;END;'LANGUAGE 'plpgsql';
CREATE TRIGGER item_last_updated BEFORE UPDATE ON itemFOR EACH ROW EXECUTE PROCEDURE set_item_last_updated();

Make sure its BEFORE...

Hope this helps


http://www.pgexplorer.com
GUI Tool for Postgres

----- Original Message -----
From: "Graham Vickrage" 
To: "Postgres SQL" 
Sent: Thursday, February 14, 2002 2:17 PM
Subject: [SQL] trigger on table


> I am trying to create a trigger on a table that simply sets the
last_updated
> field when any updates are made to that table.
>
> I have tried the following: -
>
> CREATE FUNCTION set_item_last_updated () RETURNS OPAQUE AS '
> BEGIN
> UPDATE item SET last_updated = now();
> RETURN OLD;
> END;' LANGUAGE 'plpgsql';
>
> CREATE TRIGGER item_last_updated AFTER UPDATE ON item
> FOR EACH ROW EXECUTE PROCEDURE set_item_last_updated();
>
> When I try to execute this it hangs and postmaster eventually runs out of
> memory.
>
> Is there a way to do it just using sql not plpsql?
> Why is it hanging?
>
> Thank in advance.
>
> Graham
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>


В списке pgsql-sql по дате отправления
От: Brian Knox
Дата:
Сообщение: Re: comparision chart
От: Eduardo
Дата:
Сообщение: Money type and kylix
FAQ