Skip to content

Commit 0aa5b68

Browse files
committed
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.
1 parent 2eafcf6 commit 0aa5b68

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/backend/commands/trigger.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.140 2002/11/23 03:59:07 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.141 2002/11/25 03:36:50 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -199,7 +199,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
199199
if (stmt->row)
200200
TRIGGER_SETT_ROW(tgtype);
201201

202-
for (i = 0; i < 2 && stmt->actions[i]; i++)
202+
for (i = 0; stmt->actions[i]; i++)
203203
{
204204
switch (stmt->actions[i])
205205
{

src/backend/parser/gram.y

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.381 2002/11/23 03:59:08 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.382 2002/11/25 03:36:50 tgl Exp $
1515
*
1616
* HISTORY
1717
* AUTHOR DATE MAJOR EVENT
@@ -2027,7 +2027,7 @@ CreateTrigStmt:
20272027
n->args = $13;
20282028
n->before = $4;
20292029
n->row = $8;
2030-
memcpy (n->actions, $5, 4);
2030+
memcpy(n->actions, $5, 4);
20312031
n->isconstraint = FALSE;
20322032
n->deferrable = FALSE;
20332033
n->initdeferred = FALSE;
@@ -2047,7 +2047,7 @@ CreateTrigStmt:
20472047
n->args = $18;
20482048
n->before = FALSE;
20492049
n->row = TRUE;
2050-
memcpy (n->actions, $6, 4);
2050+
memcpy(n->actions, $6, 4);
20512051
n->isconstraint = TRUE;
20522052
n->deferrable = ($10 & 1) != 0;
20532053
n->initdeferred = ($10 & 2) != 0;
@@ -2066,17 +2066,19 @@ TriggerEvents:
20662066
TriggerOneEvent
20672067
{
20682068
char *e = palloc(4);
2069-
e[0] = $1; e[1] = 0; $$ = e;
2069+
e[0] = $1; e[1] = '\0';
2070+
$$ = e;
20702071
}
20712072
| TriggerOneEvent OR TriggerOneEvent
20722073
{
20732074
char *e = palloc(4);
2074-
e[0] = $1; e[1] = $3; e[2] = 0; $$ = e;
2075+
e[0] = $1; e[1] = $3; e[2] = '\0';
2076+
$$ = e;
20752077
}
20762078
| TriggerOneEvent OR TriggerOneEvent OR TriggerOneEvent
20772079
{
20782080
char *e = palloc(4);
2079-
e[0] = $1; e[1] = $3; e[2] = $5; e[3] = 0;
2081+
e[0] = $1; e[1] = $3; e[2] = $5; e[3] = '\0';
20802082
$$ = e;
20812083
}
20822084
;

src/include/nodes/parsenodes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: parsenodes.h,v 1.217 2002/11/23 03:59:09 momjian Exp $
10+
* $Id: parsenodes.h,v 1.218 2002/11/25 03:36:50 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1048,7 +1048,7 @@ typedef struct CreateTrigStmt
10481048
List *args; /* list of (T_String) Values or NIL */
10491049
bool before; /* BEFORE/AFTER */
10501050
bool row; /* ROW/STATEMENT */
1051-
char actions[3]; /* Insert, Update, Delete */
1051+
char actions[4]; /* 1 to 3 of 'i', 'u', 'd', + trailing \0 */
10521052

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy