Bug #561: typo in trigger.c - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #561: typo in trigger.c
Date
Msg-id 200201150841.g0F8fTp87611@postgresql.org
Whole thread Raw
Responses Re: Bug #561: typo in trigger.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Holger Krug (hkrug@rationalizer.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

pgsql-bugs by date:

Previous
From: andrea gelmini
Date:
Subject: Re: ehm...
Next
From: Tom Lane
Date:
Subject: Re: Bug #561: typo in trigger.c