]> granicus.if.org Git - postgresql/commitdiff
Fix longstanding bug found by Atsushi Ogawa: _bt_check_unique would mark
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 12 Oct 2005 17:18:45 +0000 (17:18 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 12 Oct 2005 17:18:45 +0000 (17:18 +0000)
the wrong buffer dirty when trying to kill a dead index entry that's on
a page after the one it started on.  No risk of data corruption, just
inefficiency, but still a bug.

src/backend/access/nbtree/nbtinsert.c

index ad52b0d3fad0433be84b4dc46662f9fcc8b7d731..230b96422c9aeafaa54a9b5178e5edabc9f60bd1 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.96.2.1 2003/02/21 18:24:54 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.96.2.2 2005/10/12 17:18:45 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -266,7 +266,10 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
                                                HEAPTUPLE_DEAD)
                                        {
                                                curitemid->lp_flags |= LP_DELETE;
-                                               SetBufferCommitInfoNeedsSave(buf);
+                                               if (nbuf != InvalidBuffer)
+                                                       SetBufferCommitInfoNeedsSave(nbuf);
+                                               else
+                                                       SetBufferCommitInfoNeedsSave(buf);
                                        }
                                        if (sv_infomask != htup.t_data->t_infomask)
                                                SetBufferCommitInfoNeedsSave(hbuffer);