Re: TRIGGER with WHEN clause

Kohei KaiGai <kaigai@kaigai.gr.jp>

From: KaiGai Kohei <kaigai@kaigai.gr.jp>
To: Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>
Cc: Albe Laurenz <laurenz.albe@wien.gv.at>, pgsql-hackers@postgresql.org
Date: 2009-11-16T11:03:24Z
Lists: pgsql-hackers
Albe Laurenz wrote:
> SQL> CREATE TRIGGER dummy BEFORE DELETE ON employees WHEN (1 = 1)
>   2  BEGIN
>   3  END;
>   4  /
> CREATE TRIGGER dummy BEFORE DELETE ON employees WHEN (1 = 1)
>                                                 *
> ERROR at line 1:
> ORA-04077: WHEN clause cannot be used with table level triggers

Thanks for your information.

> I am also not sure about Oracle, but I think there are usage of
> statement trigger with WHEN cluase something like:
>   =# CREATE TRIGGER log_trig BEFORE UPDATE ON tbl
>        WHEN (is_superuser()) EXECUTE PROCEDURE log_current_stmt();

Itagaki-san, I also think your example usage is enough valueable.
However, Oracle does not have the feature apparently, although the
purpose of this patch is to provide a compatible feature, IIRC.

I don't have any preference on either of them.
If you make a decision, I'll review the patch according to your
decision. So, I like to ask you which is your preference again.

Thanks,
-- 
KaiGai Kohei <kaigai@kaigai.gr.jp>