aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeIndexscan.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-05-19 16:31:05 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-05-19 16:31:05 +0000
commitc8fd45b0593cffcc0c31f8a0664b412cebbccdae (patch)
tree588b73a1afc711fcf1850e2f1edb7a0593ccf07c /src/backend/executor/nodeIndexscan.c
parentc5c3d8c6dbd4eaa04daf471fce48a3ca06ae5dc1 (diff)
downloadpostgresql-c8fd45b0593cffcc0c31f8a0664b412cebbccdae.tar.gz
postgresql-c8fd45b0593cffcc0c31f8a0664b412cebbccdae.zip
Fix nasty bug in nodeIndexscan.c's detection of duplicate tuples during
a multiple (OR'ed) indexscan. It was checking for duplicate tuple->t_data->t_ctid, when what it should be checking is tuple->t_self. The trouble situation occurs when a live tuple has t_ctid not pointing to itself, which can happen if an attempted UPDATE was rolled back. After a VACUUM, an unrelated tuple could be installed where the failed update tuple was, leading to one live tuple's t_ctid pointing to an unrelated tuple. If one of these tuples is fetched by an earlier OR'ed indexscan and the other by a later indexscan, nodeIndexscan.c would incorrectly ignore the second tuple. The bug exists in all 7.4.* and 8.0.* versions, but not in earlier or later branches because this code was only used in those releases. Per trouble report from Rafael Martinez Guerrero.
Diffstat (limited to 'src/backend/executor/nodeIndexscan.c')
-rw-r--r--src/backend/executor/nodeIndexscan.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index 070067816dd..0f8fb32824a 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.84.2.1 2003/12/30 20:05:15 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.84.2.2 2006/05/19 16:31:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -219,7 +219,7 @@ IndexNext(IndexScanState *node)
entry = (DupHashTabEntry *)
hash_search(node->iss_DupHash,
- &tuple->t_data->t_ctid,
+ &tuple->t_self,
HASH_ENTER,
&found);
if (entry == NULL ||