[pgsql-jp: 30477] Re: トリガを作れない

OKINAKA Kenshin okinaka @ chance.com
2003年 7月 15日 (火) 13:01:29 JST


沖中と申します。

Genshirou Taki <g_taki @ max-corporation.com> wrote:

> やりたいことは、
> 1:a,b,c,d,,,,といくつかのTableがある。
> 2:update_infoというテーブルがあり、以下のように構造で、
> 
> 	table_name(TEXT型)	moddate(TIMESTAMP型)
> 	a			2003/07/11 **:**:** ****
> 	b			2003/07/12 **:**:** ****
> 	c			2003/07/13 **:**:** ****
> 
> 3:Table a が更新されたら、
>   update update_info set moddate = now() WHERE table_name = 'a';
>   を行いたい
>   Table b が更新されたら、
>   上記SQLは update 中略 WHERE table_name = 'b';
> 
> といった具合です。

PostgreSQL独自の仕組みですがルールを使うのはどうでしょうか?
http://www.postgresql.jp/document/pg732doc/reference/sql-createrule.html

-- 
株式会社チャンスイット
沖中 研心 <okinaka @ chance.com>





pgsql-jp メーリングリストの案内