Skip to content

Commit a59881a

Browse files
author
Hiroshi Inoue
committed
Keep the contents of TIDs not the pointers.
Tid scan has been broken for 7.1.
1 parent e419d86 commit a59881a

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

src/backend/executor/nodeTidscan.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.16 2001/03/22 06:16:13 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.16.2.1 2001/10/01 09:38:14 inoue Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -29,11 +29,11 @@
2929
#include "access/heapam.h"
3030
#include "parser/parsetree.h"
3131

32-
static int TidListCreate(List *, ExprContext *, ItemPointer *);
32+
static int TidListCreate(List *, ExprContext *, ItemPointerData []);
3333
static TupleTableSlot *TidNext(TidScan *node);
3434

3535
static int
36-
TidListCreate(List *evalList, ExprContext *econtext, ItemPointer *tidList)
36+
TidListCreate(List *evalList, ExprContext *econtext, ItemPointerData tidList[])
3737
{
3838
List *lst;
3939
ItemPointer itemptr;
@@ -49,7 +49,7 @@ TidListCreate(List *evalList, ExprContext *econtext, ItemPointer *tidList)
4949
NULL));
5050
if (!isNull && itemptr && ItemPointerIsValid(itemptr))
5151
{
52-
tidList[numTids] = itemptr;
52+
tidList[numTids] = *itemptr;
5353
numTids++;
5454
}
5555
}
@@ -80,8 +80,7 @@ TidNext(TidScan *node)
8080

8181
bool bBackward;
8282
int tidNumber;
83-
ItemPointer *tidList,
84-
itemptr;
83+
ItemPointerData* tidList;
8584

8685
/*
8786
* extract necessary information from tid scan node
@@ -146,14 +145,10 @@ TidNext(TidScan *node)
146145
{
147146
bool slot_is_valid = false;
148147

149-
itemptr = tidList[tidstate->tss_TidPtr];
150148
tuple->t_datamcxt = NULL;
151149
tuple->t_data = NULL;
152-
if (itemptr)
153-
{
154-
tuple->t_self = *(itemptr);
155-
heap_fetch(heapRelation, snapshot, tuple, &buffer);
156-
}
150+
tuple->t_self = tidList[tidstate->tss_TidPtr];
151+
heap_fetch(heapRelation, snapshot, tuple, &buffer);
157152
if (tuple->t_data != NULL)
158153
{
159154
bool prev_matches = false;
@@ -187,7 +182,7 @@ TidNext(TidScan *node)
187182
for (prev_tid = 0; prev_tid < tidstate->tss_TidPtr;
188183
prev_tid++)
189184
{
190-
if (ItemPointerEquals(tidList[prev_tid], &tuple->t_self))
185+
if (ItemPointerEquals(&tidList[prev_tid], &tuple->t_self))
191186
{
192187
prev_matches = true;
193188
break;
@@ -254,7 +249,7 @@ ExecTidReScan(TidScan *node, ExprContext *exprCtxt, Plan *parent)
254249
{
255250
EState *estate;
256251
TidScanState *tidstate;
257-
ItemPointer *tidList;
252+
ItemPointerData* tidList;
258253

259254
tidstate = node->tidstate;
260255
estate = node->scan.plan.state;
@@ -381,7 +376,7 @@ ExecInitTidScan(TidScan *node, EState *estate, Plan *parent)
381376
{
382377
TidScanState *tidstate;
383378
CommonScanState *scanstate;
384-
ItemPointer *tidList;
379+
ItemPointerData* tidList;
385380
int numTids;
386381
int tidPtr;
387382
List *rangeTable;
@@ -436,7 +431,7 @@ ExecInitTidScan(TidScan *node, EState *estate, Plan *parent)
436431
/*
437432
* get the tid node information
438433
*/
439-
tidList = (ItemPointer *) palloc(length(node->tideval) * sizeof(ItemPointer));
434+
tidList = (ItemPointerData *) palloc(length(node->tideval) * sizeof(ItemPointerData));
440435
numTids = 0;
441436
if (!node->needRescan)
442437
numTids = TidListCreate(node->tideval, scanstate->cstate.cs_ExprContext, tidList);

src/include/nodes/execnodes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: execnodes.h,v 1.57.2.1 2001/05/15 00:34:02 tgl Exp $
10+
* $Id: execnodes.h,v 1.57.2.2 2001/10/01 09:38:14 inoue Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -454,7 +454,7 @@ typedef struct TidScanState
454454
int tss_NumTids;
455455
int tss_TidPtr;
456456
int tss_MarkTidPtr;
457-
ItemPointer *tss_TidList;
457+
ItemPointerData* tss_TidList;
458458
HeapTupleData tss_htup;
459459
} TidScanState;
460460

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