Commit 53b2e004 authored by Hiroshi Inoue's avatar Hiroshi Inoue

Keep the contents of ItemPointerData not the pointers so that

per tuple memory context doesn't discard them.
parent 793bcc67
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.18 2001/06/22 19:16:22 wieck Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.19 2001/09/29 07:57:06 inoue Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
#include "access/heapam.h" #include "access/heapam.h"
#include "parser/parsetree.h" #include "parser/parsetree.h"
static int TidListCreate(List *, ExprContext *, ItemPointer *); static int TidListCreate(List *, ExprContext *, ItemPointerData []);
static TupleTableSlot *TidNext(TidScan *node); static TupleTableSlot *TidNext(TidScan *node);
static int static int
TidListCreate(List *evalList, ExprContext *econtext, ItemPointer *tidList) TidListCreate(List *evalList, ExprContext *econtext, ItemPointerData tidList[])
{ {
List *lst; List *lst;
ItemPointer itemptr; ItemPointer itemptr;
...@@ -49,7 +49,7 @@ TidListCreate(List *evalList, ExprContext *econtext, ItemPointer *tidList) ...@@ -49,7 +49,7 @@ TidListCreate(List *evalList, ExprContext *econtext, ItemPointer *tidList)
NULL)); NULL));
if (!isNull && itemptr && ItemPointerIsValid(itemptr)) if (!isNull && itemptr && ItemPointerIsValid(itemptr))
{ {
tidList[numTids] = itemptr; tidList[numTids] = *itemptr;
numTids++; numTids++;
} }
} }
...@@ -80,8 +80,7 @@ TidNext(TidScan *node) ...@@ -80,8 +80,7 @@ TidNext(TidScan *node)
bool bBackward; bool bBackward;
int tidNumber; int tidNumber;
ItemPointer *tidList, ItemPointerData* tidList;
itemptr;
/* /*
* extract necessary information from tid scan node * extract necessary information from tid scan node
...@@ -146,14 +145,10 @@ TidNext(TidScan *node) ...@@ -146,14 +145,10 @@ TidNext(TidScan *node)
{ {
bool slot_is_valid = false; bool slot_is_valid = false;
itemptr = tidList[tidstate->tss_TidPtr];
tuple->t_datamcxt = NULL; tuple->t_datamcxt = NULL;
tuple->t_data = NULL; tuple->t_data = NULL;
if (itemptr) tuple->t_self = tidList[tidstate->tss_TidPtr];
{
tuple->t_self = *(itemptr);
heap_fetch(heapRelation, snapshot, tuple, &buffer, NULL); heap_fetch(heapRelation, snapshot, tuple, &buffer, NULL);
}
if (tuple->t_data != NULL) if (tuple->t_data != NULL)
{ {
bool prev_matches = false; bool prev_matches = false;
...@@ -187,7 +182,7 @@ TidNext(TidScan *node) ...@@ -187,7 +182,7 @@ TidNext(TidScan *node)
for (prev_tid = 0; prev_tid < tidstate->tss_TidPtr; for (prev_tid = 0; prev_tid < tidstate->tss_TidPtr;
prev_tid++) prev_tid++)
{ {
if (ItemPointerEquals(tidList[prev_tid], &tuple->t_self)) if (ItemPointerEquals(&tidList[prev_tid], &tuple->t_self))
{ {
prev_matches = true; prev_matches = true;
break; break;
...@@ -254,7 +249,7 @@ ExecTidReScan(TidScan *node, ExprContext *exprCtxt, Plan *parent) ...@@ -254,7 +249,7 @@ ExecTidReScan(TidScan *node, ExprContext *exprCtxt, Plan *parent)
{ {
EState *estate; EState *estate;
TidScanState *tidstate; TidScanState *tidstate;
ItemPointer *tidList; ItemPointerData* tidList;
tidstate = node->tidstate; tidstate = node->tidstate;
estate = node->scan.plan.state; estate = node->scan.plan.state;
...@@ -381,7 +376,7 @@ ExecInitTidScan(TidScan *node, EState *estate, Plan *parent) ...@@ -381,7 +376,7 @@ ExecInitTidScan(TidScan *node, EState *estate, Plan *parent)
{ {
TidScanState *tidstate; TidScanState *tidstate;
CommonScanState *scanstate; CommonScanState *scanstate;
ItemPointer *tidList; ItemPointerData* tidList;
int numTids; int numTids;
int tidPtr; int tidPtr;
List *rangeTable; List *rangeTable;
...@@ -436,7 +431,7 @@ ExecInitTidScan(TidScan *node, EState *estate, Plan *parent) ...@@ -436,7 +431,7 @@ ExecInitTidScan(TidScan *node, EState *estate, Plan *parent)
/* /*
* get the tid node information * get the tid node information
*/ */
tidList = (ItemPointer *) palloc(length(node->tideval) * sizeof(ItemPointer)); tidList = (ItemPointerData *) palloc(length(node->tideval) * sizeof(ItemPointerData));
numTids = 0; numTids = 0;
if (!node->needRescan) if (!node->needRescan)
numTids = TidListCreate(node->tideval, scanstate->cstate.cs_ExprContext, tidList); numTids = TidListCreate(node->tideval, scanstate->cstate.cs_ExprContext, tidList);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: execnodes.h,v 1.62 2001/07/16 05:07:00 tgl Exp $ * $Id: execnodes.h,v 1.63 2001/09/29 07:57:04 inoue Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -461,7 +461,7 @@ typedef struct TidScanState ...@@ -461,7 +461,7 @@ typedef struct TidScanState
int tss_NumTids; int tss_NumTids;
int tss_TidPtr; int tss_TidPtr;
int tss_MarkTidPtr; int tss_MarkTidPtr;
ItemPointer *tss_TidList; ItemPointerData* tss_TidList;
HeapTupleData tss_htup; HeapTupleData tss_htup;
} TidScanState; } TidScanState;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment