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

Jun Kitamura kitamura @ zoozee.jp
2003年 7月 15日 (火) 11:20:51 JST


北村です・・。
また、ぽけミスです。

> create or replace function fTimeStamp() returns TRIGGER as
> '
>  BEGIN
>   IF (select count(*) = 1 from update_info
>        where table_name = TG_RELNAME) THEN
>    update update_info set moddate = now()
>     -- , updatedby = current_user
>     -- (更新ユーザーは記録しなくて良いの?)
>     where table_name = TG_RELNAME
>     ;
>   ELSE
>    -- (初めての時は追加しなくて良いの?)
>    insert into update_info(
>     table_name,
>     moddate
>     -- ,updatedby
>    ) values (
>     PG_RELNAME,

あー。はいはい。
TG_RELANME ですね。
ごめんなさいね。

>     now()
>     -- , current_user
>    );
>   END IF;
>   return NEW;
>  END;
> '
> language 'plpgsql'
> SECURITY INVOKER;

# そろそろ現実に戻りますぅ。





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