Un-break triggers declared for INSERT OR DELETE OR UPDATE. This worked

okay in 7.3, so I think it must have been busted in the recent triggers
patch.
This commit is contained in:
Tom Lane 2002-11-25 03:36:50 +00:00
parent 2eafcf68d5
commit 0aa5b6866e
3 changed files with 12 additions and 10 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.140 2002/11/23 03:59:07 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.141 2002/11/25 03:36:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -199,7 +199,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
if (stmt->row)
TRIGGER_SETT_ROW(tgtype);
for (i = 0; i < 2 && stmt->actions[i]; i++)
for (i = 0; stmt->actions[i]; i++)
{
switch (stmt->actions[i])
{

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.381 2002/11/23 03:59:08 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.382 2002/11/25 03:36:50 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -2027,7 +2027,7 @@ CreateTrigStmt:
n->args = $13;
n->before = $4;
n->row = $8;
memcpy (n->actions, $5, 4);
memcpy(n->actions, $5, 4);
n->isconstraint = FALSE;
n->deferrable = FALSE;
n->initdeferred = FALSE;
@ -2047,7 +2047,7 @@ CreateTrigStmt:
n->args = $18;
n->before = FALSE;
n->row = TRUE;
memcpy (n->actions, $6, 4);
memcpy(n->actions, $6, 4);
n->isconstraint = TRUE;
n->deferrable = ($10 & 1) != 0;
n->initdeferred = ($10 & 2) != 0;
@ -2066,17 +2066,19 @@ TriggerEvents:
TriggerOneEvent
{
char *e = palloc(4);
e[0] = $1; e[1] = 0; $$ = e;
e[0] = $1; e[1] = '\0';
$$ = e;
}
| TriggerOneEvent OR TriggerOneEvent
{
char *e = palloc(4);
e[0] = $1; e[1] = $3; e[2] = 0; $$ = e;
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[0] = $1; e[1] = $3; e[2] = $5; e[3] = '\0';
$$ = e;
}
;

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: parsenodes.h,v 1.217 2002/11/23 03:59:09 momjian Exp $
* $Id: parsenodes.h,v 1.218 2002/11/25 03:36:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1048,7 +1048,7 @@ typedef struct CreateTrigStmt
List *args; /* list of (T_String) Values or NIL */
bool before; /* BEFORE/AFTER */
bool row; /* ROW/STATEMENT */
char actions[3]; /* Insert, Update, Delete */
char actions[4]; /* 1 to 3 of 'i', 'u', 'd', + trailing \0 */
/* The following are used for referential */
/* integrity constraint triggers */