Hi,

On Thursday, March 15, 2012 10:58:49 PM Dimitri Fontaine wrote:
> I tricked that in the grammar, the type is called cmdtrigger but I
> though it wouldn't be a good choice for the SQL statement.
Hm. I am decidedly unhappy with that grammar hackery... But then maybe I am 
squeamish.

> + oid  |  typname   | oid  |  proname   
> +------+------------+------+------------
> + 1790 | refcursor  |   46 | textin
> + 3838 | cmdtrigger | 2300 | trigger_in
> +(2 rows)
Hm. Wonder if its a good idea to reuse trigger_in. So far we have duplicated 
functions for that.

> @@ -482,12 +494,21 @@ ListCommandTriggers(CommandContext cmd)
> 
>         switch (form->ctgtype)
>         {
>         
>             case CMD_TRIGGER_FIRED_BEFORE:
> -               cmd->before = lappend_oid(cmd->before, form->ctgfoid);
> +           {
> +               if (list_any_triggers)
> +                   cmd->before_any = lappend_oid(cmd->before_any,
> form->ctgfoid); +               else
> +                   cmd->before = lappend_oid(cmd->before, form->ctgfoid);
> 
>                 break;
> 
> -
> ...
> +       case CMD_TRIGGER_FIRED_BEFORE:
> +       {
> +           whenstr = "BEFORE";
> +
> +           foreach(cell, cmd->before_any)
> +           {
> +               Oid proc = lfirst_oid(cell);
> +
> +               call_cmdtrigger_procedure(cmd, (RegProcedure)proc,
> whenstr); +           }
> +           foreach(cell, cmd->before)
> +           {
> +               Oid proc = lfirst_oid(cell);
> +
> +               call_cmdtrigger_procedure(cmd, (RegProcedure)proc,
> whenstr); +           }
> +           break;
> +       }
This will have the effect of calling triggers outside of alphabetic order. I 
don't think thats a good idea even if one part is ANY and the other a specific 
command.
I don't think there is any reason anymore to separate the two? The only 
callsite seems to look like:

632-            default:
633:                    ListCommandTriggers(cmd, true);   /* list ANY command 
triggers */
634:                    ListCommandTriggers(cmd, false);  /* and triggers for 
this 
command tag */

Andres

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to