-----BEGIN PGP SIGNED MESSAGE-----                       
Hash: RIPEMD160                                          
NotDashEscaped: You need GnuPG to verify this message    


> ... but this patch doesn't come close to fixing it.  struct CreateTrigStmt
> needs changes.  I kinda think the restriction to 4 (or whatever)          
> elements ought to go away altogether.                                     

Thanks. I'll leave the [5] restriction call to someone else, seems it 
does no harm to me though (not as if we'd change it that often anyway).
Revised patch below. I looked through other places that might be affected, 
but did not see anything else except ecpg/preproc/preproc.y, which         
looks as though it's already been changed to handle four events.           


Index: src/backend/parser/gram.y
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/parser/gram.y,v      
retrieving revision 2.664                                          
diff -c -r2.664 gram.y                                             
*** src/backend/parser/gram.y   27 May 2009 20:42:29 -0000      2.664
--- src/backend/parser/gram.y   18 Jun 2009 00:44:15 -0000           
***************                                                      
*** 3133,3139 ****                                                   
                                        n->args = $13;               
                                        n->before = $4;              
                                        n->row = $8;                 
!                                       memcpy(n->actions, $5, 4);   
                                        n->isconstraint  = FALSE;    
                                        n->deferrable    = FALSE;    
                                        n->initdeferred  = FALSE;    
--- 3133,3139 ----                                                   
                                        n->args = $13;               
                                        n->before = $4;              
                                        n->row = $8;                 
!                                       memcpy(n->actions, $5, 5);   
                                        n->isconstraint  = FALSE;    
                                        n->deferrable    = FALSE;    
                                        n->initdeferred  = FALSE;    
***************                                                      
*** 3153,3159 ****                                                   
                                        n->args = $18;               
                                        n->before = FALSE;           
                                        n->row = TRUE;               
!                                       memcpy(n->actions, $6, 4);   
                                        n->isconstraint  = TRUE;     
                                        n->deferrable = ($10 & 1) != 0;
                                        n->initdeferred = ($10 & 2) != 0;
--- 3153,3159 ----                                                       
                                        n->args = $18;                   
                                        n->before = FALSE;               
                                        n->row = TRUE;                   
!                                       memcpy(n->actions, $6, 5);       
                                        n->isconstraint  = TRUE;         
                                        n->deferrable = ($10 & 1) != 0;  
                                        n->initdeferred = ($10 & 2) != 0;
***************                                                          
*** 3171,3192 ****                                                       
  TriggerEvents:                                                         
                        TriggerOneEvent                                  
                                {                                        
!                                       char *e = palloc(4);             
                                        e[0] = $1; e[1] = '\0';          
                                        $$ = e;                          
                                }                                        
                        | TriggerOneEvent OR TriggerOneEvent             
                                {                                        
!                                       char *e = palloc(4);             
                                        e[0] = $1; e[1] = $3; e[2] = '\0';
                                        $$ = e;                           
                                }                                         
                        | TriggerOneEvent OR TriggerOneEvent OR TriggerOneEvent
                                {                                              
!                                       char *e = palloc(4);                   
                                        e[0] = $1; e[1] = $3; e[2] = $5; e[3] = 
'\0';
                                        $$ = e;                                 
     
                                }                                               
     
                ;                                                               
     
                                                                                
     
  TriggerOneEvent:                                                              
     
--- 3171,3198 ----                                                              
     
  TriggerEvents:                                                                
     
                        TriggerOneEvent                                         
     
                                {                                               
     
!                                       char *e = palloc(5);                    
     
                                        e[0] = $1; e[1] = '\0';                 
     
                                        $$ = e;                                 
     
                                }                                               
     
                        | TriggerOneEvent OR TriggerOneEvent                    
     
                                {                                               
     
!                                       char *e = palloc(5);                    
     
                                        e[0] = $1; e[1] = $3; e[2] = '\0';      
     
                                        $$ = e;                                 
     
                                }                                               
     
                        | TriggerOneEvent OR TriggerOneEvent OR TriggerOneEvent 
     
                                {                                               
     
!                                       char *e = palloc(5);                    
     
                                        e[0] = $1; e[1] = $3; e[2] = $5; e[3] = 
'\0';
                                        $$ = e;                                 
     
                                }                                               
     
+                       | TriggerOneEvent OR TriggerOneEvent OR TriggerOneEvent 
OR TriggerOneEvent
+                               {                                               
                  
+                                       char *e = palloc(5);                    
                  
+                                       e[0] = $1; e[1] = $3; e[2] = $5; e[3] = 
$7; e[4] = '\0';  
+                                       $$ = e;                                 
                  
+                               }                                               
                  
                ;                                                               
                  
                                                                                
                  
  TriggerOneEvent:                                                              
                  
Index: src/include/nodes/parsenodes.h                                           
                  
===================================================================             
                  
RCS file: /projects/cvsroot/pgsql/src/include/nodes/parsenodes.h,v              
                  
retrieving revision 1.394                                                       
                  
diff -c -r1.394 parsenodes.h                                                    
                  
*** src/include/nodes/parsenodes.h      11 Jun 2009 14:49:11 -0000      1.394   
                  
--- src/include/nodes/parsenodes.h      18 Jun 2009 00:44:15 -0000              
                  
***************                                                                 
                  
*** 1551,1557 ****                                                              
                  
        List       *args;                       /* list of (T_String) Values or 
NIL */
        bool            before;                 /* BEFORE/AFTER */
        bool            row;                    /* ROW/STATEMENT */
!       char            actions[4];             /* 1 to 3 of 'i', 'u', 'd', + 
trailing \0 */

        /* The following are used for referential */
        /* integrity constraint triggers */
--- 1551,1557 ----
        List       *args;                       /* list of (T_String) Values or 
NIL */
        bool            before;                 /* BEFORE/AFTER */
        bool            row;                    /* ROW/STATEMENT */
!       char            actions[5];             /* 1 to 4 of 'i', 'u', 'd', or 
't', + trailing \0 */

        /* The following are used for referential */
        /* integrity constraint triggers */




--
Greg Sabino Mullane g...@turnstep.com
End Point Corporation
PGP Key: 0x14964AC8 200906172045
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAko5jioACgkQvJuQZxSWSsgqBACfVMeTyQkT9wqJTPi9oTLHuipK
8sgAn0vowAiCNhnoYBnsZT310UFC1UV7
=LpeM
-----END PGP SIGNATURE-----



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

Reply via email to