Re: review: CHECK FUNCTION statement

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: CHECK FUNCTION statement
Date: 2012-03-02 15:07:41
Message-ID: CAFj8pRDf4HWXBdTx2O+sLuB5Zh7ksxMwc=0UqnbzJWD0HP8oOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

2012/3/2 Alvaro Herrera <alvherre(at)commandprompt(dot)com>:
>
> Excerpts from Pavel Stehule's message of vie mar 02 05:29:26 -0300 2012:
>
>> you cannot to check trigger function without assigned relation -
>> TupleDescription should be assigned to NEW and OLD variables.
>
> Oh, I see, that makes sense.
>
> After mulling over this a bit, I'm dubious about having two separate
> commands, one which checks triggers and another that checks non-trigger
> functions.  Wouldn't it make more sense to have some options into CHECK
> FUNCTION so that it receives the trigger and corresponding relation name
> to check?  For example "check function foo() trigger on tab" or
> something like that?
>

I don't like it - "check trigger" is simple - and consistent

> I also wonder if it would make sense to have grammar for "check all
> triggers on table xyz" or some such, and even "check all triggers on all
> functions".

this is good idea - and I like it

CHECK TRIGGER ALL ON TABLE X

there are possible some combination like CHECK TRIGGER ALL IN SCHEMA ...;

and similar. But I am not sure, if this is necessary - for some more
complex usage developer can use a direct PL check function.

>
> Another thing is that "CHECK FUNCTION ALL FOR ROLE foo" seems a bit
> strange to me.  What about "CHECK FUNCTION ALL OWNED BY foo" instead?
> ("CHECK FUNCTION ALL" seems strange as a whole, but I'm not sure that we
> can improve that ... still, if anyone has ideas I'm sure we can discuss)

this should not be nice from language view, but it doesn't need new keywords

pattern FOR ROLE, IN SCHEMA are used

ALTER DEFAULT PRIVILEGES FOR ROLE

but OWNED BY is used too (SeqOptElem:)

I agree so OWNED BY sounds better (can be changed)

>
> As a reminder: we also have
> CHECK FUNCTION ALL IN SCHEMA f

it is ok

> and
> CHECK FUNCTION ALL IN LANGUAGE f
> (and combinations thereof)
>

it is ok too

Regards

Pavel

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-03-02 15:28:37 Re: autovacuum locks
Previous Message Gilles Darold 2012-03-02 15:05:20 Re: Patch pg_is_in_backup()