Re: TRIGGER with WHEN clause

From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>
Cc: KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: TRIGGER with WHEN clause
Date: 2009-11-18 08:46:02
Message-ID: 20091118174602.A4C4.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-rrreviewers


KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com> wrote:

> In addition, I could find a few matters.
> * TOAST may be necessary for pg_trigger?

I added toast relation to pg_trigger.
DECLARE_TOAST(pg_trigger, 2336, 2337);

I think having a toast relation for pg_trigger is reasonable
because pg_trigger already has a variable field "tgargs"
even if we don't have the new field "tgqual" from the patch.
I'm not sure why we don't have a toast relation for pg_trigger
because user might pass very long trigger arguments.

> * ROW INSERT TRIGGER on COPY FROM statement

Thanks. Good catch! Fixed and regression test added.

> * Using system column in WHEN clause
> 2) Describe a notice on the user documentation not to use system columns
> in the WHEN clause, because these are assigned on after the trigger
> invocations.

I'd like to only add documentation because I don't have a whole solution.
----
System columns are not available in the <literal>WHEN</> clause
because those values are initialized after triggers are called.
They might return wrong values if they used in expressions of the clause.
----

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
trigger-when_20091118.patch application/octet-stream 56.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2009-11-18 09:11:19 Re: Very bad FTS performance with the Polish config
Previous Message Simon Riggs 2009-11-18 08:01:35 Re: Syntax for partitioning

Browse pgsql-rrreviewers by date

  From Date Subject
Next Message KaiGai Kohei 2009-11-19 01:09:28 Re: TRIGGER with WHEN clause
Previous Message KaiGai Kohei 2009-11-17 07:30:06 Re: TRIGGER with WHEN clause