2012/3/5 Robert Haas <robertmhaas@gmail.com>:
> On Sat, Mar 3, 2012 at 9:23 PM, Alvaro Herrera
> <alvherre@commandprompt.com> wrote:
>> 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.
>
> I confess to some bafflement about why we need dedicated syntax for
> this, or even any kind of core support at all. What would be wrong
> with defining a function that takes regprocedure as an argument and
> does whatever? Sure, it's nicer syntax, but we've repeatedly rejected
> patches that only provided nicer syntax on the grounds that syntax is
> not free, and therefore syntax alone is not a reason to change the
> core grammar. What makes this case different?
>
before argumentation for CHECK TRIGGER I show a proposed PL checker function:
FUNCTION checker_function(regprocedure, regclass, options text[],
fatal_errors boolen)
RETURNS TABLE (functionoid oid, lineno int, statement text, sqlstate
text, message text, detail text, hint text, position int, query)
this function is worker for CHECK FUNCTION and CHECK TRIGGER
statements. The possibility to call this function directly can enable
thousands combinations - all functions, all functions from schema, all
functions that has name starts with, ...
for user friendly there are interface: CHECK FUNCTION and CHECK TRIGGER
* provides more practical reports with caret positioning than SRF function
* support often used combinations of requests - all functions from one
language, all functions from schema, all functions by one user
CHECK FUNCTION is clear - and there are no disagreement
There are two possibilities for checking triggers
a) some like CHECK FUNCTION trgfunc() ON table_name
b) existing CHECK TRIGGER t1_f1 ON table_name;
these forms are almost equal, although CREATE TRIGGER can provide more
unique information for checking. And joining table_name to TRIGGER has
bigger sense then to FUNCTION (in one statement).
When I try to look on some multicheck form:
a) CHECK FUNCTION ALL ON table_name
b) CHECK TRIGGER ALL ON table_name
then more natural form is @b (for me). Personally, I can live with
one, both or second form, although I prefer CHECK TRIGGER.
notes?
Regards
Pavel
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers