Re: poll: CHECK TRIGGER?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: poll: CHECK TRIGGER?
Date: 2012-03-04 02:23:13
Message-ID: 1330827647-sup-9274@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Excerpts from Tom Lane's message of sáb mar 03 23:00:26 -0300 2012:
> Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> > Pavel's patch for CHECK FUNCTION is adding another command besides that
> > one, which is CHECK TRIGGER. The idea behind this is that you give it
> > the relation to which the trigger is attached in addition to the trigger
> > name, and it checks the function being called by that trigger.
>
> > IMHO having a separate command for this is not warranted. It seems to
> > me that we could simply have a variant of CREATE FUNCTION for this; I
> > proposed CREATE FUNCTION trigfunc() AS TRIGGER ON tabname.
>
> You mean "CHECK FUNCTION ..." right?

Yeah, sorry.

> In principle the CHECK TRIGGER command could apply more checks than
> are possible with the proposed CHECK FUNCTION syntax: in particular,
> AFAICS "AS TRIGGER ON tabname" doesn't provide enough info to know
> whether the function should expect new and/or old rows to be provided,
> nor what it ought to return (which is different for BEFORE/AFTER cases,
> STATEMENT cases, etc). We could add all that info to the CHECK FUNCTION
> syntax, but there's definitely some merit to defining the check as
> occurring against an existing trigger definition instead.

Uh! Now that I read this I realize that what you're supposed to give to
CHECK TRIGGER is the trigger name, not the function name! In that
light, using CHECK FUNCTION for this doesn't make a lot of sense.

Okay, CHECK TRIGGER it is.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marti Raudsepp 2012-03-04 02:28:34 Re: RFC: Making TRUNCATE more "MVCC-safe"
Previous Message Tom Lane 2012-03-04 02:00:26 Re: poll: CHECK TRIGGER?