Bug #561: typo in trigger.c

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #561: typo in trigger.c
Date: 2002-01-15 08:41:29
Message-ID: 200201150841.g0F8fTp87611@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Holger Krug (hkrug(at)rationalizer(dot)com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
typo in trigger.c

Long Description
A typo in `trigger.c' causes a loop actually is not to be used as a loop, see the patch appended.

Because nobody never reported this as an error, we probably almost
can "assume that the triggers are always read from pg_trigger in the
same order", but the code as it is is nevertheless less reliable,
even if faster if the assumption is true.

Sample Code
Index: trigger.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/trigger.c,v
retrieving revision 1.100
diff -u -U10 -r1.100 trigger.c
--- trigger.c 2002/01/03 23:21:23 1.100
+++ trigger.c 2002/01/15 08:34:31
@@ -798,21 +798,21 @@
Trigger *trig2 = NULL;

/*
* We can't assume that the triggers are always read from
* pg_trigger in the same order; so use the trigger OIDs to
* identify the triggers to compare. (We assume here that the
* same OID won't appear twice in either trigger set.)
*/
for (j = 0; j < trigdesc2->numtriggers; j++)
{
- trig2 = trigdesc2->triggers + i;
+ trig2 = trigdesc2->triggers + j;
if (trig1->tgoid == trig2->tgoid)
break;
}
if (j >= trigdesc2->numtriggers)
return false;
if (strcmp(trig1->tgname, trig2->tgname) != 0)
return false;
if (trig1->tgfoid != trig2->tgfoid)
return false;
if (trig1->tgtype != trig2->tgtype)

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2002-01-15 16:49:08 Re: Bug #561: typo in trigger.c
Previous Message Hiroshi Inoue 2002-01-14 09:12:29 Re: Va: Bug #560: ODBC problem at migrating 7.0 to 7.1