Commit fa1a8d6a authored by Bruce Momjian's avatar Bruce Momjian

OK, folks, here is the pgindent output.

parent af74855a
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.40 1998/09/01 03:20:41 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.41 1998/09/01 04:26:39 momjian Exp $
* *
* NOTES * NOTES
* The old interface functions have been converted to macros * The old interface functions have been converted to macros
...@@ -935,7 +935,8 @@ heap_modifytuple(HeapTuple tuple, ...@@ -935,7 +935,8 @@ heap_modifytuple(HeapTuple tuple,
(char *) &tuple->t_oid, (char *) &tuple->t_oid,
((char *) &tuple->t_hoff - (char *) &tuple->t_oid)); /* XXX */ ((char *) &tuple->t_hoff - (char *) &tuple->t_oid)); /* XXX */
newTuple->t_infomask = infomask; newTuple->t_infomask = infomask;
newTuple->t_natts = numberOfAttributes; /* fix t_natts just in case */ newTuple->t_natts = numberOfAttributes; /* fix t_natts just in
* case */
return newTuple; return newTuple;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.34 1998/09/01 03:20:45 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.35 1998/09/01 04:26:40 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -82,8 +82,10 @@ printtup(HeapTuple tuple, TupleDesc typeinfo) ...@@ -82,8 +82,10 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
Datum attr; Datum attr;
bool isnull; bool isnull;
Oid typoutput; Oid typoutput;
#ifdef MULTIBYTE #ifdef MULTIBYTE
unsigned char *p; unsigned char *p;
#endif #endif
/* ---------------- /* ----------------
...@@ -147,7 +149,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo) ...@@ -147,7 +149,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
outputstr = "<unprintable>"; outputstr = "<unprintable>";
pq_putint(strlen(outputstr) + VARHDRSZ, VARHDRSZ); pq_putint(strlen(outputstr) + VARHDRSZ, VARHDRSZ);
pq_putnchar(outputstr, strlen(outputstr)); pq_putnchar(outputstr, strlen(outputstr));
} }
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.43 1998/09/01 03:20:46 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.44 1998/09/01 04:26:41 momjian Exp $
* *
* NOTES * NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be * some of the executor utility code such as "ExecTypeFromTL" should be
...@@ -75,7 +75,7 @@ CreateTemplateTupleDesc(int natts) ...@@ -75,7 +75,7 @@ CreateTemplateTupleDesc(int natts)
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
TupleDesc TupleDesc
CreateTupleDesc(int natts, Form_pg_attribute *attrs) CreateTupleDesc(int natts, Form_pg_attribute * attrs)
{ {
TupleDesc desc; TupleDesc desc;
......
...@@ -33,42 +33,32 @@ ...@@ -33,42 +33,32 @@
#endif #endif
/* non-export function prototypes */ /* non-export function prototypes */
static InsertIndexResult static InsertIndexResult gistdoinsert(Relation r, IndexTuple itup,
gistdoinsert(Relation r, IndexTuple itup,
GISTSTATE *GISTstate); GISTSTATE *GISTstate);
static InsertIndexResult static InsertIndexResult gistentryinsert(Relation r, GISTSTACK *stk,
gistentryinsert(Relation r, GISTSTACK *stk,
IndexTuple tup, IndexTuple tup,
GISTSTATE *giststate); GISTSTATE *giststate);
static void static void gistentryinserttwo(Relation r, GISTSTACK *stk, IndexTuple ltup,
gistentryinserttwo(Relation r, GISTSTACK *stk, IndexTuple ltup,
IndexTuple rtup, GISTSTATE *giststate); IndexTuple rtup, GISTSTATE *giststate);
static void static void gistAdjustKeys(Relation r, GISTSTACK *stk, BlockNumber blk,
gistAdjustKeys(Relation r, GISTSTACK *stk, BlockNumber blk,
char *datum, int att_size, GISTSTATE *giststate); char *datum, int att_size, GISTSTATE *giststate);
static void static void gistintinsert(Relation r, GISTSTACK *stk, IndexTuple ltup,
gistintinsert(Relation r, GISTSTACK *stk, IndexTuple ltup,
IndexTuple rtup, GISTSTATE *giststate); IndexTuple rtup, GISTSTATE *giststate);
static InsertIndexResult static InsertIndexResult gistSplit(Relation r, Buffer buffer,
gistSplit(Relation r, Buffer buffer,
GISTSTACK *stack, IndexTuple itup, GISTSTACK *stack, IndexTuple itup,
GISTSTATE *giststate); GISTSTATE *giststate);
static void static void gistnewroot(GISTSTATE *giststate, Relation r, IndexTuple lt,
gistnewroot(GISTSTATE *giststate, Relation r, IndexTuple lt,
IndexTuple rt); IndexTuple rt);
static void GISTInitBuffer(Buffer b, uint32 f); static void GISTInitBuffer(Buffer b, uint32 f);
static BlockNumber static BlockNumber gistChooseSubtree(Relation r, IndexTuple itup, int level,
gistChooseSubtree(Relation r, IndexTuple itup, int level,
GISTSTATE *giststate, GISTSTATE *giststate,
GISTSTACK **retstack, Buffer *leafbuf); GISTSTACK **retstack, Buffer *leafbuf);
static OffsetNumber static OffsetNumber gistchoose(Relation r, Page p, IndexTuple it,
gistchoose(Relation r, Page p, IndexTuple it,
GISTSTATE *giststate); GISTSTATE *giststate);
static int gistnospace(Page p, IndexTuple it); static int gistnospace(Page p, IndexTuple it);
void gistdelete(Relation r, ItemPointer tid); void gistdelete(Relation r, ItemPointer tid);
static IndexTuple gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t); static IndexTuple gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t);
static void static void gistcentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr,
gistcentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr,
Relation r, Page pg, OffsetNumber o, int b, bool l); Relation r, Page pg, OffsetNumber o, int b, bool l);
static char *int_range_out(INTRANGE *r); static char *int_range_out(INTRANGE *r);
...@@ -169,7 +159,7 @@ gistbuild(Relation heap, ...@@ -169,7 +159,7 @@ gistbuild(Relation heap,
slot = NULL; slot = NULL;
econtext = NULL; econtext = NULL;
} }
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
/* int the tuples as we insert them */ /* int the tuples as we insert them */
nh = ni = 0; nh = ni = 0;
...@@ -193,7 +183,7 @@ gistbuild(Relation heap, ...@@ -193,7 +183,7 @@ gistbuild(Relation heap,
ni++; ni++;
continue; continue;
} }
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
/* /*
...@@ -207,7 +197,7 @@ gistbuild(Relation heap, ...@@ -207,7 +197,7 @@ gistbuild(Relation heap,
slot->val = htup; slot->val = htup;
if (ExecQual((List *) pred, econtext) == false) if (ExecQual((List *) pred, econtext) == false)
continue; continue;
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
ni++; ni++;
...@@ -286,7 +276,7 @@ gistbuild(Relation heap, ...@@ -286,7 +276,7 @@ gistbuild(Relation heap,
#ifndef OMIT_PARTIAL_INDEX #ifndef OMIT_PARTIAL_INDEX
ExecDestroyTupleTable(tupleTable, true); ExecDestroyTupleTable(tupleTable, true);
pfree(econtext); pfree(econtext);
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
/* /*
...@@ -1168,7 +1158,7 @@ initGISTstate(GISTSTATE *giststate, Relation index) ...@@ -1168,7 +1158,7 @@ initGISTstate(GISTSTATE *giststate, Relation index)
itupform = (Form_pg_index) GETSTRUCT(htup); itupform = (Form_pg_index) GETSTRUCT(htup);
if (!HeapTupleIsValid(htup)) if (!HeapTupleIsValid(htup))
elog(ERROR, "initGISTstate: index %d not found", elog(ERROR, "initGISTstate: index %d not found",
RelationGetRelid(index)); RelationGetRelid(index));
giststate->haskeytype = itupform->indhaskeytype; giststate->haskeytype = itupform->indhaskeytype;
if (giststate->haskeytype) if (giststate->haskeytype)
{ {
...@@ -1377,4 +1367,4 @@ int_range_out(INTRANGE *r) ...@@ -1377,4 +1367,4 @@ int_range_out(INTRANGE *r)
return result; return result;
} }
#endif /* defined GISTDEBUG */ #endif /* defined GISTDEBUG */
...@@ -28,15 +28,13 @@ ...@@ -28,15 +28,13 @@
#endif #endif
static OffsetNumber static OffsetNumber gistfindnext(IndexScanDesc s, Page p, OffsetNumber n,
gistfindnext(IndexScanDesc s, Page p, OffsetNumber n,
ScanDirection dir); ScanDirection dir);
static RetrieveIndexResult gistscancache(IndexScanDesc s, ScanDirection dir); static RetrieveIndexResult gistscancache(IndexScanDesc s, ScanDirection dir);
static RetrieveIndexResult gistfirst(IndexScanDesc s, ScanDirection dir); static RetrieveIndexResult gistfirst(IndexScanDesc s, ScanDirection dir);
static RetrieveIndexResult gistnext(IndexScanDesc s, ScanDirection dir); static RetrieveIndexResult gistnext(IndexScanDesc s, ScanDirection dir);
static ItemPointer gistheapptr(Relation r, ItemPointer itemp); static ItemPointer gistheapptr(Relation r, ItemPointer itemp);
static bool static bool gistindex_keytest(IndexTuple tuple, TupleDesc tupdesc,
gistindex_keytest(IndexTuple tuple, TupleDesc tupdesc,
int scanKeySize, ScanKey key, GISTSTATE *giststate, int scanKeySize, ScanKey key, GISTSTATE *giststate,
Relation r, Page p, OffsetNumber offset); Relation r, Page p, OffsetNumber offset);
......
...@@ -29,14 +29,11 @@ ...@@ -29,14 +29,11 @@
/* routines defined and used here */ /* routines defined and used here */
static void gistregscan(IndexScanDesc s); static void gistregscan(IndexScanDesc s);
static void gistdropscan(IndexScanDesc s); static void gistdropscan(IndexScanDesc s);
static void static void gistadjone(IndexScanDesc s, int op, BlockNumber blkno,
gistadjone(IndexScanDesc s, int op, BlockNumber blkno,
OffsetNumber offnum); OffsetNumber offnum);
static void static void adjuststack(GISTSTACK *stk, BlockNumber blkno,
adjuststack(GISTSTACK *stk, BlockNumber blkno,
OffsetNumber offnum); OffsetNumber offnum);
static void static void adjustiptr(IndexScanDesc s, ItemPointer iptr,
adjustiptr(IndexScanDesc s, ItemPointer iptr,
int op, BlockNumber blkno, OffsetNumber offnum); int op, BlockNumber blkno, OffsetNumber offnum);
/* /*
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.21 1998/09/01 03:20:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.22 1998/09/01 04:26:48 momjian Exp $
* *
* NOTES * NOTES
* This file contains only the public interface routines. * This file contains only the public interface routines.
...@@ -118,7 +118,7 @@ hashbuild(Relation heap, ...@@ -118,7 +118,7 @@ hashbuild(Relation heap,
tupleTable = 0; tupleTable = 0;
slot = 0; slot = 0;
} }
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
/* build the index */ /* build the index */
nhtups = nitups = 0; nhtups = nitups = 0;
...@@ -145,7 +145,7 @@ hashbuild(Relation heap, ...@@ -145,7 +145,7 @@ hashbuild(Relation heap,
nitups++; nitups++;
continue; continue;
} }
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
/* /*
...@@ -159,7 +159,7 @@ hashbuild(Relation heap, ...@@ -159,7 +159,7 @@ hashbuild(Relation heap,
slot->val = htup; slot->val = htup;
if (ExecQual((List *) pred, econtext) == false) if (ExecQual((List *) pred, econtext) == false)
continue; continue;
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
nitups++; nitups++;
...@@ -232,7 +232,7 @@ hashbuild(Relation heap, ...@@ -232,7 +232,7 @@ hashbuild(Relation heap,
#ifndef OMIT_PARTIAL_INDEX #ifndef OMIT_PARTIAL_INDEX
ExecDestroyTupleTable(tupleTable, true); ExecDestroyTupleTable(tupleTable, true);
pfree(econtext); pfree(econtext);
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
/* /*
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.11 1998/09/01 03:20:54 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.12 1998/09/01 04:26:49 momjian Exp $
* *
* NOTES * NOTES
* These functions are stored in pg_amproc. For each operator class * These functions are stored in pg_amproc. For each operator class
...@@ -136,11 +136,11 @@ hashoid(Oid key) ...@@ -136,11 +136,11 @@ hashoid(Oid key)
uint32 uint32
hashoid8(Oid *key) hashoid8(Oid *key)
{ {
int i; int i;
uint32 result = 0; uint32 result = 0;
for (i=0; i < 8; i++) for (i = 0; i < 8; i++)
result = result ^ (~(uint32)key[i]); result = result ^ (~(uint32) key[i]);
return result; return result;
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.34 1998/09/01 03:21:05 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.35 1998/09/01 04:26:51 momjian Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -109,10 +109,10 @@ static bool ImmediateInvalidation; ...@@ -109,10 +109,10 @@ static bool ImmediateInvalidation;
*/ */
static void static void
initscan(HeapScanDesc scan, initscan(HeapScanDesc scan,
Relation relation, Relation relation,
int atend, int atend,
unsigned nkeys, unsigned nkeys,
ScanKey key) ScanKey key)
{ {
if (!RelationGetNumberOfBlocks(relation)) if (!RelationGetNumberOfBlocks(relation))
{ {
...@@ -258,7 +258,7 @@ heapgettup(Relation relation, ...@@ -258,7 +258,7 @@ heapgettup(Relation relation,
elog(DEBUG, "heapgettup: relation(%c)=`%s', %p", elog(DEBUG, "heapgettup: relation(%c)=`%s', %p",
relation->rd_rel->relkind, &relation->rd_rel->relname, relation->rd_rel->relkind, &relation->rd_rel->relname,
snapshot); snapshot);
#endif /* !defined(HEAPDEBUGALL) */ #endif /* !defined(HEAPDEBUGALL) */
if (!ItemPointerIsValid(tid)) if (!ItemPointerIsValid(tid))
Assert(!PointerIsValid(tid)); Assert(!PointerIsValid(tid));
...@@ -283,12 +283,12 @@ heapgettup(Relation relation, ...@@ -283,12 +283,12 @@ heapgettup(Relation relation,
/* assume it is a valid TID XXX */ /* assume it is a valid TID XXX */
if (ItemPointerIsValid(tid) == false) if (ItemPointerIsValid(tid) == false)
{ {
*buf= InvalidBuffer; *buf = InvalidBuffer;
return NULL; return NULL;
} }
*buf = RelationGetBufferWithBuffer(relation, *buf = RelationGetBufferWithBuffer(relation,
ItemPointerGetBlockNumber(tid), ItemPointerGetBlockNumber(tid),
*buf); *buf);
#ifndef NO_BUFFERISVALID #ifndef NO_BUFFERISVALID
if (!BufferIsValid(*buf)) if (!BufferIsValid(*buf))
...@@ -414,6 +414,7 @@ heapgettup(Relation relation, ...@@ -414,6 +414,7 @@ heapgettup(Relation relation,
if (ItemPointerGetBlockNumber(iptr) != page) if (ItemPointerGetBlockNumber(iptr) != page)
{ {
/* /*
* set block id to the correct page number --- this is * set block id to the correct page number --- this is
* a hack to support the virtual fragment concept * a hack to support the virtual fragment concept
...@@ -762,7 +763,7 @@ elog(DEBUG, "heap_getnext([%s,nkeys=%d],backw=%d) called", \ ...@@ -762,7 +763,7 @@ elog(DEBUG, "heap_getnext([%s,nkeys=%d],backw=%d) called", \
#define HEAPDEBUG_5 #define HEAPDEBUG_5
#define HEAPDEBUG_6 #define HEAPDEBUG_6
#define HEAPDEBUG_7 #define HEAPDEBUG_7
#endif /* !defined(HEAPDEBUGALL) */ #endif /* !defined(HEAPDEBUGALL) */
HeapTuple HeapTuple
...@@ -990,7 +991,7 @@ heap_getnext(HeapScanDesc scandesc, int backw) ...@@ -990,7 +991,7 @@ heap_getnext(HeapScanDesc scandesc, int backw)
* value, and they are required to BuffferRelease() it when they * value, and they are required to BuffferRelease() it when they
* are done. If they want to make a copy of it before releasing it, * are done. If they want to make a copy of it before releasing it,
* they can call heap_copytyple(). * they can call heap_copytyple().
* ---------------- * ----------------
*/ */
HeapTuple HeapTuple
...@@ -1005,8 +1006,8 @@ heap_fetch(Relation relation, ...@@ -1005,8 +1006,8 @@ heap_fetch(Relation relation,
HeapTuple tuple; HeapTuple tuple;
OffsetNumber offnum; OffsetNumber offnum;
AssertMacro(PointerIsValid(userbuf)); /* see comments above */ AssertMacro(PointerIsValid(userbuf)); /* see comments above */
/* ---------------- /* ----------------
* increment access statistics * increment access statistics
* ---------------- * ----------------
...@@ -1074,7 +1075,8 @@ heap_fetch(Relation relation, ...@@ -1074,7 +1075,8 @@ heap_fetch(Relation relation,
* ---------------- * ----------------
*/ */
*userbuf = buffer; /* user is required to ReleaseBuffer() this */ *userbuf = buffer; /* user is required to ReleaseBuffer()
* this */
return tuple; return tuple;
} }
...@@ -1193,7 +1195,7 @@ heap_delete(Relation relation, ItemPointer tid) ...@@ -1193,7 +1195,7 @@ heap_delete(Relation relation, ItemPointer tid)
{ /* XXX L_SH better ??? */ { /* XXX L_SH better ??? */
elog(ERROR, "heap_delete: failed ReadBuffer"); elog(ERROR, "heap_delete: failed ReadBuffer");
} }
#endif /* NO_BUFFERISVALID */ #endif /* NO_BUFFERISVALID */
dp = (PageHeader) BufferGetPage(buf); dp = (PageHeader) BufferGetPage(buf);
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(tid)); lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(tid));
...@@ -1206,10 +1208,11 @@ heap_delete(Relation relation, ItemPointer tid) ...@@ -1206,10 +1208,11 @@ heap_delete(Relation relation, ItemPointer tid)
Assert(HeapTupleIsValid(tp)); Assert(HeapTupleIsValid(tp));
if (TupleUpdatedByCurXactAndCmd(tp)) if (TupleUpdatedByCurXactAndCmd(tp))
{ {
/* /*
Vadim says this is no longer needed 1998/6/15 * Vadim says this is no longer needed 1998/6/15 elog(NOTICE,
elog(NOTICE, "Non-functional delete, tuple already deleted"); * "Non-functional delete, tuple already deleted");
*/ */
if (IsSystemRelationName(RelationGetRelationName(relation)->data)) if (IsSystemRelationName(RelationGetRelationName(relation)->data))
RelationUnsetLockForWrite(relation); RelationUnsetLockForWrite(relation);
ReleaseBuffer(buf); ReleaseBuffer(buf);
...@@ -1309,7 +1312,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple replace_tuple) ...@@ -1309,7 +1312,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple replace_tuple)
/* XXX L_SH better ??? */ /* XXX L_SH better ??? */
elog(ERROR, "amreplace: failed ReadBuffer"); elog(ERROR, "amreplace: failed ReadBuffer");
} }
#endif /* NO_BUFFERISVALID */ #endif /* NO_BUFFERISVALID */
dp = (Page) BufferGetPage(buffer); dp = (Page) BufferGetPage(buffer);
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(otid)); lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(otid));
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.24 1998/09/01 03:21:09 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.25 1998/09/01 04:26:55 momjian Exp $
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
* index_open - open an index relation by relationId * index_open - open an index relation by relationId
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
CppAsString(x), CppAsString(y)) \ CppAsString(x), CppAsString(y)) \
: (void)NULL \ : (void)NULL \
) )
#define GET_SCAN_PROCEDURE(x,y) \ #define GET_SCAN_PROCEDURE(x,y) \
( \ ( \
procedure = scan->relation->rd_am->y, \ procedure = scan->relation->rd_am->y, \
...@@ -331,7 +331,7 @@ index_getnext(IndexScanDesc scan, ...@@ -331,7 +331,7 @@ index_getnext(IndexScanDesc scan,
* have the am's gettuple proc do all the work. * have the am's gettuple proc do all the work.
* ---------------- * ----------------
*/ */
result = (RetrieveIndexResult)fmgr(procedure, scan, direction); result = (RetrieveIndexResult) fmgr(procedure, scan, direction);
return result; return result;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.27 1998/09/01 03:21:10 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.28 1998/09/01 04:26:56 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -29,16 +29,13 @@ ...@@ -29,16 +29,13 @@
#ifdef USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
static bool StrategyEvaluationIsValid(StrategyEvaluation evaluation); static bool StrategyEvaluationIsValid(StrategyEvaluation evaluation);
static bool static bool StrategyExpressionIsValid(StrategyExpression expression,
StrategyExpressionIsValid(StrategyExpression expression,
StrategyNumber maxStrategy); StrategyNumber maxStrategy);
static ScanKey StrategyMapGetScanKeyEntry(StrategyMap map, static ScanKey StrategyMapGetScanKeyEntry(StrategyMap map,
StrategyNumber strategyNumber); StrategyNumber strategyNumber);
static bool static bool StrategyOperatorIsValid(StrategyOperator operator,
StrategyOperatorIsValid(StrategyOperator operator,
StrategyNumber maxStrategy); StrategyNumber maxStrategy);
static bool static bool StrategyTermIsValid(StrategyTerm term,
StrategyTermIsValid(StrategyTerm term,
StrategyNumber maxStrategy); StrategyNumber maxStrategy);
#endif #endif
...@@ -378,8 +375,8 @@ RelationInvokeStrategy(Relation relation, ...@@ -378,8 +375,8 @@ RelationInvokeStrategy(Relation relation,
termData.degree = 1; termData.degree = 1;
strategyMap = IndexStrategyGetStrategyMap(RelationGetIndexStrategy(relation), strategyMap = IndexStrategyGetStrategyMap(RelationGetIndexStrategy(relation),
evaluation->maxStrategy, evaluation->maxStrategy,
attributeNumber); attributeNumber);
entry = StrategyMapGetScanKeyEntry(strategyMap, strategy); entry = StrategyMapGetScanKeyEntry(strategyMap, strategy);
...@@ -456,9 +453,7 @@ RelationInvokeStrategy(Relation relation, ...@@ -456,9 +453,7 @@ RelationInvokeStrategy(Relation relation,
} }
if (index == (*termP)->degree) if (index == (*termP)->degree)
{
return StrategyTermEvaluate(*termP, strategyMap, left, right); return StrategyTermEvaluate(*termP, strategyMap, left, right);
}
termP += 1; termP += 1;
} }
...@@ -494,7 +489,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation, ...@@ -494,7 +489,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
else else
{ {
ScanKeyData scanKeyData; ScanKeyData scanKeyData;
ScanKeyEntryInitialize(&scanKeyData, 0, ScanKeyEntryInitialize(&scanKeyData, 0,
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
F_OIDEQ, F_OIDEQ,
...@@ -502,7 +497,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation, ...@@ -502,7 +497,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
scan = heap_beginscan(operatorRelation, false, SnapshotNow, scan = heap_beginscan(operatorRelation, false, SnapshotNow,
1, &scanKeyData); 1, &scanKeyData);
tuple = heap_getnext(scan, 0); tuple = heap_getnext(scan, 0);
} }
...@@ -521,7 +516,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation, ...@@ -521,7 +516,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
if (IsBootstrapProcessingMode()) if (IsBootstrapProcessingMode())
heap_endscan(scan); heap_endscan(scan);
if (!RegProcedureIsValid(entry->sk_procedure)) if (!RegProcedureIsValid(entry->sk_procedure))
{ {
elog(ERROR, elog(ERROR,
...@@ -565,7 +560,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy, ...@@ -565,7 +560,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
ScanKeyEntryInitialize(&entry[0], 0, Anum_pg_index_indexrelid, ScanKeyEntryInitialize(&entry[0], 0, Anum_pg_index_indexrelid,
F_OIDEQ, F_OIDEQ,
ObjectIdGetDatum(indexObjectId)); ObjectIdGetDatum(indexObjectId));
relation = heap_openr(IndexRelationName); relation = heap_openr(IndexRelationName);
scan = heap_beginscan(relation, false, SnapshotNow, 1, entry); scan = heap_beginscan(relation, false, SnapshotNow, 1, entry);
tuple = heap_getnext(scan, 0); tuple = heap_getnext(scan, 0);
...@@ -601,7 +596,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy, ...@@ -601,7 +596,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
heap_endscan(scan); heap_endscan(scan);
heap_close(relation); heap_close(relation);
} }
/* if support routines exist for this access method, load them */ /* if support routines exist for this access method, load them */
if (maxSupportNumber > 0) if (maxSupportNumber > 0)
{ {
...@@ -615,7 +610,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy, ...@@ -615,7 +610,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
relation = heap_openr(AccessMethodProcedureRelationName); relation = heap_openr(AccessMethodProcedureRelationName);
for (attributeNumber = 1; attributeNumber <= maxAttributeNumber; for (attributeNumber = 1; attributeNumber <= maxAttributeNumber;
attributeNumber++) attributeNumber++)
{ {
int16 support; int16 support;
Form_pg_amproc form; Form_pg_amproc form;
...@@ -723,4 +718,4 @@ IndexStrategyDisplay(IndexStrategy indexStrategy, ...@@ -723,4 +718,4 @@ IndexStrategyDisplay(IndexStrategy indexStrategy,
} }
} }
#endif /* defined(ISTRATDEBUG) */ #endif /* defined(ISTRATDEBUG) */
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.18 1998/09/01 03:21:12 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.19 1998/09/01 04:26:59 momjian Exp $
* *
* NOTES * NOTES
* These functions are stored in pg_amproc. For each operator class * These functions are stored in pg_amproc. For each operator class
...@@ -87,10 +87,11 @@ btoidcmp(Oid a, Oid b) ...@@ -87,10 +87,11 @@ btoidcmp(Oid a, Oid b)
int32 int32
btoid8cmp(Oid *a, Oid *b) btoid8cmp(Oid *a, Oid *b)
{ {
int i; int i;
for (i=0; i < 8; i++)
for (i = 0; i < 8; i++)
/* we use this because we need the int4gt, etc */ /* we use this because we need the int4gt, etc */
if (!int4eq(a[i], b[i])) if (!int4eq(a[i], b[i]))
if (int4gt(a[i], b[i])) if (int4gt(a[i], b[i]))
return 1; return 1;
else else
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.29 1998/09/01 03:21:13 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.30 1998/09/01 04:27:01 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -54,7 +54,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel ...@@ -54,7 +54,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
int natts = rel->rd_rel->relnatts; int natts = rel->rd_rel->relnatts;
InsertIndexResult res; InsertIndexResult res;
Buffer buffer; Buffer buffer;
itup = &(btitem->bti_itup); itup = &(btitem->bti_itup);
/* we need a scan key to do our search, so build one */ /* we need a scan key to do our search, so build one */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.31 1998/09/01 03:21:16 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.32 1998/09/01 04:27:03 momjian Exp $
* *
* NOTES * NOTES
* This file contains only the public interface routines. * This file contains only the public interface routines.
...@@ -44,7 +44,7 @@ bool BuildingBtree = false; /* see comment in btbuild() */ ...@@ -44,7 +44,7 @@ bool BuildingBtree = false; /* see comment in btbuild() */
bool FastBuild = true; /* use sort/build instead of insertion bool FastBuild = true; /* use sort/build instead of insertion
* build */ * build */
static void _bt_restscan(IndexScanDesc scan); static void _bt_restscan(IndexScanDesc scan);
/* /*
* btbuild() -- build a new btree index. * btbuild() -- build a new btree index.
...@@ -151,7 +151,7 @@ btbuild(Relation heap, ...@@ -151,7 +151,7 @@ btbuild(Relation heap,
*/ */
usefast = false; usefast = false;
} }
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
/* start a heap scan */ /* start a heap scan */
/* build the index */ /* build the index */
...@@ -184,7 +184,7 @@ btbuild(Relation heap, ...@@ -184,7 +184,7 @@ btbuild(Relation heap,
nitups++; nitups++;
continue; continue;
} }
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
/* /*
...@@ -198,7 +198,7 @@ btbuild(Relation heap, ...@@ -198,7 +198,7 @@ btbuild(Relation heap,
slot->val = htup; slot->val = htup;
if (ExecQual((List *) pred, econtext) == false) if (ExecQual((List *) pred, econtext) == false)
continue; continue;
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
nitups++; nitups++;
...@@ -283,7 +283,7 @@ btbuild(Relation heap, ...@@ -283,7 +283,7 @@ btbuild(Relation heap,
#ifndef OMIT_PARTIAL_INDEX #ifndef OMIT_PARTIAL_INDEX
ExecDestroyTupleTable(tupleTable, true); ExecDestroyTupleTable(tupleTable, true);
pfree(econtext); pfree(econtext);
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
/* /*
...@@ -361,14 +361,13 @@ btinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation ...@@ -361,14 +361,13 @@ btinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation
/* /*
* See comments in btbuild. * See comments in btbuild.
* *
* if (itup->t_info & INDEX_NULL_MASK) * if (itup->t_info & INDEX_NULL_MASK) return (InsertIndexResult) NULL;
return (InsertIndexResult) NULL;
*/ */
btitem = _bt_formitem(itup); btitem = _bt_formitem(itup);
res = _bt_doinsert(rel, btitem, res = _bt_doinsert(rel, btitem,
IndexIsUnique(RelationGetRelid(rel)), heapRel); IndexIsUnique(RelationGetRelid(rel)), heapRel);
pfree(btitem); pfree(btitem);
pfree(itup); pfree(itup);
...@@ -397,27 +396,26 @@ btgettuple(IndexScanDesc scan, ScanDirection dir) ...@@ -397,27 +396,26 @@ btgettuple(IndexScanDesc scan, ScanDirection dir)
if (ItemPointerIsValid(&(scan->currentItemData))) if (ItemPointerIsValid(&(scan->currentItemData)))
{ {
/* /*
* Now we don't adjust scans on insertion (comments in * Now we don't adjust scans on insertion (comments in
* nbtscan.c:_bt_scandel()) and I hope that we will unlock * nbtscan.c:_bt_scandel()) and I hope that we will unlock current
* current index page before leaving index in LLL: this * index page before leaving index in LLL: this means that current
* means that current index tuple could be moved right * index tuple could be moved right before we get here and we have
* before we get here and we have to restore our scan * to restore our scan position. We save heap TID pointed by
* position. We save heap TID pointed by current index * current index tuple and use it. This will work untill we start
* tuple and use it. This will work untill we start * to re-use (move heap tuples) without vacuum... - vadim 07/29/98
* to re-use (move heap tuples) without vacuum...
* - vadim 07/29/98
*/ */
_bt_restscan(scan); _bt_restscan(scan);
res = _bt_next(scan, dir); res = _bt_next(scan, dir);
} }
else else
res = _bt_first(scan, dir); res = _bt_first(scan, dir);
/* Save heap TID to use it in _bt_restscan */ /* Save heap TID to use it in _bt_restscan */
if (res) if (res)
((BTScanOpaque)scan->opaque)->curHeapIptr = res->heap_iptr; ((BTScanOpaque) scan->opaque)->curHeapIptr = res->heap_iptr;
return (char *) res; return (char *) res;
} }
...@@ -627,33 +625,34 @@ btdelete(Relation rel, ItemPointer tid) ...@@ -627,33 +625,34 @@ btdelete(Relation rel, ItemPointer tid)
static void static void
_bt_restscan(IndexScanDesc scan) _bt_restscan(IndexScanDesc scan)
{ {
Relation rel = scan->relation; Relation rel = scan->relation;
BTScanOpaque so = (BTScanOpaque) scan->opaque; BTScanOpaque so = (BTScanOpaque) scan->opaque;
Buffer buf = so->btso_curbuf; Buffer buf = so->btso_curbuf;
Page page = BufferGetPage(buf); Page page = BufferGetPage(buf);
ItemPointer current = &(scan->currentItemData); ItemPointer current = &(scan->currentItemData);
OffsetNumber offnum = ItemPointerGetOffsetNumber(current), OffsetNumber offnum = ItemPointerGetOffsetNumber(current),
maxoff = PageGetMaxOffsetNumber(page); maxoff = PageGetMaxOffsetNumber(page);
BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page); BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page);
ItemPointerData target = so->curHeapIptr; ItemPointerData target = so->curHeapIptr;
BTItem item; BTItem item;
BlockNumber blkno; BlockNumber blkno;
if (maxoff >= offnum) if (maxoff >= offnum)
{ {
/*
* if the item is where we left it or has just moved right /*
* on this page, we're done * if the item is where we left it or has just moved right on this
* page, we're done
*/ */
for ( ; for (;
offnum <= maxoff; offnum <= maxoff;
offnum = OffsetNumberNext(offnum)) offnum = OffsetNumberNext(offnum))
{ {
item = (BTItem) PageGetItem(page, PageGetItemId(page, offnum)); item = (BTItem) PageGetItem(page, PageGetItemId(page, offnum));
if (item->bti_itup.t_tid.ip_blkid.bi_hi == \ if (item->bti_itup.t_tid.ip_blkid.bi_hi == \
target.ip_blkid.bi_hi && \ target.ip_blkid.bi_hi && \
item->bti_itup.t_tid.ip_blkid.bi_lo == \ item->bti_itup.t_tid.ip_blkid.bi_lo == \
target.ip_blkid.bi_lo && \ target.ip_blkid.bi_lo && \
item->bti_itup.t_tid.ip_posid == target.ip_posid) item->bti_itup.t_tid.ip_posid == target.ip_posid)
{ {
current->ip_posid = offnum; current->ip_posid = offnum;
...@@ -662,8 +661,8 @@ _bt_restscan(IndexScanDesc scan) ...@@ -662,8 +661,8 @@ _bt_restscan(IndexScanDesc scan)
} }
} }
/* /*
* By here, the item we're looking for moved right at least one page * By here, the item we're looking for moved right at least one page
*/ */
for (;;) for (;;)
{ {
...@@ -678,15 +677,15 @@ _bt_restscan(IndexScanDesc scan) ...@@ -678,15 +677,15 @@ _bt_restscan(IndexScanDesc scan)
opaque = (BTPageOpaque) PageGetSpecialPointer(page); opaque = (BTPageOpaque) PageGetSpecialPointer(page);
/* see if it's on this page */ /* see if it's on this page */
for (offnum = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY ; for (offnum = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
offnum <= maxoff; offnum <= maxoff;
offnum = OffsetNumberNext(offnum)) offnum = OffsetNumberNext(offnum))
{ {
item = (BTItem) PageGetItem(page, PageGetItemId(page, offnum)); item = (BTItem) PageGetItem(page, PageGetItemId(page, offnum));
if (item->bti_itup.t_tid.ip_blkid.bi_hi == \ if (item->bti_itup.t_tid.ip_blkid.bi_hi == \
target.ip_blkid.bi_hi && \ target.ip_blkid.bi_hi && \
item->bti_itup.t_tid.ip_blkid.bi_lo == \ item->bti_itup.t_tid.ip_blkid.bi_lo == \
target.ip_blkid.bi_lo && \ target.ip_blkid.bi_lo && \
item->bti_itup.t_tid.ip_posid == target.ip_posid) item->bti_itup.t_tid.ip_posid == target.ip_posid)
{ {
ItemPointerSet(current, blkno, offnum); ItemPointerSet(current, blkno, offnum);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.17 1998/09/01 03:21:17 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.18 1998/09/01 04:27:04 momjian Exp $
* *
* *
* NOTES * NOTES
...@@ -166,10 +166,10 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno) ...@@ -166,10 +166,10 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
so->btso_curbuf = buf; so->btso_curbuf = buf;
if (ItemPointerIsValid(current)) if (ItemPointerIsValid(current))
{ {
Page page = BufferGetPage(buf); Page page = BufferGetPage(buf);
BTItem btitem = (BTItem) PageGetItem(page, BTItem btitem = (BTItem) PageGetItem(page,
PageGetItemId(page, ItemPointerGetOffsetNumber(current))); PageGetItemId(page, ItemPointerGetOffsetNumber(current)));
so->curHeapIptr = btitem->bti_itup.t_tid; so->curHeapIptr = btitem->bti_itup.t_tid;
} }
} }
...@@ -209,10 +209,10 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno) ...@@ -209,10 +209,10 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
scan->currentItemData = tmp; scan->currentItemData = tmp;
if (ItemPointerIsValid(current)) if (ItemPointerIsValid(current))
{ {
Page page = BufferGetPage(buf); Page page = BufferGetPage(buf);
BTItem btitem = (BTItem) PageGetItem(page, BTItem btitem = (BTItem) PageGetItem(page,
PageGetItemId(page, ItemPointerGetOffsetNumber(current))); PageGetItemId(page, ItemPointerGetOffsetNumber(current)));
so->mrkHeapIptr = btitem->bti_itup.t_tid; so->mrkHeapIptr = btitem->bti_itup.t_tid;
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.37 1998/09/01 03:21:18 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.38 1998/09/01 04:27:06 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -28,14 +28,11 @@ ...@@ -28,14 +28,11 @@
#endif #endif
static BTStack static BTStack _bt_searchr(Relation rel, int keysz, ScanKey scankey,
_bt_searchr(Relation rel, int keysz, ScanKey scankey,
Buffer *bufP, BTStack stack_in); Buffer *bufP, BTStack stack_in);
static OffsetNumber static OffsetNumber _bt_firsteq(Relation rel, TupleDesc itupdesc, Page page,
_bt_firsteq(Relation rel, TupleDesc itupdesc, Page page,
Size keysz, ScanKey scankey, OffsetNumber offnum); Size keysz, ScanKey scankey, OffsetNumber offnum);
static int static int _bt_compare(Relation rel, TupleDesc itupdesc, Page page,
_bt_compare(Relation rel, TupleDesc itupdesc, Page page,
int keysz, ScanKey scankey, OffsetNumber offnum); int keysz, ScanKey scankey, OffsetNumber offnum);
static bool static bool
_bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir); _bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir);
...@@ -219,8 +216,8 @@ _bt_moveright(Relation rel, ...@@ -219,8 +216,8 @@ _bt_moveright(Relation rel,
if (_bt_skeycmp(rel, keysz, scankey, page, if (_bt_skeycmp(rel, keysz, scankey, page,
PageGetItemId(page, P_FIRSTKEY), PageGetItemId(page, P_FIRSTKEY),
BTEqualStrategyNumber)) BTEqualStrategyNumber))
elog(FATAL, "btree: BTP_CHAIN flag was expected in %s (access = %s)", elog(FATAL, "btree: BTP_CHAIN flag was expected in %s (access = %s)",
rel->rd_rel->relname, access ? "bt_write" : "bt_read"); rel->rd_rel->relname, access ? "bt_write" : "bt_read");
if (_bt_skeycmp(rel, keysz, scankey, page, if (_bt_skeycmp(rel, keysz, scankey, page,
PageGetItemId(page, offmax), PageGetItemId(page, offmax),
BTEqualStrategyNumber)) BTEqualStrategyNumber))
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Id: nbtsort.c,v 1.32 1998/09/01 03:21:19 momjian Exp $ * $Id: nbtsort.c,v 1.33 1998/09/01 04:27:07 momjian Exp $
* *
* NOTES * NOTES
* *
...@@ -184,7 +184,7 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2) ...@@ -184,7 +184,7 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2)
return 1; /* 1 > 2 */ return 1; /* 1 > 2 */
} }
else if (k2->btsk_item == (BTItem) NULL) else if (k2->btsk_item == (BTItem) NULL)
return -1; /* 1 < 2 */ return -1; /* 1 < 2 */
for (i = 0; i < _bt_nattr; i++) for (i = 0; i < _bt_nattr; i++)
{ {
...@@ -198,14 +198,14 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2) ...@@ -198,14 +198,14 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2)
return 1; /* NULL ">" NOT_NULL */ return 1; /* NULL ">" NOT_NULL */
} }
else if (k2_nulls[i] != ' ') /* k2 attr is NULL */ else if (k2_nulls[i] != ' ') /* k2 attr is NULL */
return -1; /* NOT_NULL "<" NULL */ return -1; /* NOT_NULL "<" NULL */
if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber, if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber,
k1_datum[i], k2_datum[i])) k1_datum[i], k2_datum[i]))
return 1; /* 1 > 2 */ return 1; /* 1 > 2 */
else if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber, else if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber,
k2_datum[i], k1_datum[i])) k2_datum[i], k1_datum[i]))
return -1; /* 1 < 2 */ return -1; /* 1 < 2 */
} }
if (_bt_inspool->isunique && !equal_isnull) if (_bt_inspool->isunique && !equal_isnull)
...@@ -731,7 +731,7 @@ _bt_spool(Relation index, BTItem btitem, void *spool) ...@@ -731,7 +731,7 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
printf("_bt_spool: inserted <%x> into output tape %d\n", printf("_bt_spool: inserted <%x> into output tape %d\n",
d, btspool->bts_tape); d, btspool->bts_tape);
} }
#endif /* FASTBUILD_DEBUG && FASTBUILD_SPOOL */ #endif /* FASTBUILD_DEBUG && FASTBUILD_SPOOL */
} }
/* /*
...@@ -975,7 +975,7 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags) ...@@ -975,7 +975,7 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
printf("_bt_buildadd: moved <%x> to offset %d at level %d\n", printf("_bt_buildadd: moved <%x> to offset %d at level %d\n",
d, n, state->btps_level); d, n, state->btps_level);
} }
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */ #endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
#endif #endif
} }
...@@ -1058,7 +1058,7 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags) ...@@ -1058,7 +1058,7 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
printf("_bt_buildadd: inserted <%x> at offset %d at level %d\n", printf("_bt_buildadd: inserted <%x> at offset %d at level %d\n",
d, off, state->btps_level); d, off, state->btps_level);
} }
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */ #endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
#endif #endif
if (last_bti == (BTItem) NULL) if (last_bti == (BTItem) NULL)
first_off = P_FIRSTKEY; first_off = P_FIRSTKEY;
...@@ -1254,7 +1254,7 @@ _bt_merge(Relation index, BTSpool *btspool) ...@@ -1254,7 +1254,7 @@ _bt_merge(Relation index, BTSpool *btspool)
npass, nruns, d, t, npass, nruns, d, t,
BufferGetBlockNumber(state->btps_buf)); BufferGetBlockNumber(state->btps_buf));
} }
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */ #endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
} }
else else
{ {
...@@ -1283,7 +1283,7 @@ _bt_merge(Relation index, BTSpool *btspool) ...@@ -1283,7 +1283,7 @@ _bt_merge(Relation index, BTSpool *btspool)
npass, nruns, d, t, npass, nruns, d, t,
btspool->bts_tape); btspool->bts_tape);
} }
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */ #endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
} }
if (btsk.btsk_datum != (Datum *) NULL) if (btsk.btsk_datum != (Datum *) NULL)
...@@ -1408,7 +1408,7 @@ _bt_upperbuild(Relation index) ...@@ -1408,7 +1408,7 @@ _bt_upperbuild(Relation index)
printf("_bt_upperbuild: inserting <%x> at %d\n", printf("_bt_upperbuild: inserting <%x> at %d\n",
d, state->btps_level); d, state->btps_level);
} }
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */ #endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
_bt_buildadd(index, state, nbti, 0); _bt_buildadd(index, state, nbti, 0);
pfree((void *) nbti); pfree((void *) nbti);
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.11 1998/09/01 03:21:24 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.12 1998/09/01 04:27:09 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
#endif #endif
static OffsetNumber static OffsetNumber findnext(IndexScanDesc s, Page p, OffsetNumber n,
findnext(IndexScanDesc s, Page p, OffsetNumber n,
ScanDirection dir); ScanDirection dir);
static RetrieveIndexResult rtscancache(IndexScanDesc s, ScanDirection dir); static RetrieveIndexResult rtscancache(IndexScanDesc s, ScanDirection dir);
static RetrieveIndexResult rtfirst(IndexScanDesc s, ScanDirection dir); static RetrieveIndexResult rtfirst(IndexScanDesc s, ScanDirection dir);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.27 1998/09/01 03:21:27 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.28 1998/09/01 04:27:10 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -50,25 +50,19 @@ typedef struct RTSTATE ...@@ -50,25 +50,19 @@ typedef struct RTSTATE
} RTSTATE; } RTSTATE;
/* non-export function prototypes */ /* non-export function prototypes */
static InsertIndexResult static InsertIndexResult rtdoinsert(Relation r, IndexTuple itup,
rtdoinsert(Relation r, IndexTuple itup,
RTSTATE *rtstate); RTSTATE *rtstate);
static void static void rttighten(Relation r, RTSTACK *stk, char *datum, int att_size,
rttighten(Relation r, RTSTACK *stk, char *datum, int att_size,
RTSTATE *rtstate); RTSTATE *rtstate);
static InsertIndexResult static InsertIndexResult dosplit(Relation r, Buffer buffer, RTSTACK *stack,
dosplit(Relation r, Buffer buffer, RTSTACK *stack,
IndexTuple itup, RTSTATE *rtstate); IndexTuple itup, RTSTATE *rtstate);
static void static void rtintinsert(Relation r, RTSTACK *stk, IndexTuple ltup,
rtintinsert(Relation r, RTSTACK *stk, IndexTuple ltup,
IndexTuple rtup, RTSTATE *rtstate); IndexTuple rtup, RTSTATE *rtstate);
static void rtnewroot(Relation r, IndexTuple lt, IndexTuple rt); static void rtnewroot(Relation r, IndexTuple lt, IndexTuple rt);
static void static void picksplit(Relation r, Page page, SPLITVEC *v, IndexTuple itup,
picksplit(Relation r, Page page, SPLITVEC *v, IndexTuple itup,
RTSTATE *rtstate); RTSTATE *rtstate);
static void RTInitBuffer(Buffer b, uint32 f); static void RTInitBuffer(Buffer b, uint32 f);
static OffsetNumber static OffsetNumber choose(Relation r, Page p, IndexTuple it,
choose(Relation r, Page p, IndexTuple it,
RTSTATE *rtstate); RTSTATE *rtstate);
static int nospace(Page p, IndexTuple it); static int nospace(Page p, IndexTuple it);
static void initRtstate(RTSTATE *rtstate, Relation index); static void initRtstate(RTSTATE *rtstate, Relation index);
...@@ -163,12 +157,12 @@ rtbuild(Relation heap, ...@@ -163,12 +157,12 @@ rtbuild(Relation heap,
tupleTable = NULL; tupleTable = NULL;
slot = NULL; slot = NULL;
} }
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
/* count the tuples as we insert them */ /* count the tuples as we insert them */
nh = ni = 0; nh = ni = 0;
scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL); scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
while (HeapTupleIsValid(htup = heap_getnext(scan, 0))) while (HeapTupleIsValid(htup = heap_getnext(scan, 0)))
{ {
...@@ -188,7 +182,7 @@ rtbuild(Relation heap, ...@@ -188,7 +182,7 @@ rtbuild(Relation heap,
ni++; ni++;
continue; continue;
} }
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
/* /*
...@@ -202,7 +196,7 @@ rtbuild(Relation heap, ...@@ -202,7 +196,7 @@ rtbuild(Relation heap,
slot->val = htup; slot->val = htup;
if (ExecQual((List *) pred, econtext) == false) if (ExecQual((List *) pred, econtext) == false)
continue; continue;
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
ni++; ni++;
...@@ -263,7 +257,7 @@ rtbuild(Relation heap, ...@@ -263,7 +257,7 @@ rtbuild(Relation heap,
#ifndef OMIT_PARTIAL_INDEX #ifndef OMIT_PARTIAL_INDEX
ExecDestroyTupleTable(tupleTable, true); ExecDestroyTupleTable(tupleTable, true);
pfree(econtext); pfree(econtext);
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
/* /*
...@@ -1042,4 +1036,4 @@ _rtdump(Relation r) ...@@ -1042,4 +1036,4 @@ _rtdump(Relation r)
} }
} }
#endif /* defined RTDEBUG */ #endif /* defined RTDEBUG */
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.18 1998/09/01 03:21:28 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.19 1998/09/01 04:27:12 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -30,14 +30,11 @@ ...@@ -30,14 +30,11 @@
/* routines defined and used here */ /* routines defined and used here */
static void rtregscan(IndexScanDesc s); static void rtregscan(IndexScanDesc s);
static void rtdropscan(IndexScanDesc s); static void rtdropscan(IndexScanDesc s);
static void static void rtadjone(IndexScanDesc s, int op, BlockNumber blkno,
rtadjone(IndexScanDesc s, int op, BlockNumber blkno,
OffsetNumber offnum); OffsetNumber offnum);
static void static void adjuststack(RTSTACK *stk, BlockNumber blkno,
adjuststack(RTSTACK *stk, BlockNumber blkno,
OffsetNumber offnum); OffsetNumber offnum);
static void static void adjustiptr(IndexScanDesc s, ItemPointer iptr,
adjustiptr(IndexScanDesc s, ItemPointer iptr,
int op, BlockNumber blkno, OffsetNumber offnum); int op, BlockNumber blkno, OffsetNumber offnum);
/* /*
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.9 1998/09/01 03:21:30 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.10 1998/09/01 04:27:13 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
#include <access/rtree.h> #include <access/rtree.h>
#include <access/istrat.h> #include <access/istrat.h>
static StrategyNumber static StrategyNumber RelationGetRTStrategy(Relation r,
RelationGetRTStrategy(Relation r,
AttrNumber attnum, RegProcedure proc); AttrNumber attnum, RegProcedure proc);
/* /*
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.18 1998/09/01 03:21:31 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.19 1998/09/01 04:27:15 momjian Exp $
* *
* NOTES * NOTES
* This file contains the high level access-method interface to the * This file contains the high level access-method interface to the
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
static int RecoveryCheckingEnabled(void); static int RecoveryCheckingEnabled(void);
static void TransRecover(Relation logRelation); static void TransRecover(Relation logRelation);
static bool TransactionLogTest(TransactionId transactionId, XidStatus status); static bool TransactionLogTest(TransactionId transactionId, XidStatus status);
static void static void TransactionLogUpdate(TransactionId transactionId,
TransactionLogUpdate(TransactionId transactionId,
XidStatus status); XidStatus status);
/* ---------------- /* ----------------
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.16 1998/01/07 21:02:19 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.17 1998/09/01 04:27:16 momjian Exp $
* *
* NOTES * NOTES
* This file contains support functions for the high * This file contains support functions for the high
...@@ -23,11 +23,9 @@ ...@@ -23,11 +23,9 @@
#include <access/xact.h> #include <access/xact.h>
#include <storage/lmgr.h> #include <storage/lmgr.h>
static XidStatus static XidStatus TransBlockGetXidStatus(Block tblock,
TransBlockGetXidStatus(Block tblock,
TransactionId transactionId); TransactionId transactionId);
static void static void TransBlockSetXidStatus(Block tblock,
TransBlockSetXidStatus(Block tblock,
TransactionId transactionId, XidStatus xstatus); TransactionId transactionId, XidStatus xstatus);
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.16 1998/07/21 06:17:13 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.17 1998/09/01 04:27:18 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -31,7 +31,7 @@ static void VariableRelationPutNextOid(Oid *oidP); ...@@ -31,7 +31,7 @@ static void VariableRelationPutNextOid(Oid *oidP);
*/ */
int OidGenLockId; int OidGenLockId;
VariableCache ShmemVariableCache = NULL; VariableCache ShmemVariableCache = NULL;
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* variable relation query/update routines * variable relation query/update routines
...@@ -292,11 +292,11 @@ GetNewTransactionId(TransactionId *xid) ...@@ -292,11 +292,11 @@ GetNewTransactionId(TransactionId *xid)
} }
SpinAcquire(OidGenLockId); /* not good for concurrency... */ SpinAcquire(OidGenLockId); /* not good for concurrency... */
if (ShmemVariableCache->xid_count == 0) if (ShmemVariableCache->xid_count == 0)
{ {
TransactionId nextid; TransactionId nextid;
VariableRelationGetNextXid(&nextid); VariableRelationGetNextXid(&nextid);
TransactionIdStore(nextid, &(ShmemVariableCache->nextXid)); TransactionIdStore(nextid, &(ShmemVariableCache->nextXid));
ShmemVariableCache->xid_count = VAR_XID_PREFETCH; ShmemVariableCache->xid_count = VAR_XID_PREFETCH;
...@@ -307,7 +307,7 @@ GetNewTransactionId(TransactionId *xid) ...@@ -307,7 +307,7 @@ GetNewTransactionId(TransactionId *xid)
TransactionIdStore(ShmemVariableCache->nextXid, xid); TransactionIdStore(ShmemVariableCache->nextXid, xid);
TransactionIdAdd(&(ShmemVariableCache->nextXid), 1); TransactionIdAdd(&(ShmemVariableCache->nextXid), 1);
(ShmemVariableCache->xid_count)--; (ShmemVariableCache->xid_count)--;
SpinRelease(OidGenLockId); SpinRelease(OidGenLockId);
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.22 1998/09/01 03:21:33 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.23 1998/09/01 04:27:19 momjian Exp $
* *
* NOTES * NOTES
* Transaction aborts can now occur two ways: * Transaction aborts can now occur two ways:
...@@ -898,7 +898,7 @@ CommitTransaction() ...@@ -898,7 +898,7 @@ CommitTransaction()
* ---------------- * ----------------
*/ */
/* handle commit for large objects [ PA, 7/17/98 ] */ /* handle commit for large objects [ PA, 7/17/98 ] */
_lo_commit(); _lo_commit();
CloseSequences(); CloseSequences();
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.50 1998/09/01 03:21:36 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.51 1998/09/01 04:27:21 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -325,7 +325,8 @@ BootstrapMain(int argc, char *argv[]) ...@@ -325,7 +325,8 @@ BootstrapMain(int argc, char *argv[])
DataDir = optarg; DataDir = optarg;
break; break;
case 'd': case 'd':
DebugMode = true; /* print out debugging info while parsing */ DebugMode = true; /* print out debugging info while
* parsing */
break; break;
case 'C': case 'C':
Noversion = true; Noversion = true;
...@@ -601,7 +602,7 @@ DefineAttr(char *name, char *type, int attnum) ...@@ -601,7 +602,7 @@ DefineAttr(char *name, char *type, int attnum)
printf("<%s %s> ", attrtypes[attnum]->attname.data, type); printf("<%s %s> ", attrtypes[attnum]->attname.data, type);
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */ attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
attlen = attrtypes[attnum]->attlen = Procid[typeoid].len; attlen = attrtypes[attnum]->attlen = Procid[typeoid].len;
attrtypes[attnum]->attbyval = (attlen == 1) || (attlen == 2) ||(attlen == 4); attrtypes[attnum]->attbyval = (attlen == 1) || (attlen == 2) || (attlen == 4);
attrtypes[attnum]->attalign = 'i'; attrtypes[attnum]->attalign = 'i';
} }
attrtypes[attnum]->attcacheoff = -1; attrtypes[attnum]->attcacheoff = -1;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.15 1998/09/01 03:21:38 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.16 1998/09/01 04:27:27 momjian Exp $
* *
* NOTES * NOTES
* See acl.h. * See acl.h.
...@@ -185,7 +185,7 @@ get_grosysid(char *groname) ...@@ -185,7 +185,7 @@ get_grosysid(char *groname)
tuple = SearchSysCacheTuple(GRONAME, tuple = SearchSysCacheTuple(GRONAME,
PointerGetDatum(groname), PointerGetDatum(groname),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
id = ((Form_pg_group) GETSTRUCT(tuple))->grosysid; id = ((Form_pg_group) GETSTRUCT(tuple))->grosysid;
else else
...@@ -201,7 +201,7 @@ get_groname(AclId grosysid) ...@@ -201,7 +201,7 @@ get_groname(AclId grosysid)
tuple = SearchSysCacheTuple(GROSYSID, tuple = SearchSysCacheTuple(GROSYSID,
ObjectIdGetDatum(grosysid), ObjectIdGetDatum(grosysid),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
name = (((Form_pg_group) GETSTRUCT(tuple))->groname).data; name = (((Form_pg_group) GETSTRUCT(tuple))->groname).data;
else else
...@@ -229,13 +229,13 @@ in_group(AclId uid, AclId gid) ...@@ -229,13 +229,13 @@ in_group(AclId uid, AclId gid)
} }
tuple = SearchSysCacheTuple(GROSYSID, tuple = SearchSysCacheTuple(GROSYSID,
ObjectIdGetDatum(gid), ObjectIdGetDatum(gid),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(tuple) && if (HeapTupleIsValid(tuple) &&
!heap_attisnull(tuple, Anum_pg_group_grolist)) !heap_attisnull(tuple, Anum_pg_group_grolist))
{ {
tmp = (IdList *) heap_getattr(tuple, tmp = (IdList *) heap_getattr(tuple,
Anum_pg_group_grolist, Anum_pg_group_grolist,
RelationGetDescr(relation), RelationGetDescr(relation),
(bool *) NULL); (bool *) NULL);
/* XXX make me a function */ /* XXX make me a function */
num = IDLIST_NUM(tmp); num = IDLIST_NUM(tmp);
...@@ -369,7 +369,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode) ...@@ -369,7 +369,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
tuple = SearchSysCacheTuple(USENAME, tuple = SearchSysCacheTuple(USENAME,
PointerGetDatum(usename), PointerGetDatum(usename),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "pg_aclcheck: user \"%s\" not found", elog(ERROR, "pg_aclcheck: user \"%s\" not found",
usename); usename);
...@@ -420,8 +420,8 @@ pg_aclcheck(char *relname, char *usename, AclMode mode) ...@@ -420,8 +420,8 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
#ifndef ACLDEBUG #ifndef ACLDEBUG
tuple = SearchSysCacheTuple(RELNAME, tuple = SearchSysCacheTuple(RELNAME,
PointerGetDatum(relname), PointerGetDatum(relname),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{ {
elog(ERROR, "pg_aclcheck: class \"%s\" not found", elog(ERROR, "pg_aclcheck: class \"%s\" not found",
...@@ -450,10 +450,10 @@ pg_aclcheck(char *relname, char *usename, AclMode mode) ...@@ -450,10 +450,10 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
relation = heap_openr(RelationRelationName); relation = heap_openr(RelationRelationName);
ownerId = (int4) heap_getattr(tuple, ownerId = (int4) heap_getattr(tuple,
Anum_pg_class_relowner, Anum_pg_class_relowner,
RelationGetDescr(relation), RelationGetDescr(relation),
(bool *) NULL); (bool *) NULL);
acl = aclownerdefault(relname, (AclId)ownerId); acl = aclownerdefault(relname, (AclId) ownerId);
} }
#else #else
{ /* This is why the syscache is great... */ { /* This is why the syscache is great... */
...@@ -469,14 +469,14 @@ pg_aclcheck(char *relname, char *usename, AclMode mode) ...@@ -469,14 +469,14 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
return ACLCHECK_NO_CLASS; return ACLCHECK_NO_CLASS;
} }
tuple = SearchSysCacheTuple(RELNAME, tuple = SearchSysCacheTuple(RELNAME,
PointerGetDatum(relname), PointerGetDatum(relname),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(tuple) && if (HeapTupleIsValid(tuple) &&
!heap_attisnull(tuple, Anum_pg_class_relacl)) !heap_attisnull(tuple, Anum_pg_class_relacl))
{ {
tmp = (Acl *) heap_getattr(tuple, tmp = (Acl *) heap_getattr(tuple,
Anum_pg_class_relacl, Anum_pg_class_relacl,
RelationGetDescr(relation), RelationGetDescr(relation),
(bool *) NULL); (bool *) NULL);
acl = makeacl(ACL_NUM(tmp)); acl = makeacl(ACL_NUM(tmp));
memmove((char *) acl, (char *) tmp, ACL_SIZE(tmp)); memmove((char *) acl, (char *) tmp, ACL_SIZE(tmp));
...@@ -501,7 +501,7 @@ pg_ownercheck(char *usename, ...@@ -501,7 +501,7 @@ pg_ownercheck(char *usename,
tuple = SearchSysCacheTuple(USENAME, tuple = SearchSysCacheTuple(USENAME,
PointerGetDatum(usename), PointerGetDatum(usename),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "pg_ownercheck: user \"%s\" not found", elog(ERROR, "pg_ownercheck: user \"%s\" not found",
usename); usename);
...@@ -520,7 +520,7 @@ pg_ownercheck(char *usename, ...@@ -520,7 +520,7 @@ pg_ownercheck(char *usename,
} }
tuple = SearchSysCacheTuple(cacheid, PointerGetDatum(value), tuple = SearchSysCacheTuple(cacheid, PointerGetDatum(value),
0, 0, 0); 0, 0, 0);
switch (cacheid) switch (cacheid)
{ {
case OPROID: case OPROID:
...@@ -568,7 +568,7 @@ pg_func_ownercheck(char *usename, ...@@ -568,7 +568,7 @@ pg_func_ownercheck(char *usename,
tuple = SearchSysCacheTuple(USENAME, tuple = SearchSysCacheTuple(USENAME,
PointerGetDatum(usename), PointerGetDatum(usename),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "pg_func_ownercheck: user \"%s\" not found", elog(ERROR, "pg_func_ownercheck: user \"%s\" not found",
usename); usename);
...@@ -587,10 +587,10 @@ pg_func_ownercheck(char *usename, ...@@ -587,10 +587,10 @@ pg_func_ownercheck(char *usename,
} }
tuple = SearchSysCacheTuple(PRONAME, tuple = SearchSysCacheTuple(PRONAME,
PointerGetDatum(funcname), PointerGetDatum(funcname),
Int32GetDatum(nargs), Int32GetDatum(nargs),
PointerGetDatum(arglist), PointerGetDatum(arglist),
0); 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
func_error("pg_func_ownercheck", funcname, nargs, arglist, NULL); func_error("pg_func_ownercheck", funcname, nargs, arglist, NULL);
...@@ -610,7 +610,7 @@ pg_aggr_ownercheck(char *usename, ...@@ -610,7 +610,7 @@ pg_aggr_ownercheck(char *usename,
tuple = SearchSysCacheTuple(USENAME, tuple = SearchSysCacheTuple(USENAME,
PointerGetDatum(usename), PointerGetDatum(usename),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "pg_aggr_ownercheck: user \"%s\" not found", elog(ERROR, "pg_aggr_ownercheck: user \"%s\" not found",
usename); usename);
...@@ -629,9 +629,9 @@ pg_aggr_ownercheck(char *usename, ...@@ -629,9 +629,9 @@ pg_aggr_ownercheck(char *usename,
} }
tuple = SearchSysCacheTuple(AGGNAME, tuple = SearchSysCacheTuple(AGGNAME,
PointerGetDatum(aggname), PointerGetDatum(aggname),
ObjectIdGetDatum(basetypeID), ObjectIdGetDatum(basetypeID),
0, 0); 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
agg_error("pg_aggr_ownercheck", aggname, basetypeID); agg_error("pg_aggr_ownercheck", aggname, basetypeID);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.17 1998/09/01 03:21:40 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.18 1998/09/01 04:27:28 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -174,7 +174,7 @@ fillatt(TupleDesc tupleDesc) ...@@ -174,7 +174,7 @@ fillatt(TupleDesc tupleDesc)
for (i = 0; i < natts;) for (i = 0; i < natts;)
{ {
tuple = SearchSysCacheTuple(TYPOID, tuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum((*attributeP)->atttypid), ObjectIdGetDatum((*attributeP)->atttypid),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{ {
...@@ -193,7 +193,7 @@ fillatt(TupleDesc tupleDesc) ...@@ -193,7 +193,7 @@ fillatt(TupleDesc tupleDesc)
*/ */
if (!(*attributeP)->attisset) if (!(*attributeP)->attisset)
{ {
typp = (Form_pg_type) GETSTRUCT(tuple); /* XXX */ typp = (Form_pg_type) GETSTRUCT(tuple); /* XXX */
(*attributeP)->attlen = typp->typlen; (*attributeP)->attlen = typp->typlen;
(*attributeP)->attbyval = typp->typbyval; (*attributeP)->attbyval = typp->typbyval;
} }
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.63 1998/09/01 03:21:41 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.64 1998/09/01 04:27:29 momjian Exp $
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
* heap_create() - Create an uncataloged heap relation * heap_create() - Create an uncataloged heap relation
* heap_create_with_catalog() - Create a cataloged relation * heap_create_with_catalog() - Create a cataloged relation
* heap_destroy_with_catalog() - Removes named relation from catalogs * heap_destroy_with_catalog() - Removes named relation from catalogs
* *
* NOTES * NOTES
* this code taken from access/heap/create.c, which contains * this code taken from access/heap/create.c, which contains
...@@ -65,10 +65,9 @@ ...@@ -65,10 +65,9 @@
#include <string.h> #include <string.h>
#endif #endif
static void static void AddPgRelationTuple(Relation pg_class_desc,
AddPgRelationTuple(Relation pg_class_desc, Relation new_rel_desc, Oid new_rel_oid, unsigned natts,
Relation new_rel_desc, Oid new_rel_oid, unsigned natts, char relkind);
char relkind);
static void AddToTempRelList(Relation r); static void AddToTempRelList(Relation r);
static void DeletePgAttributeTuples(Relation rel); static void DeletePgAttributeTuples(Relation rel);
static void DeletePgRelationTuple(Relation rel); static void DeletePgRelationTuple(Relation rel);
...@@ -317,7 +316,7 @@ heap_create(char *name, ...@@ -317,7 +316,7 @@ heap_create(char *name,
* ---------------- * ----------------
*/ */
rel->rd_tmpunlinked = TRUE; /* change once table is created */ rel->rd_tmpunlinked = TRUE; /* change once table is created */
rel->rd_fd = (File) smgrcreate(DEFAULT_SMGR, rel); rel->rd_fd = (File) smgrcreate(DEFAULT_SMGR, rel);
rel->rd_tmpunlinked = FALSE; rel->rd_tmpunlinked = FALSE;
...@@ -479,8 +478,8 @@ RelationAlreadyExists(Relation pg_class_desc, char *relname) ...@@ -479,8 +478,8 @@ RelationAlreadyExists(Relation pg_class_desc, char *relname)
if (!IsBootstrapProcessingMode()) if (!IsBootstrapProcessingMode())
{ {
tup = SearchSysCacheTuple(RELNAME, tup = SearchSysCacheTuple(RELNAME,
PointerGetDatum(relname), PointerGetDatum(relname),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
return true; return true;
else else
...@@ -878,7 +877,7 @@ RelationRemoveInheritance(Relation relation) ...@@ -878,7 +877,7 @@ RelationRemoveInheritance(Relation relation)
HeapScanDesc scan; HeapScanDesc scan;
ScanKeyData entry; ScanKeyData entry;
bool found = false; bool found = false;
/* ---------------- /* ----------------
* open pg_inherits * open pg_inherits
* ---------------- * ----------------
...@@ -892,7 +891,7 @@ RelationRemoveInheritance(Relation relation) ...@@ -892,7 +891,7 @@ RelationRemoveInheritance(Relation relation)
*/ */
ScanKeyEntryInitialize(&entry, 0x0, Anum_pg_inherits_inhparent, ScanKeyEntryInitialize(&entry, 0x0, Anum_pg_inherits_inhparent,
F_OIDEQ, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation))); ObjectIdGetDatum(RelationGetRelid(relation)));
scan = heap_beginscan(catalogRelation, scan = heap_beginscan(catalogRelation,
false, false,
...@@ -972,10 +971,10 @@ RelationRemoveIndexes(Relation relation) ...@@ -972,10 +971,10 @@ RelationRemoveIndexes(Relation relation)
ScanKeyData entry; ScanKeyData entry;
indexRelation = heap_openr(IndexRelationName); indexRelation = heap_openr(IndexRelationName);
ScanKeyEntryInitialize(&entry, 0x0, Anum_pg_index_indrelid, ScanKeyEntryInitialize(&entry, 0x0, Anum_pg_index_indrelid,
F_OIDEQ, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation))); ObjectIdGetDatum(RelationGetRelid(relation)));
scan = heap_beginscan(indexRelation, scan = heap_beginscan(indexRelation,
false, false,
...@@ -1008,8 +1007,8 @@ DeletePgRelationTuple(Relation rel) ...@@ -1008,8 +1007,8 @@ DeletePgRelationTuple(Relation rel)
pg_class_desc = heap_openr(RelationRelationName); pg_class_desc = heap_openr(RelationRelationName);
tup = SearchSysCacheTupleCopy(RELOID, tup = SearchSysCacheTupleCopy(RELOID,
ObjectIdGetDatum(rel->rd_att->attrs[0]->attrelid), ObjectIdGetDatum(rel->rd_att->attrs[0]->attrelid),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
{ {
heap_close(pg_class_desc); heap_close(pg_class_desc);
...@@ -1023,7 +1022,7 @@ DeletePgRelationTuple(Relation rel) ...@@ -1023,7 +1022,7 @@ DeletePgRelationTuple(Relation rel)
*/ */
heap_delete(pg_class_desc, &tup->t_ctid); heap_delete(pg_class_desc, &tup->t_ctid);
pfree(tup); pfree(tup);
heap_close(pg_class_desc); heap_close(pg_class_desc);
} }
...@@ -1038,7 +1037,7 @@ DeletePgAttributeTuples(Relation rel) ...@@ -1038,7 +1037,7 @@ DeletePgAttributeTuples(Relation rel)
Relation pg_attribute_desc; Relation pg_attribute_desc;
HeapTuple tup; HeapTuple tup;
int2 attnum; int2 attnum;
/* ---------------- /* ----------------
* open pg_attribute * open pg_attribute
* ---------------- * ----------------
...@@ -1052,19 +1051,19 @@ DeletePgAttributeTuples(Relation rel) ...@@ -1052,19 +1051,19 @@ DeletePgAttributeTuples(Relation rel)
RelationSetLockForWrite(pg_attribute_desc); RelationSetLockForWrite(pg_attribute_desc);
for (attnum = FirstLowInvalidHeapAttributeNumber + 1; for (attnum = FirstLowInvalidHeapAttributeNumber + 1;
attnum <= rel->rd_att->natts; attnum <= rel->rd_att->natts;
attnum++) attnum++)
{ {
if (HeapTupleIsValid(tup = SearchSysCacheTupleCopy(ATTNUM, if (HeapTupleIsValid(tup = SearchSysCacheTupleCopy(ATTNUM,
ObjectIdGetDatum(RelationGetRelid(rel)), ObjectIdGetDatum(RelationGetRelid(rel)),
Int16GetDatum(attnum), Int16GetDatum(attnum),
0, 0))) 0, 0)))
{ {
heap_delete(pg_attribute_desc, &tup->t_ctid); heap_delete(pg_attribute_desc, &tup->t_ctid);
pfree(tup); pfree(tup);
} }
} }
/* ---------------- /* ----------------
* Release the write lock * Release the write lock
* ---------------- * ----------------
...@@ -1107,9 +1106,9 @@ DeletePgTypeTuple(Relation rel) ...@@ -1107,9 +1106,9 @@ DeletePgTypeTuple(Relation rel)
* ---------------- * ----------------
*/ */
ScanKeyEntryInitialize(&key, 0, ScanKeyEntryInitialize(&key, 0,
Anum_pg_type_typrelid, Anum_pg_type_typrelid,
F_OIDEQ, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(rel))); ObjectIdGetDatum(RelationGetRelid(rel)));
pg_type_scan = heap_beginscan(pg_type_desc, pg_type_scan = heap_beginscan(pg_type_desc,
0, 0,
...@@ -1470,7 +1469,7 @@ start:; ...@@ -1470,7 +1469,7 @@ start:;
} }
} }
else if ((exprType(expr) != atp->atttypid) else if ((exprType(expr) != atp->atttypid)
&& !IS_BINARY_COMPATIBLE(exprType(expr), atp->atttypid)) && !IS_BINARY_COMPATIBLE(exprType(expr), atp->atttypid))
elog(ERROR, "DEFAULT: type mismatched"); elog(ERROR, "DEFAULT: type mismatched");
adbin = nodeToString(expr); adbin = nodeToString(expr);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.59 1998/09/01 03:21:43 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.60 1998/09/01 04:27:31 momjian Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -65,32 +65,28 @@ ...@@ -65,32 +65,28 @@
/* non-export function prototypes */ /* non-export function prototypes */
static Oid static Oid
RelationNameGetObjectId(char *relationName, Relation pg_class); RelationNameGetObjectId(char *relationName, Relation pg_class);
static Oid GetHeapRelationOid(char *heapRelationName, char *indexRelationName); static Oid GetHeapRelationOid(char *heapRelationName, char *indexRelationName);
static TupleDesc BuildFuncTupleDesc(FuncIndexInfo *funcInfo); static TupleDesc BuildFuncTupleDesc(FuncIndexInfo *funcInfo);
static TupleDesc static TupleDesc ConstructTupleDescriptor(Oid heapoid, Relation heapRelation,
ConstructTupleDescriptor(Oid heapoid, Relation heapRelation,
List *attributeList, List *attributeList,
int numatts, AttrNumber *attNums); int numatts, AttrNumber *attNums);
static void ConstructIndexReldesc(Relation indexRelation, Oid amoid); static void ConstructIndexReldesc(Relation indexRelation, Oid amoid);
static Oid UpdateRelationRelation(Relation indexRelation); static Oid UpdateRelationRelation(Relation indexRelation);
static void static void InitializeAttributeOids(Relation indexRelation,
InitializeAttributeOids(Relation indexRelation,
int numatts, int numatts,
Oid indexoid); Oid indexoid);
static void static void
AppendAttributeTuples(Relation indexRelation, int numatts); AppendAttributeTuples(Relation indexRelation, int numatts);
static void static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
UpdateIndexRelation(Oid indexoid, Oid heapoid,
FuncIndexInfo *funcInfo, int natts, FuncIndexInfo *funcInfo, int natts,
AttrNumber *attNums, Oid *classOids, Node *predicate, AttrNumber *attNums, Oid *classOids, Node *predicate,
List *attributeList, bool islossy, bool unique); List *attributeList, bool islossy, bool unique);
static void static void DefaultBuild(Relation heapRelation, Relation indexRelation,
DefaultBuild(Relation heapRelation, Relation indexRelation,
int numberOfAttributes, AttrNumber *attributeNumber, int numberOfAttributes, AttrNumber *attributeNumber,
IndexStrategy indexStrategy, uint16 parameterCount, IndexStrategy indexStrategy, uint16 parameterCount,
Datum *parameter, FuncIndexInfoPtr funcInfo, PredInfo *predInfo); Datum *parameter, FuncIndexInfoPtr funcInfo, PredInfo *predInfo);
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* sysatts is a structure containing attribute tuple forms * sysatts is a structure containing attribute tuple forms
...@@ -147,12 +143,12 @@ RelationNameGetObjectId(char *relationName, ...@@ -147,12 +143,12 @@ RelationNameGetObjectId(char *relationName,
if (!IsBootstrapProcessingMode()) if (!IsBootstrapProcessingMode())
{ {
HeapTuple tuple; HeapTuple tuple;
tuple = SearchSysCacheTuple(RELNAME, tuple = SearchSysCacheTuple(RELNAME,
PointerGetDatum(relationName), PointerGetDatum(relationName),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
return tuple->t_oid; return tuple->t_oid;
else else
...@@ -614,7 +610,9 @@ static void ...@@ -614,7 +610,9 @@ static void
AppendAttributeTuples(Relation indexRelation, int numatts) AppendAttributeTuples(Relation indexRelation, int numatts)
{ {
Relation pg_attribute; Relation pg_attribute;
HeapTuple init_tuple, cur_tuple = NULL, new_tuple; HeapTuple init_tuple,
cur_tuple = NULL,
new_tuple;
bool hasind; bool hasind;
Relation idescs[Num_pg_attr_indices]; Relation idescs[Num_pg_attr_indices];
...@@ -651,8 +649,8 @@ AppendAttributeTuples(Relation indexRelation, int numatts) ...@@ -651,8 +649,8 @@ AppendAttributeTuples(Relation indexRelation, int numatts)
value[Anum_pg_attribute_attcacheoff - 1] = Int32GetDatum(-1); value[Anum_pg_attribute_attcacheoff - 1] = Int32GetDatum(-1);
init_tuple = heap_addheader(Natts_pg_attribute, init_tuple = heap_addheader(Natts_pg_attribute,
sizeof *(indexRelation->rd_att->attrs[0]), sizeof *(indexRelation->rd_att->attrs[0]),
(char *) (indexRelation->rd_att->attrs[0])); (char *) (indexRelation->rd_att->attrs[0]));
hasind = false; hasind = false;
if (!IsBootstrapProcessingMode() && pg_attribute->rd_rel->relhasindex) if (!IsBootstrapProcessingMode() && pg_attribute->rd_rel->relhasindex)
...@@ -666,12 +664,12 @@ AppendAttributeTuples(Relation indexRelation, int numatts) ...@@ -666,12 +664,12 @@ AppendAttributeTuples(Relation indexRelation, int numatts)
* ---------------- * ----------------
*/ */
cur_tuple = heap_modifytuple(init_tuple, cur_tuple = heap_modifytuple(init_tuple,
pg_attribute, pg_attribute,
value, value,
nullv, nullv,
replace); replace);
pfree(init_tuple); pfree(init_tuple);
heap_insert(pg_attribute, cur_tuple); heap_insert(pg_attribute, cur_tuple);
if (hasind) if (hasind)
CatalogIndexInsert(idescs, Num_pg_attr_indices, pg_attribute, cur_tuple); CatalogIndexInsert(idescs, Num_pg_attr_indices, pg_attribute, cur_tuple);
...@@ -696,13 +694,13 @@ AppendAttributeTuples(Relation indexRelation, int numatts) ...@@ -696,13 +694,13 @@ AppendAttributeTuples(Relation indexRelation, int numatts)
value[Anum_pg_attribute_attnum - 1] = Int16GetDatum(i + 1); value[Anum_pg_attribute_attnum - 1] = Int16GetDatum(i + 1);
new_tuple = heap_modifytuple(cur_tuple, new_tuple = heap_modifytuple(cur_tuple,
pg_attribute, pg_attribute,
value, value,
nullv, nullv,
replace); replace);
pfree(cur_tuple); pfree(cur_tuple);
heap_insert(pg_attribute,new_tuple); heap_insert(pg_attribute, new_tuple);
if (hasind) if (hasind)
CatalogIndexInsert(idescs, Num_pg_attr_indices, pg_attribute, new_tuple); CatalogIndexInsert(idescs, Num_pg_attr_indices, pg_attribute, new_tuple);
...@@ -711,7 +709,7 @@ AppendAttributeTuples(Relation indexRelation, int numatts) ...@@ -711,7 +709,7 @@ AppendAttributeTuples(Relation indexRelation, int numatts)
* so we free the original and use the copy.. * so we free the original and use the copy..
* ---------------- * ----------------
*/ */
cur_tuple = new_tuple; cur_tuple = new_tuple;
} }
if (cur_tuple) if (cur_tuple)
...@@ -898,10 +896,10 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate) ...@@ -898,10 +896,10 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
pg_index = heap_openr(IndexRelationName); pg_index = heap_openr(IndexRelationName);
tuple = SearchSysCacheTuple(INDEXRELID, tuple = SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(indexoid), ObjectIdGetDatum(indexoid),
0, 0, 0); 0, 0, 0);
Assert(HeapTupleIsValid(tuple)); Assert(HeapTupleIsValid(tuple));
for (i = 0; i < Natts_pg_index; i++) for (i = 0; i < Natts_pg_index; i++)
{ {
nulls[i] = heap_attisnull(tuple, i + 1) ? 'n' : ' '; nulls[i] = heap_attisnull(tuple, i + 1) ? 'n' : ' ';
...@@ -1103,7 +1101,7 @@ index_create(char *heapRelationName, ...@@ -1103,7 +1101,7 @@ index_create(char *heapRelationName,
if (!HeapTupleIsValid(proc_tup)) if (!HeapTupleIsValid(proc_tup))
{ {
func_error("index_create", FIgetname(funcInfo), func_error("index_create", FIgetname(funcInfo),
FIgetnArgs(funcInfo), FIgetArglist(funcInfo), NULL); FIgetnArgs(funcInfo), FIgetArglist(funcInfo), NULL);
} }
FIgetProcOid(funcInfo) = proc_tup->t_oid; FIgetProcOid(funcInfo) = proc_tup->t_oid;
} }
...@@ -1178,7 +1176,7 @@ index_destroy(Oid indexId) ...@@ -1178,7 +1176,7 @@ index_destroy(Oid indexId)
Relation attributeRelation; Relation attributeRelation;
HeapTuple tuple; HeapTuple tuple;
int16 attnum; int16 attnum;
Assert(OidIsValid(indexId)); Assert(OidIsValid(indexId));
/* why open it here? bjm 1998/08/20 */ /* why open it here? bjm 1998/08/20 */
...@@ -1206,12 +1204,12 @@ index_destroy(Oid indexId) ...@@ -1206,12 +1204,12 @@ index_destroy(Oid indexId)
*/ */
attributeRelation = heap_openr(AttributeRelationName); attributeRelation = heap_openr(AttributeRelationName);
attnum = 1; /* indexes start at 1 */ attnum = 1; /* indexes start at 1 */
while (HeapTupleIsValid(tuple = SearchSysCacheTupleCopy(ATTNUM, while (HeapTupleIsValid(tuple = SearchSysCacheTupleCopy(ATTNUM,
ObjectIdGetDatum(indexId), ObjectIdGetDatum(indexId),
Int16GetDatum(attnum), Int16GetDatum(attnum),
0, 0))) 0, 0)))
{ {
heap_delete(attributeRelation, &tuple->t_ctid); heap_delete(attributeRelation, &tuple->t_ctid);
pfree(tuple); pfree(tuple);
...@@ -1224,15 +1222,15 @@ index_destroy(Oid indexId) ...@@ -1224,15 +1222,15 @@ index_destroy(Oid indexId)
* ---------------- * ----------------
*/ */
tuple = SearchSysCacheTupleCopy(INDEXRELID, tuple = SearchSysCacheTupleCopy(INDEXRELID,
ObjectIdGetDatum(indexId), ObjectIdGetDatum(indexId),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(NOTICE, "IndexRelationDestroy: %s's INDEX tuple missing", elog(NOTICE, "IndexRelationDestroy: %s's INDEX tuple missing",
RelationGetRelationName(userindexRelation)); RelationGetRelationName(userindexRelation));
indexRelation = heap_openr(IndexRelationName); indexRelation = heap_openr(IndexRelationName);
heap_delete(indexRelation, &tuple->t_ctid); heap_delete(indexRelation, &tuple->t_ctid);
pfree(tuple); pfree(tuple);
heap_close(indexRelation); heap_close(indexRelation);
...@@ -1281,12 +1279,12 @@ FormIndexDatum(int numberOfAttributes, ...@@ -1281,12 +1279,12 @@ FormIndexDatum(int numberOfAttributes,
{ {
offset = AttrNumberGetAttrOffset(i); offset = AttrNumberGetAttrOffset(i);
datum[offset] = PointerGetDatum(GetIndexValue(heapTuple, datum[offset] = PointerGetDatum(GetIndexValue(heapTuple,
heapDescriptor, heapDescriptor,
offset, offset,
attributeNumber, attributeNumber,
fInfo, fInfo,
&isNull)); &isNull));
nullv[offset] = (isNull) ? 'n' : ' '; nullv[offset] = (isNull) ? 'n' : ' ';
} }
...@@ -1311,7 +1309,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex) ...@@ -1311,7 +1309,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
Datum values[Natts_pg_class]; Datum values[Natts_pg_class];
char nulls[Natts_pg_class]; char nulls[Natts_pg_class];
char replace[Natts_pg_class]; char replace[Natts_pg_class];
HeapScanDesc pg_class_scan = NULL; HeapScanDesc pg_class_scan = NULL;
/* ---------------- /* ----------------
* This routine handles updates for both the heap and index relation * This routine handles updates for both the heap and index relation
...@@ -1356,14 +1354,14 @@ UpdateStats(Oid relid, long reltuples, bool hasindex) ...@@ -1356,14 +1354,14 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
ScanKeyData key[1]; ScanKeyData key[1];
ScanKeyEntryInitialize(&key[0], 0, ScanKeyEntryInitialize(&key[0], 0,
ObjectIdAttributeNumber, ObjectIdAttributeNumber,
F_OIDEQ, F_OIDEQ,
ObjectIdGetDatum(relid)); ObjectIdGetDatum(relid));
pg_class_scan = heap_beginscan(pg_class, 0, SnapshotNow, 1, key); pg_class_scan = heap_beginscan(pg_class, 0, SnapshotNow, 1, key);
tuple = heap_getnext(pg_class_scan, 0); tuple = heap_getnext(pg_class_scan, 0);
} }
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{ {
if (IsBootstrapProcessingMode()) if (IsBootstrapProcessingMode())
...@@ -1436,7 +1434,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex) ...@@ -1436,7 +1434,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
pfree(tuple); pfree(tuple);
else else
heap_endscan(pg_class_scan); heap_endscan(pg_class_scan);
heap_close(pg_class); heap_close(pg_class);
heap_close(whichRel); heap_close(whichRel);
} }
...@@ -1478,7 +1476,7 @@ DefaultBuild(Relation heapRelation, ...@@ -1478,7 +1476,7 @@ DefaultBuild(Relation heapRelation,
AttrNumber *attributeNumber, AttrNumber *attributeNumber,
IndexStrategy indexStrategy, /* not used */ IndexStrategy indexStrategy, /* not used */
uint16 parameterCount, /* not used */ uint16 parameterCount, /* not used */
Datum *parameter, /* not used */ Datum *parameter, /* not used */
FuncIndexInfoPtr funcInfo, FuncIndexInfoPtr funcInfo,
PredInfo *predInfo) PredInfo *predInfo)
{ {
...@@ -1543,7 +1541,7 @@ DefaultBuild(Relation heapRelation, ...@@ -1543,7 +1541,7 @@ DefaultBuild(Relation heapRelation,
tupleTable = ExecCreateTupleTable(1); tupleTable = ExecCreateTupleTable(1);
slot = ExecAllocTableSlot(tupleTable); slot = ExecAllocTableSlot(tupleTable);
econtext = makeNode(ExprContext); econtext = makeNode(ExprContext);
/* last parameter was junk being sent bjm 1998/08/17 */ /* last parameter was junk being sent bjm 1998/08/17 */
FillDummyExprContext(econtext, slot, heapDescriptor, InvalidBuffer); FillDummyExprContext(econtext, slot, heapDescriptor, InvalidBuffer);
} }
else else
...@@ -1552,7 +1550,7 @@ DefaultBuild(Relation heapRelation, ...@@ -1552,7 +1550,7 @@ DefaultBuild(Relation heapRelation,
tupleTable = 0; tupleTable = 0;
slot = NULL; slot = NULL;
} }
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
/* ---------------- /* ----------------
* Ok, begin our scan of the base relation. * Ok, begin our scan of the base relation.
...@@ -1560,7 +1558,7 @@ DefaultBuild(Relation heapRelation, ...@@ -1560,7 +1558,7 @@ DefaultBuild(Relation heapRelation,
*/ */
scan = heap_beginscan(heapRelation, /* relation */ scan = heap_beginscan(heapRelation, /* relation */
0, /* start at end */ 0, /* start at end */
SnapshotNow,/* seeself */ SnapshotNow, /* seeself */
0, /* number of keys */ 0, /* number of keys */
(ScanKey) NULL); /* scan key */ (ScanKey) NULL); /* scan key */
...@@ -1591,7 +1589,7 @@ DefaultBuild(Relation heapRelation, ...@@ -1591,7 +1589,7 @@ DefaultBuild(Relation heapRelation,
indtuples++; indtuples++;
continue; continue;
} }
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
/* /*
...@@ -1605,7 +1603,7 @@ DefaultBuild(Relation heapRelation, ...@@ -1605,7 +1603,7 @@ DefaultBuild(Relation heapRelation,
slot->val = heapTuple; slot->val = heapTuple;
if (ExecQual((List *) predicate, econtext) == false) if (ExecQual((List *) predicate, econtext) == false)
continue; continue;
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
indtuples++; indtuples++;
...@@ -1643,7 +1641,7 @@ DefaultBuild(Relation heapRelation, ...@@ -1643,7 +1641,7 @@ DefaultBuild(Relation heapRelation,
{ {
#ifndef OMIT_PARTIAL_INDEX #ifndef OMIT_PARTIAL_INDEX
ExecDestroyTupleTable(tupleTable, false); ExecDestroyTupleTable(tupleTable, false);
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
pfree(nullv); pfree(nullv);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.25 1998/09/01 03:21:44 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.26 1998/09/01 04:27:33 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -126,8 +126,8 @@ CatalogIndexInsert(Relation *idescs, ...@@ -126,8 +126,8 @@ CatalogIndexInsert(Relation *idescs,
indexDescriptor = RelationGetDescr(idescs[i]); indexDescriptor = RelationGetDescr(idescs[i]);
pgIndexTup = SearchSysCacheTupleCopy(INDEXRELID, pgIndexTup = SearchSysCacheTupleCopy(INDEXRELID,
ObjectIdGetDatum(idescs[i]->rd_id), ObjectIdGetDatum(idescs[i]->rd_id),
0, 0, 0); 0, 0, 0);
Assert(pgIndexTup); Assert(pgIndexTup);
pgIndexP = (Form_pg_index) GETSTRUCT(pgIndexTup); pgIndexP = (Form_pg_index) GETSTRUCT(pgIndexTup);
...@@ -228,7 +228,7 @@ CatalogIndexFetchTuple(Relation heapRelation, ...@@ -228,7 +228,7 @@ CatalogIndexFetchTuple(Relation heapRelation,
RetrieveIndexResult indexRes; RetrieveIndexResult indexRes;
HeapTuple tuple = NULL; HeapTuple tuple = NULL;
Buffer buffer; Buffer buffer;
sd = index_beginscan(idesc, false, num_keys, skey); sd = index_beginscan(idesc, false, num_keys, skey);
while ((indexRes = index_getnext(sd, ForwardScanDirection))) while ((indexRes = index_getnext(sd, ForwardScanDirection)))
{ {
...@@ -239,7 +239,7 @@ CatalogIndexFetchTuple(Relation heapRelation, ...@@ -239,7 +239,7 @@ CatalogIndexFetchTuple(Relation heapRelation,
pfree(indexRes); pfree(indexRes);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
break; break;
} }
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
{ {
...@@ -270,13 +270,13 @@ AttributeNameIndexScan(Relation heapRelation, ...@@ -270,13 +270,13 @@ AttributeNameIndexScan(Relation heapRelation,
ScanKeyEntryInitialize(&skey[0], ScanKeyEntryInitialize(&skey[0],
(bits16) 0x0, (bits16) 0x0,
(AttrNumber) 1, (AttrNumber) 1,
(RegProcedure)F_OIDEQ, (RegProcedure) F_OIDEQ,
ObjectIdGetDatum(relid)); ObjectIdGetDatum(relid));
ScanKeyEntryInitialize(&skey[1], ScanKeyEntryInitialize(&skey[1],
(bits16) 0x0, (bits16) 0x0,
(AttrNumber) 2, (AttrNumber) 2,
(RegProcedure)F_NAMEEQ, (RegProcedure) F_NAMEEQ,
NameGetDatum(attname)); NameGetDatum(attname));
idesc = index_openr(AttributeNameIndex); idesc = index_openr(AttributeNameIndex);
...@@ -299,13 +299,13 @@ AttributeNumIndexScan(Relation heapRelation, ...@@ -299,13 +299,13 @@ AttributeNumIndexScan(Relation heapRelation,
ScanKeyEntryInitialize(&skey[0], ScanKeyEntryInitialize(&skey[0],
(bits16) 0x0, (bits16) 0x0,
(AttrNumber) 1, (AttrNumber) 1,
(RegProcedure)F_OIDEQ, (RegProcedure) F_OIDEQ,
ObjectIdGetDatum(relid)); ObjectIdGetDatum(relid));
ScanKeyEntryInitialize(&skey[1], ScanKeyEntryInitialize(&skey[1],
(bits16) 0x0, (bits16) 0x0,
(AttrNumber) 2, (AttrNumber) 2,
(RegProcedure)F_INT2EQ, (RegProcedure) F_INT2EQ,
Int16GetDatum(attnum)); Int16GetDatum(attnum));
idesc = index_openr(AttributeNumIndex); idesc = index_openr(AttributeNumIndex);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.16 1998/09/01 03:21:45 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.17 1998/09/01 04:27:34 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -78,7 +78,7 @@ AggregateCreate(char *aggName, ...@@ -78,7 +78,7 @@ AggregateCreate(char *aggName,
Oid xret2 = InvalidOid; Oid xret2 = InvalidOid;
Oid fret = InvalidOid; Oid fret = InvalidOid;
Oid fnArgs[8]; Oid fnArgs[8];
NameData aname; NameData aname;
TupleDesc tupDesc; TupleDesc tupDesc;
MemSet(fnArgs, 0, 8 * sizeof(Oid)); MemSet(fnArgs, 0, 8 * sizeof(Oid));
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.28 1998/09/01 03:21:47 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.29 1998/09/01 04:27:36 momjian Exp $
* *
* NOTES * NOTES
* these routines moved here from commands/define.c and somewhat cleaned up. * these routines moved here from commands/define.c and somewhat cleaned up.
...@@ -35,28 +35,23 @@ ...@@ -35,28 +35,23 @@
#include <string.h> #include <string.h>
#endif #endif
static Oid static Oid OperatorGetWithOpenRelation(Relation pg_operator_desc,
OperatorGetWithOpenRelation(Relation pg_operator_desc,
const char *operatorName, const char *operatorName,
Oid leftObjectId, Oid leftObjectId,
Oid rightObjectId); Oid rightObjectId);
static Oid static Oid OperatorGet(char *operatorName,
OperatorGet(char *operatorName,
char *leftTypeName, char *leftTypeName,
char *rightTypeName); char *rightTypeName);
static Oid static Oid OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
char *operatorName, char *operatorName,
Oid leftObjectId, Oid leftObjectId,
Oid rightObjectId); Oid rightObjectId);
static Oid static Oid OperatorShellMake(char *operatorName,
OperatorShellMake(char *operatorName,
char *leftTypeName, char *leftTypeName,
char *rightTypeName); char *rightTypeName);
static void static void OperatorDef(char *operatorName,
OperatorDef(char *operatorName,
int definedOK, int definedOK,
char *leftTypeName, char *leftTypeName,
char *rightTypeName, char *rightTypeName,
...@@ -120,7 +115,7 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc, ...@@ -120,7 +115,7 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
*/ */
pg_operator_scan = heap_beginscan(pg_operator_desc, pg_operator_scan = heap_beginscan(pg_operator_desc,
0, 0,
SnapshotSelf, /* no cache? */ SnapshotSelf, /* no cache? */
3, 3,
opKey); opKey);
...@@ -475,7 +470,7 @@ OperatorDef(char *operatorName, ...@@ -475,7 +470,7 @@ OperatorDef(char *operatorName,
char *name[4]; char *name[4];
Oid typeId[8]; Oid typeId[8];
int nargs; int nargs;
NameData oname; NameData oname;
TupleDesc tupDesc; TupleDesc tupDesc;
static ScanKeyData opKey[3] = { static ScanKeyData opKey[3] = {
...@@ -796,7 +791,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) ...@@ -796,7 +791,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
pg_operator_scan = heap_beginscan(pg_operator_desc, pg_operator_scan = heap_beginscan(pg_operator_desc,
0, 0,
SnapshotSelf, /* no cache? */ SnapshotSelf, /* no cache? */
1, 1,
opKey); opKey);
...@@ -872,7 +867,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) ...@@ -872,7 +867,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
pg_operator_scan = heap_beginscan(pg_operator_desc, pg_operator_scan = heap_beginscan(pg_operator_desc,
0, 0,
SnapshotSelf, /* no cache? */ SnapshotSelf, /* no cache? */
1, 1,
opKey); opKey);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.22 1998/09/01 03:21:48 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.23 1998/09/01 04:27:37 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -129,6 +129,7 @@ ProcedureCreate(char *procedureName, ...@@ -129,6 +129,7 @@ ProcedureCreate(char *procedureName,
if (!strcmp(languageName, "sql")) if (!strcmp(languageName, "sql"))
{ {
/* /*
* If this call is defining a set, check if the set is already * If this call is defining a set, check if the set is already
* defined by looking to see whether this call's function text * defined by looking to see whether this call's function text
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.29 1998/09/01 03:21:49 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.30 1998/09/01 04:27:39 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
#include <string.h> #include <string.h>
#endif #endif
static Oid static Oid TypeShellMakeWithOpenRelation(Relation pg_type_desc,
TypeShellMakeWithOpenRelation(Relation pg_type_desc,
char *typeName); char *typeName);
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
...@@ -178,7 +177,7 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName) ...@@ -178,7 +177,7 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
*/ */
i = 0; i = 0;
namestrcpy(&name, typeName); namestrcpy(&name, typeName);
values[i++] = NameGetDatum(&name); /* 1 */ values[i++] = NameGetDatum(&name); /* 1 */
values[i++] = (Datum) InvalidOid; /* 2 */ values[i++] = (Datum) InvalidOid; /* 2 */
values[i++] = (Datum) (int16) 0; /* 3 */ values[i++] = (Datum) (int16) 0; /* 3 */
values[i++] = (Datum) (int16) 0; /* 4 */ values[i++] = (Datum) (int16) 0; /* 4 */
...@@ -379,17 +378,17 @@ TypeCreate(char *typeName, ...@@ -379,17 +378,17 @@ TypeCreate(char *typeName,
* ---------------- * ----------------
*/ */
i = 0; i = 0;
namestrcpy(&name,typeName); namestrcpy(&name, typeName);
values[i++] = NameGetDatum(&name); /* 1 */ values[i++] = NameGetDatum(&name); /* 1 */
values[i++] = (Datum) GetUserId(); /* 2 */ values[i++] = (Datum) GetUserId(); /* 2 */
values[i++] = (Datum) internalSize; /* 3 */ values[i++] = (Datum) internalSize; /* 3 */
values[i++] = (Datum) externalSize; /* 4 */ values[i++] = (Datum) externalSize; /* 4 */
values[i++] = (Datum) passedByValue;/* 5 */ values[i++] = (Datum) passedByValue; /* 5 */
values[i++] = (Datum) typeType; /* 6 */ values[i++] = (Datum) typeType; /* 6 */
values[i++] = (Datum) (bool) 1; /* 7 */ values[i++] = (Datum) (bool) 1; /* 7 */
values[i++] = (Datum) typDelim; /* 8 */ values[i++] = (Datum) typDelim; /* 8 */
values[i++] = (Datum) (typeType == 'c' ? relationOid : InvalidOid); /* 9 */ values[i++] = (Datum) (typeType == 'c' ? relationOid : InvalidOid); /* 9 */
values[i++] = (Datum) elementObjectId;/* 10 */ values[i++] = (Datum) elementObjectId; /* 10 */
/* /*
* arguments to type input and output functions must be 0 * arguments to type input and output functions must be 0
...@@ -431,7 +430,7 @@ TypeCreate(char *typeName, ...@@ -431,7 +430,7 @@ TypeCreate(char *typeName,
func_error("TypeCreate", procname, 1, argList, NULL); func_error("TypeCreate", procname, 1, argList, NULL);
} }
values[i++] = (Datum) tup->t_oid; /* 11 - 14 */ values[i++] = (Datum) tup->t_oid; /* 11 - 14 */
} }
/* ---------------- /* ----------------
...@@ -444,7 +443,7 @@ TypeCreate(char *typeName, ...@@ -444,7 +443,7 @@ TypeCreate(char *typeName,
* initialize the default value for this type. * initialize the default value for this type.
* ---------------- * ----------------
*/ */
values[i] = (Datum) fmgr(F_TEXTIN, /* 16 */ values[i] = (Datum) fmgr(F_TEXTIN, /* 16 */
PointerIsValid(defaultTypeValue) PointerIsValid(defaultTypeValue)
? defaultTypeValue : "-"); /* XXX default ? defaultTypeValue : "-"); /* XXX default
* typdefault */ * typdefault */
...@@ -534,8 +533,9 @@ TypeRename(char *oldTypeName, char *newTypeName) ...@@ -534,8 +533,9 @@ TypeRename(char *oldTypeName, char *newTypeName)
{ {
Relation pg_type_desc; Relation pg_type_desc;
Relation idescs[Num_pg_type_indices]; Relation idescs[Num_pg_type_indices];
HeapTuple oldtup, newtup; HeapTuple oldtup,
newtup;
pg_type_desc = heap_openr(TypeRelationName); pg_type_desc = heap_openr(TypeRelationName);
oldtup = SearchSysCacheTupleCopy(TYPNAME, oldtup = SearchSysCacheTupleCopy(TYPNAME,
...@@ -547,7 +547,7 @@ TypeRename(char *oldTypeName, char *newTypeName) ...@@ -547,7 +547,7 @@ TypeRename(char *oldTypeName, char *newTypeName)
heap_close(pg_type_desc); heap_close(pg_type_desc);
elog(ERROR, "TypeRename: type %s not defined", oldTypeName); elog(ERROR, "TypeRename: type %s not defined", oldTypeName);
} }
newtup = SearchSysCacheTuple(TYPNAME, newtup = SearchSysCacheTuple(TYPNAME,
PointerGetDatum(newTypeName), PointerGetDatum(newTypeName),
0, 0, 0); 0, 0, 0);
...@@ -557,7 +557,7 @@ TypeRename(char *oldTypeName, char *newTypeName) ...@@ -557,7 +557,7 @@ TypeRename(char *oldTypeName, char *newTypeName)
heap_close(pg_type_desc); heap_close(pg_type_desc);
elog(ERROR, "TypeRename: type %s already defined", newTypeName); elog(ERROR, "TypeRename: type %s already defined", newTypeName);
} }
namestrcpy(&(((Form_pg_type) GETSTRUCT(oldtup))->typname), newTypeName); namestrcpy(&(((Form_pg_type) GETSTRUCT(oldtup))->typname), newTypeName);
setheapoverride(true); setheapoverride(true);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.14 1998/08/19 02:01:58 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.15 1998/09/01 04:28:09 momjian Exp $
* *
* NOTES * NOTES
* At the point the version is defined, 2 physical relations are created * At the point the version is defined, 2 physical relations are created
...@@ -303,7 +303,7 @@ VersionDelete(char *vname, char *bname, char *snapshot) ...@@ -303,7 +303,7 @@ VersionDelete(char *vname, char *bname, char *snapshot)
vname, vname, vname, bname, bname, snapshot, bname); vname, vname, vname, bname, bname, snapshot, bname);
eval_as_new_xact(rule_buf); eval_as_new_xact(rule_buf);
#endif /* OLD_REWRITE */ #endif /* OLD_REWRITE */
} }
#endif #endif
...@@ -355,7 +355,7 @@ VersionReplace(char *vname, char *bname, char *snapshot) ...@@ -355,7 +355,7 @@ VersionReplace(char *vname, char *bname, char *snapshot)
vname, vname, vname, attr_list, bname, bname, snapshot, vname, bname); vname, vname, vname, attr_list, bname, bname, snapshot, vname, bname);
eval_as_new_xact(rule_buf); eval_as_new_xact(rule_buf);
#endif /* OLD_REWRITE */ #endif /* OLD_REWRITE */
/* printf("%s\n",rule_buf); */ /* printf("%s\n",rule_buf); */
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.39 1998/09/01 03:21:50 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.40 1998/09/01 04:27:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -64,10 +64,10 @@ ...@@ -64,10 +64,10 @@
#include <utils/ps_status.h> #include <utils/ps_status.h>
#define NotifyUnlock pg_options[OPT_NOTIFYUNLOCK] #define NotifyUnlock pg_options[OPT_NOTIFYUNLOCK]
#define NotifyHack pg_options[OPT_NOTIFYHACK] #define NotifyHack pg_options[OPT_NOTIFYHACK]
extern TransactionState CurrentTransactionState; extern TransactionState CurrentTransactionState;
extern CommandDest whereToSendOutput; extern CommandDest whereToSendOutput;
GlobalMemory notifyContext = NULL; GlobalMemory notifyContext = NULL;
...@@ -119,7 +119,7 @@ Async_NotifyHandler(SIGNAL_ARGS) ...@@ -119,7 +119,7 @@ Async_NotifyHandler(SIGNAL_ARGS)
else else
{ {
TPRINTF(TRACE_NOTIFY, "Async_NotifyHandler: " TPRINTF(TRACE_NOTIFY, "Async_NotifyHandler: "
"process in middle of transaction, state=%d, blockstate=%d", "process in middle of transaction, state=%d, blockstate=%d",
CurrentTransactionState->state, CurrentTransactionState->state,
CurrentTransactionState->blockState); CurrentTransactionState->blockState);
notifyFrontEndPending = 1; notifyFrontEndPending = 1;
...@@ -213,13 +213,12 @@ Async_Notify(char *relname) ...@@ -213,13 +213,12 @@ Async_Notify(char *relname)
heap_endscan(sRel); heap_endscan(sRel);
/* /*
* Note: if the write lock is unset we can get multiple tuples * Note: if the write lock is unset we can get multiple tuples with
* with same oid if other backends notify the same relation. * same oid if other backends notify the same relation. Use this
* Use this option at your own risk. * option at your own risk.
*/ */
if (NotifyUnlock) { if (NotifyUnlock)
RelationUnsetLockForWrite(lRel); RelationUnsetLockForWrite(lRel);
}
heap_close(lRel); heap_close(lRel);
...@@ -318,12 +317,13 @@ Async_NotifyAtCommit() ...@@ -318,12 +317,13 @@ Async_NotifyAtCommit()
heap_close(lRel); heap_close(lRel);
/* /*
* Notify the frontend inside the current transaction while * Notify the frontend inside the current transaction while we
* we still have a valid write lock on pg_listeners. This * still have a valid write lock on pg_listeners. This avoid
* avoid waiting until all other backends have finished * waiting until all other backends have finished with
* with pg_listener. * pg_listener.
*/ */
if (notifyFrontEndPending) { if (notifyFrontEndPending)
{
/* The aux version is called inside transaction */ /* The aux version is called inside transaction */
Async_NotifyFrontEnd_Aux(); Async_NotifyFrontEnd_Aux();
} }
...@@ -333,14 +333,14 @@ Async_NotifyAtCommit() ...@@ -333,14 +333,14 @@ Async_NotifyAtCommit()
} }
else else
{ {
/* /*
* No notifies issued by us. If notifyFrontEndPending has been set * No notifies issued by us. If notifyFrontEndPending has been
* by Async_NotifyHandler notify the frontend of pending notifies * set by Async_NotifyHandler notify the frontend of pending
* from other backends. * notifies from other backends.
*/ */
if (notifyFrontEndPending) { if (notifyFrontEndPending)
Async_NotifyFrontEnd(); Async_NotifyFrontEnd();
}
} }
ClearPendingNotify(); ClearPendingNotify();
...@@ -368,7 +368,8 @@ Async_NotifyAtCommit() ...@@ -368,7 +368,8 @@ Async_NotifyAtCommit()
void void
Async_NotifyAtAbort() Async_NotifyAtAbort()
{ {
if (pendingNotifies) { if (pendingNotifies)
{
ClearPendingNotify(); ClearPendingNotify();
DLFreeList(pendingNotifies); DLFreeList(pendingNotifies);
} }
...@@ -380,9 +381,7 @@ Async_NotifyAtAbort() ...@@ -380,9 +381,7 @@ Async_NotifyAtAbort()
{ {
/* don't forget to notify front end */ /* don't forget to notify front end */
if (notifyFrontEndPending) if (notifyFrontEndPending)
{
Async_NotifyFrontEnd(); Async_NotifyFrontEnd();
}
} }
} }
...@@ -423,7 +422,8 @@ Async_Listen(char *relname, int pid) ...@@ -423,7 +422,8 @@ Async_Listen(char *relname, int pid)
char *relnamei; char *relnamei;
TupleDesc tupDesc; TupleDesc tupDesc;
if (whereToSendOutput != Remote) { if (whereToSendOutput != Remote)
{
elog(NOTICE, "Async_Listen: " elog(NOTICE, "Async_Listen: "
"listen not available on interactive sessions"); "listen not available on interactive sessions");
return; return;
...@@ -459,7 +459,8 @@ Async_Listen(char *relname, int pid) ...@@ -459,7 +459,8 @@ Async_Listen(char *relname, int pid)
if (pid == MyProcPid) if (pid == MyProcPid)
alreadyListener = 1; alreadyListener = 1;
} }
if (alreadyListener) { if (alreadyListener)
{
/* No need to scan the rest of the table */ /* No need to scan the rest of the table */
break; break;
} }
...@@ -521,7 +522,8 @@ Async_Unlisten(char *relname, int pid) ...@@ -521,7 +522,8 @@ Async_Unlisten(char *relname, int pid)
HeapTuple lTuple; HeapTuple lTuple;
/* Handle specially the `unlisten "*"' command */ /* Handle specially the `unlisten "*"' command */
if ((!relname) || (*relname == '\0') || (strcmp(relname,"*")==0)) { if ((!relname) || (*relname == '\0') || (strcmp(relname, "*") == 0))
{
Async_UnlistenAll(); Async_UnlistenAll();
return; return;
} }
...@@ -575,15 +577,13 @@ Async_UnlistenAll() ...@@ -575,15 +577,13 @@ Async_UnlistenAll()
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, key); sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, key);
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0))) while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
{
heap_delete(lRel, &lTuple->t_ctid); heap_delete(lRel, &lTuple->t_ctid);
}
heap_endscan(sRel); heap_endscan(sRel);
RelationUnsetLockForWrite(lRel); RelationUnsetLockForWrite(lRel);
heap_close(lRel); heap_close(lRel);
TPRINTF(TRACE_NOTIFY, "Async_UnlistenAll: done"); TPRINTF(TRACE_NOTIFY, "Async_UnlistenAll: done");
} }
/* /*
* -------------------------------------------------------------- * --------------------------------------------------------------
* Async_UnlistenOnExit -- * Async_UnlistenOnExit --
...@@ -654,7 +654,7 @@ Async_NotifyFrontEnd_Aux() ...@@ -654,7 +654,7 @@ Async_NotifyFrontEnd_Aux()
#define MAX_DONE 64 #define MAX_DONE 64
char *done[MAX_DONE]; char *done[MAX_DONE];
int ndone = 0; int ndone = 0;
int i; int i;
...@@ -687,13 +687,16 @@ Async_NotifyFrontEnd_Aux() ...@@ -687,13 +687,16 @@ Async_NotifyFrontEnd_Aux()
&isnull); &isnull);
/* /*
* This hack deletes duplicate tuples which can be left * This hack deletes duplicate tuples which can be left in the
* in the table if the NotifyUnlock option is set. * table if the NotifyUnlock option is set. I'm further
* I'm further investigating this. -- dz * investigating this. -- dz
*/ */
if (NotifyHack) { if (NotifyHack)
for (i=0; i<ndone; i++) { {
if (strcmp(DatumGetName(d)->data, done[i]) == 0) { for (i = 0; i < ndone; i++)
{
if (strcmp(DatumGetName(d)->data, done[i]) == 0)
{
TPRINTF(TRACE_NOTIFY, TPRINTF(TRACE_NOTIFY,
"Async_NotifyFrontEnd: duplicate %s", "Async_NotifyFrontEnd: duplicate %s",
DatumGetName(d)->data); DatumGetName(d)->data);
...@@ -701,9 +704,8 @@ Async_NotifyFrontEnd_Aux() ...@@ -701,9 +704,8 @@ Async_NotifyFrontEnd_Aux()
continue; continue;
} }
} }
if (ndone < MAX_DONE) { if (ndone < MAX_DONE)
done[ndone++] = pstrdup(DatumGetName(d)->data); done[ndone++] = pstrdup(DatumGetName(d)->data);
}
} }
rTuple = heap_modifytuple(lTuple, lRel, value, nulls, repl); rTuple = heap_modifytuple(lTuple, lRel, value, nulls, repl);
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.30 1998/09/01 03:21:52 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.31 1998/09/01 04:27:44 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include <optimizer/internal.h> #include <optimizer/internal.h>
#ifndef NO_SECURITY #ifndef NO_SECURITY
#include <utils/acl.h> #include <utils/acl.h>
#endif /* !NO_SECURITY */ #endif /* !NO_SECURITY */
static Relation copy_heap(Oid OIDOldHeap); static Relation copy_heap(Oid OIDOldHeap);
static void copy_index(Oid OIDOldIndex, Oid OIDNewHeap); static void copy_index(Oid OIDOldIndex, Oid OIDNewHeap);
...@@ -128,7 +128,8 @@ cluster(char *oldrelname, char *oldindexname) ...@@ -128,7 +128,8 @@ cluster(char *oldrelname, char *oldindexname)
elog(ERROR, "cluster: unknown relation: \"%s\"", elog(ERROR, "cluster: unknown relation: \"%s\"",
oldrelname); oldrelname);
} }
OIDOldHeap = RelationGetRelid(OldHeap);/* Get OID for the index scan */ OIDOldHeap = RelationGetRelid(OldHeap); /* Get OID for the index
* scan */
OldIndex = index_openr(oldindexname); /* Open old index relation */ OldIndex = index_openr(oldindexname); /* Open old index relation */
if (!RelationIsValid(OldIndex)) if (!RelationIsValid(OldIndex))
...@@ -136,7 +137,7 @@ cluster(char *oldrelname, char *oldindexname) ...@@ -136,7 +137,7 @@ cluster(char *oldrelname, char *oldindexname)
elog(ERROR, "cluster: unknown index: \"%s\"", elog(ERROR, "cluster: unknown index: \"%s\"",
oldindexname); oldindexname);
} }
OIDOldIndex = RelationGetRelid(OldIndex); /* OID for the index scan */ OIDOldIndex = RelationGetRelid(OldIndex); /* OID for the index scan */
heap_close(OldHeap); heap_close(OldHeap);
index_close(OldIndex); index_close(OldIndex);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.31 1998/09/01 03:21:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.32 1998/09/01 04:27:46 momjian Exp $
* *
* NOTES * NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated * The PortalExecutorHeapMemory crap needs to be eliminated
...@@ -422,16 +422,16 @@ PerformAddAttribute(char *relationName, ...@@ -422,16 +422,16 @@ PerformAddAttribute(char *relationName,
int attnelems; int attnelems;
tup = SearchSysCacheTuple(ATTNAME, tup = SearchSysCacheTuple(ATTNAME,
ObjectIdGetDatum(reltup->t_oid), ObjectIdGetDatum(reltup->t_oid),
PointerGetDatum(colDef->colname), PointerGetDatum(colDef->colname),
0, 0); 0, 0);
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
{ {
heap_close(attrdesc); heap_close(attrdesc);
heap_close(rel); heap_close(rel);
elog(ERROR, "PerformAddAttribute: attribute \"%s\" already exists in class \"%s\"", elog(ERROR, "PerformAddAttribute: attribute \"%s\" already exists in class \"%s\"",
colDef->colname, relationName); colDef->colname, relationName);
} }
/* /*
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.58 1998/09/01 03:21:55 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.59 1998/09/01 04:27:47 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -52,8 +52,7 @@ static Oid GetOutputFunction(Oid type); ...@@ -52,8 +52,7 @@ static Oid GetOutputFunction(Oid type);
static Oid GetTypeElement(Oid type); static Oid GetTypeElement(Oid type);
static Oid GetInputFunction(Oid type); static Oid GetInputFunction(Oid type);
static Oid IsTypeByVal(Oid type); static Oid IsTypeByVal(Oid type);
static void static void GetIndexRelations(Oid main_relation_oid,
GetIndexRelations(Oid main_relation_oid,
int *n_indices, int *n_indices,
Relation **index_rels); Relation **index_rels);
...@@ -108,17 +107,17 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe, ...@@ -108,17 +107,17 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
the class. the class.
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
static FILE *fp; /* static for cleanup */ static FILE *fp; /* static for cleanup */
static bool file_opened = false; /* static for cleanup */ static bool file_opened = false; /* static for cleanup */
Relation rel; Relation rel;
extern char *UserName; /* defined in global.c */ extern char *UserName; /* defined in global.c */
const AclMode required_access = from ? ACL_WR : ACL_RD; const AclMode required_access = from ? ACL_WR : ACL_RD;
int result; int result;
/* /*
* Close previous file opened for COPY but failed with elog(). * Close previous file opened for COPY but failed with elog(). There
* There should be a better way, but would not be modular. * should be a better way, but would not be modular. Prevents file
* Prevents file descriptor leak. bjm 1998/08/29 * descriptor leak. bjm 1998/08/29
*/ */
if (file_opened) if (file_opened)
FreeFile(fp); FreeFile(fp);
...@@ -449,7 +448,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim) ...@@ -449,7 +448,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
itupdescArr[i] = RelationGetDescr(index_rels[i]); itupdescArr[i] = RelationGetDescr(index_rels[i]);
pgIndexTup = pgIndexTup =
SearchSysCacheTuple(INDEXRELID, SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(index_rels[i])), ObjectIdGetDatum(RelationGetRelid(index_rels[i])),
0, 0, 0); 0, 0, 0);
Assert(pgIndexTup); Assert(pgIndexTup);
pgIndexP[i] = (Form_pg_index) GETSTRUCT(pgIndexTup); pgIndexP[i] = (Form_pg_index) GETSTRUCT(pgIndexTup);
...@@ -500,7 +499,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim) ...@@ -500,7 +499,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
/* SetSlotShouldFree(slot, false); */ /* SetSlotShouldFree(slot, false); */
slot->ttc_buffer = (Buffer) NULL; slot->ttc_buffer = (Buffer) NULL;
slot->ttc_shouldFree = false; slot->ttc_shouldFree = false;
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
} }
else else
...@@ -766,7 +765,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim) ...@@ -766,7 +765,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
/* SetSlotContents(slot, tuple); */ /* SetSlotContents(slot, tuple); */
if (ExecQual((List *) indexPred[i], econtext) == false) if (ExecQual((List *) indexPred[i], econtext) == false)
continue; continue;
#endif /* OMIT_PARTIAL_INDEX */ #endif /* OMIT_PARTIAL_INDEX */
} }
FormIndexDatum(indexNatts[i], FormIndexDatum(indexNatts[i],
(AttrNumber *) &(pgIndexP[i]->indkey[0]), (AttrNumber *) &(pgIndexP[i]->indkey[0]),
...@@ -1022,11 +1021,13 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim) ...@@ -1022,11 +1021,13 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
char c; char c;
int done = 0; int done = 0;
int i = 0; int i = 0;
#ifdef MULTIBYTE #ifdef MULTIBYTE
int mblen; int mblen;
int encoding; int encoding;
unsigned char s[2]; unsigned char s[2];
int j; int j;
#endif #endif
#ifdef MULTIBYTE #ifdef MULTIBYTE
...@@ -1136,22 +1137,23 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim) ...@@ -1136,22 +1137,23 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
if (!done) if (!done)
attribute[i++] = c; attribute[i++] = c;
#ifdef MULTIBYTE #ifdef MULTIBYTE
s[0] = c; s[0] = c;
mblen = pg_encoding_mblen(encoding, s); mblen = pg_encoding_mblen(encoding, s);
mblen--; mblen--;
for(j=0;j<mblen;j++) { for (j = 0; j < mblen; j++)
c = getc(fp); {
if (feof(fp)) c = getc(fp);
return NULL; if (feof(fp))
attribute[i++] = c; return NULL;
} attribute[i++] = c;
}
#endif #endif
if (i == EXT_ATTLEN - 1) if (i == EXT_ATTLEN - 1)
elog(ERROR, "CopyReadAttribute - attribute length too long. line: %d", lineno); elog(ERROR, "CopyReadAttribute - attribute length too long. line: %d", lineno);
} }
attribute[i] = '\0'; attribute[i] = '\0';
#ifdef MULTIBYTE #ifdef MULTIBYTE
return(pg_client_to_server((unsigned char*)attribute, strlen(attribute))); return (pg_client_to_server((unsigned char *) attribute, strlen(attribute)));
#else #else
return &attribute[0]; return &attribute[0];
#endif #endif
...@@ -1160,13 +1162,14 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim) ...@@ -1160,13 +1162,14 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
static void static void
CopyAttributeOut(FILE *fp, char *server_string, char *delim, int is_array) CopyAttributeOut(FILE *fp, char *server_string, char *delim, int is_array)
{ {
char *string; char *string;
char c; char c;
#ifdef MULTIBYTE #ifdef MULTIBYTE
int mblen; int mblen;
int encoding; int encoding;
int i; int i;
#endif #endif
#ifdef MULTIBYTE #ifdef MULTIBYTE
...@@ -1178,7 +1181,7 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim, int is_array) ...@@ -1178,7 +1181,7 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim, int is_array)
#ifdef MULTIBYTE #ifdef MULTIBYTE
for (; (mblen = pg_encoding_mblen(encoding, string)) && for (; (mblen = pg_encoding_mblen(encoding, string)) &&
((c = *string) != '\0'); string += mblen) ((c = *string) != '\0'); string += mblen)
#else #else
for (; (c = *string) != '\0'; string++) for (; (c = *string) != '\0'; string++)
#endif #endif
...@@ -1204,9 +1207,8 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim, int is_array) ...@@ -1204,9 +1207,8 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim, int is_array)
} }
} }
#ifdef MULTIBYTE #ifdef MULTIBYTE
for (i=0;i<mblen;i++) { for (i = 0; i < mblen; i++)
fputc(*(string+i), fp); fputc(*(string + i), fp);
}
#else #else
fputc(*string, fp); fputc(*string, fp);
#endif #endif
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.33 1998/09/01 03:21:56 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.34 1998/09/01 04:27:49 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
* ---------------- * ----------------
*/ */
static int static int checkAttrExists(char *attributeName,
checkAttrExists(char *attributeName,
char *attributeType, List *schema); char *attributeType, List *schema);
static List *MergeAttributes(List *schema, List *supers, List **supconstr); static List *MergeAttributes(List *schema, List *supers, List **supconstr);
static void StoreCatalogInheritance(Oid relationId, List *supers); static void StoreCatalogInheritance(Oid relationId, List *supers);
...@@ -404,7 +403,7 @@ StoreCatalogInheritance(Oid relationId, List *supers) ...@@ -404,7 +403,7 @@ StoreCatalogInheritance(Oid relationId, List *supers)
char nullarr[Natts_pg_inherits]; char nullarr[Natts_pg_inherits];
tuple = SearchSysCacheTuple(RELNAME, tuple = SearchSysCacheTuple(RELNAME,
PointerGetDatum(strVal(lfirst(entry))), PointerGetDatum(strVal(lfirst(entry))),
0, 0, 0); 0, 0, 0);
AssertArg(HeapTupleIsValid(tuple)); AssertArg(HeapTupleIsValid(tuple));
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.23 1998/09/01 03:21:57 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.24 1998/09/01 04:27:51 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -36,8 +36,7 @@ ...@@ -36,8 +36,7 @@
/* non-export function prototypes */ /* non-export function prototypes */
static void static void check_permissions(char *command, char *dbpath, char *dbname,
check_permissions(char *command, char *dbpath, char *dbname,
Oid *dbIdP, int4 *userIdP); Oid *dbIdP, int4 *userIdP);
static HeapTuple get_pg_dbtup(char *command, char *dbname, Relation dbrel); static HeapTuple get_pg_dbtup(char *command, char *dbname, Relation dbrel);
static void stop_vacuum(char *dbpath, char *dbname); static void stop_vacuum(char *dbpath, char *dbname);
...@@ -46,7 +45,7 @@ void ...@@ -46,7 +45,7 @@ void
createdb(char *dbname, char *dbpath, int encoding) createdb(char *dbname, char *dbpath, int encoding)
{ {
Oid db_id; Oid db_id;
int4 user_id; int4 user_id;
char buf[512]; char buf[512];
char *lp, char *lp,
loc[512]; loc[512];
...@@ -100,7 +99,7 @@ createdb(char *dbname, char *dbpath, int encoding) ...@@ -100,7 +99,7 @@ createdb(char *dbname, char *dbpath, int encoding)
void void
destroydb(char *dbname) destroydb(char *dbname)
{ {
int4 user_id; int4 user_id;
Oid db_id; Oid db_id;
char *path; char *path;
char dbpath[MAXPGPATH + 1]; char dbpath[MAXPGPATH + 1];
...@@ -203,8 +202,8 @@ check_permissions(char *command, ...@@ -203,8 +202,8 @@ check_permissions(char *command,
userName = GetPgUserName(); userName = GetPgUserName();
utup = SearchSysCacheTuple(USENAME, utup = SearchSysCacheTuple(USENAME,
PointerGetDatum(userName), PointerGetDatum(userName),
0, 0, 0); 0, 0, 0);
*userIdP = ((Form_pg_shadow) GETSTRUCT(utup))->usesysid; *userIdP = ((Form_pg_shadow) GETSTRUCT(utup))->usesysid;
use_super = ((Form_pg_shadow) GETSTRUCT(utup))->usesuper; use_super = ((Form_pg_shadow) GETSTRUCT(utup))->usesuper;
use_createdb = ((Form_pg_shadow) GETSTRUCT(utup))->usecreatedb; use_createdb = ((Form_pg_shadow) GETSTRUCT(utup))->usecreatedb;
...@@ -249,9 +248,9 @@ check_permissions(char *command, ...@@ -249,9 +248,9 @@ check_permissions(char *command,
if (dbfound) if (dbfound)
{ {
dbowner = (int4) heap_getattr(dbtup, dbowner = (int4) heap_getattr(dbtup,
Anum_pg_database_datdba, Anum_pg_database_datdba,
RelationGetDescr(dbrel), RelationGetDescr(dbrel),
(char *) NULL); (char *) NULL);
*dbIdP = dbtup->t_oid; *dbIdP = dbtup->t_oid;
dbtext = (text *) heap_getattr(dbtup, dbtext = (text *) heap_getattr(dbtup,
Anum_pg_database_datpath, Anum_pg_database_datpath,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.25 1998/09/01 03:21:58 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.26 1998/09/01 04:27:52 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -41,16 +41,13 @@ ...@@ -41,16 +41,13 @@
/* non-export function prototypes */ /* non-export function prototypes */
static void CheckPredicate(List *predList, List *rangeTable, Oid baseRelOid); static void CheckPredicate(List *predList, List *rangeTable, Oid baseRelOid);
static void static void CheckPredExpr(Node *predicate, List *rangeTable,
CheckPredExpr(Node *predicate, List *rangeTable,
Oid baseRelOid); Oid baseRelOid);
static void static void
CheckPredClause(Expr *predicate, List *rangeTable, Oid baseRelOid); CheckPredClause(Expr *predicate, List *rangeTable, Oid baseRelOid);
static void static void FuncIndexArgs(IndexElem *funcIndex, AttrNumber *attNumP,
FuncIndexArgs(IndexElem *funcIndex, AttrNumber *attNumP,
Oid *argTypes, Oid *opOidP, Oid relId); Oid *argTypes, Oid *opOidP, Oid relId);
static void static void NormIndexAttrs(List *attList, AttrNumber *attNumP,
NormIndexAttrs(List *attList, AttrNumber *attNumP,
Oid *opOidP, Oid relId); Oid *opOidP, Oid relId);
static char *GetDefaultOpClass(Oid atttypid); static char *GetDefaultOpClass(Oid atttypid);
...@@ -197,7 +194,7 @@ DefineIndex(char *heapRelationName, ...@@ -197,7 +194,7 @@ DefineIndex(char *heapRelationName,
else else
{ {
attributeNumberA = (AttrNumber *) palloc(numberOfAttributes * attributeNumberA = (AttrNumber *) palloc(numberOfAttributes *
sizeof attributeNumberA[0]); sizeof attributeNumberA[0]);
classObjectId = classObjectId =
(Oid *) palloc(numberOfAttributes * sizeof classObjectId[0]); (Oid *) palloc(numberOfAttributes * sizeof classObjectId[0]);
...@@ -468,7 +465,8 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */ ...@@ -468,7 +465,8 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
Oid relId) Oid relId)
{ {
List *rest; List *rest;
HeapTuple atttuple, tuple; HeapTuple atttuple,
tuple;
/* /*
* process attributeList * process attributeList
...@@ -485,9 +483,9 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */ ...@@ -485,9 +483,9 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
elog(ERROR, "missing attribute for define index"); elog(ERROR, "missing attribute for define index");
atttuple = SearchSysCacheTupleCopy(ATTNAME, atttuple = SearchSysCacheTupleCopy(ATTNAME,
ObjectIdGetDatum(relId), ObjectIdGetDatum(relId),
PointerGetDatum(attribute->name), PointerGetDatum(attribute->name),
0, 0); 0, 0);
if (!HeapTupleIsValid(atttuple)) if (!HeapTupleIsValid(atttuple))
{ {
elog(ERROR, elog(ERROR,
...@@ -502,8 +500,8 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */ ...@@ -502,8 +500,8 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
if (attribute->typename == NULL) if (attribute->typename == NULL)
{ {
tuple = SearchSysCacheTuple(TYPOID, tuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(attform->atttypid), ObjectIdGetDatum(attform->atttypid),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "create index: type for attribute '%s' undefined", elog(ERROR, "create index: type for attribute '%s' undefined",
attribute->name); attribute->name);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.23 1998/08/04 16:43:54 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.24 1998/09/01 04:27:53 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -83,7 +83,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest) ...@@ -83,7 +83,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
if (es->printNodes) if (es->printNodes)
s = nodeToString(plan); s = nodeToString(plan);
if (es->printCost) if (es->printCost)
{ {
s2 = Explain_PlanToString(plan, es); s2 = Explain_PlanToString(plan, es);
...@@ -107,7 +107,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest) ...@@ -107,7 +107,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
len -= ELOG_MAXLEN - 64; len -= ELOG_MAXLEN - 64;
} }
if (es->printNodes) if (es->printNodes)
pprint(plan); /* display in postmaster log file */ pprint(plan); /* display in postmaster log file */
pfree(es); pfree(es);
} }
...@@ -123,7 +123,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest) ...@@ -123,7 +123,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
static void static void
explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es) explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
{ {
List *l; List *l;
Relation relation; Relation relation;
char *pname; char *pname;
char buf[1000]; char buf[1000];
...@@ -280,11 +280,11 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es) ...@@ -280,11 +280,11 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
List *saved_rtable = es->rtable; List *saved_rtable = es->rtable;
List *lst; List *lst;
int whichplan = 0; int whichplan = 0;
Append *appendplan = (Append *)plan; Append *appendplan = (Append *) plan;
foreach(lst, appendplan->appendplans) foreach(lst, appendplan->appendplans)
{ {
Plan *subnode = (Plan *)lfirst(lst); Plan *subnode = (Plan *) lfirst(lst);
if (appendplan->inheritrelid > 0) if (appendplan->inheritrelid > 0)
{ {
......
...@@ -162,8 +162,8 @@ DropProceduralLanguage(DropPLangStmt *stmt) ...@@ -162,8 +162,8 @@ DropProceduralLanguage(DropPLangStmt *stmt)
case_translate_language_name(stmt->plname, languageName); case_translate_language_name(stmt->plname, languageName);
langTup = SearchSysCacheTupleCopy(LANNAME, langTup = SearchSysCacheTupleCopy(LANNAME,
PointerGetDatum(languageName), PointerGetDatum(languageName),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(langTup)) if (!HeapTupleIsValid(langTup))
elog(ERROR, "Language %s doesn't exist", languageName); elog(ERROR, "Language %s doesn't exist", languageName);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.23 1998/09/01 03:22:01 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.24 1998/09/01 04:27:56 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -64,39 +64,31 @@ typedef struct _teeInfo ...@@ -64,39 +64,31 @@ typedef struct _teeInfo
QueryTreeList *appendQlist(QueryTreeList *q1, QueryTreeList *q2); QueryTreeList *appendQlist(QueryTreeList *q1, QueryTreeList *q2);
void OffsetVarAttno(Node *node, int varno, int offset); void OffsetVarAttno(Node *node, int varno, int offset);
static void static void appendTeeQuery(TeeInfo * teeInfo,
appendTeeQuery(TeeInfo * teeInfo,
QueryTreeList *q, QueryTreeList *q,
char *teeNodeName); char *teeNodeName);
static Plan * static Plan *replaceTeeScans(Plan *plan,
replaceTeeScans(Plan *plan,
Query *parsetree, Query *parsetree,
TeeInfo * teeInfo); TeeInfo * teeInfo);
static void static void replaceSeqScan(Plan *plan,
replaceSeqScan(Plan *plan,
Plan *parent, Plan *parent,
int rt_ind, int rt_ind,
Plan *tplan); Plan *tplan);
static void static void tg_rewriteQuery(TgRecipe * r, TgNode * n,
tg_rewriteQuery(TgRecipe * r, TgNode * n,
QueryTreeList *q, QueryTreeList *q,
QueryTreeList *inputQlist); QueryTreeList *inputQlist);
static Node * static Node *tg_replaceNumberedParam(Node *expression,
tg_replaceNumberedParam(Node *expression,
int pnum, int pnum,
int rt_ind, int rt_ind,
char *teeRelName); char *teeRelName);
static Node * static Node *tg_rewriteParamsInExpr(Node *expression,
tg_rewriteParamsInExpr(Node *expression,
QueryTreeList *inputQlist); QueryTreeList *inputQlist);
static QueryTreeList * static QueryTreeList *tg_parseSubQuery(TgRecipe * r,
tg_parseSubQuery(TgRecipe * r,
TgNode * n, TgNode * n,
TeeInfo * teeInfo); TeeInfo * teeInfo);
static QueryTreeList * static QueryTreeList *tg_parseTeeNode(TgRecipe * r,
tg_parseTeeNode(TgRecipe * r,
TgNode * n, TgNode * n,
int i, int i,
QueryTreeList *qList, QueryTreeList *qList,
...@@ -193,7 +185,7 @@ beginRecipe(RecipeStmt *stmt) ...@@ -193,7 +185,7 @@ beginRecipe(RecipeStmt *stmt)
#ifdef DEBUG_RECIPE #ifdef DEBUG_RECIPE
elog(NOTICE, "beginRecipe: eyes[%d] = %s\n", i, e->nodeName); elog(NOTICE, "beginRecipe: eyes[%d] = %s\n", i, e->nodeName);
#endif /* DEBUG_RECIPE */ #endif /* DEBUG_RECIPE */
qList = tg_parseSubQuery(r, e->inNodes->val[0], teeInfo); qList = tg_parseSubQuery(r, e->inNodes->val[0], teeInfo);
...@@ -851,7 +843,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo) ...@@ -851,7 +843,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
#ifdef DEBUG_RECIPE #ifdef DEBUG_RECIPE
elog(NOTICE, "calling parser with %s", elem->src); elog(NOTICE, "calling parser with %s", elem->src);
#endif /* DEBUG_RECIPE */ #endif /* DEBUG_RECIPE */
parameterCount = getParamTypes(elem, typev); parameterCount = getParamTypes(elem, typev);
...@@ -894,7 +886,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo) ...@@ -894,7 +886,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
#ifdef DEBUG_RECIPE #ifdef DEBUG_RECIPE
elog(NOTICE, "calling parser with %s", newquery); elog(NOTICE, "calling parser with %s", newquery);
#endif /* DEBUG_RECIPE */ #endif /* DEBUG_RECIPE */
qList = parser(newquery, typev, parameterCount); qList = parser(newquery, typev, parameterCount);
if (qList->len > 1) if (qList->len > 1)
...@@ -1032,8 +1024,8 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo) ...@@ -1032,8 +1024,8 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
tupdesc = rel->rd_att; tupdesc = rel->rd_att;
relid = heap_create_with_catalog( relid = heap_create_with_catalog(
child->nodeElem->outTypes->val[0], child->nodeElem->outTypes->val[0],
tupdesc, RELKIND_RELATION); tupdesc, RELKIND_RELATION);
} }
else else
{ {
...@@ -1056,8 +1048,8 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo) ...@@ -1056,8 +1048,8 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
else else
{ {
relid = heap_create_with_catalog( relid = heap_create_with_catalog(
child->nodeElem->outTypes->val[0], child->nodeElem->outTypes->val[0],
tupdesc, RELKIND_RELATION); tupdesc, RELKIND_RELATION);
} }
} }
} }
...@@ -1338,4 +1330,4 @@ replaceTeeScans(Plan *plan, Query *parsetree, TeeInfo * teeInfo) ...@@ -1338,4 +1330,4 @@ replaceTeeScans(Plan *plan, Query *parsetree, TeeInfo * teeInfo)
#endif /* TIOGA */ #endif /* TIOGA */
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.28 1998/09/01 03:22:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.29 1998/09/01 04:27:57 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -57,7 +57,7 @@ RemoveOperator(char *operatorName, /* operator name */ ...@@ -57,7 +57,7 @@ RemoveOperator(char *operatorName, /* operator name */
bool defined; bool defined;
char *userName; char *userName;
char oprtype; char oprtype;
if (typeName1) if (typeName1)
{ {
typeId1 = TypeGet(typeName1, &defined); typeId1 = TypeGet(typeName1, &defined);
...@@ -86,11 +86,11 @@ RemoveOperator(char *operatorName, /* operator name */ ...@@ -86,11 +86,11 @@ RemoveOperator(char *operatorName, /* operator name */
oprtype = 'r'; oprtype = 'r';
tup = SearchSysCacheTupleCopy(OPRNAME, tup = SearchSysCacheTupleCopy(OPRNAME,
PointerGetDatum(operatorName), PointerGetDatum(operatorName),
ObjectIdGetDatum(typeId1), ObjectIdGetDatum(typeId1),
ObjectIdGetDatum(typeId2), ObjectIdGetDatum(typeId2),
CharGetDatum(oprtype)); CharGetDatum(oprtype));
relation = heap_openr(OperatorRelationName); relation = heap_openr(OperatorRelationName);
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
{ {
...@@ -150,7 +150,7 @@ SingleOpOperatorRemove(Oid typeOid) ...@@ -150,7 +150,7 @@ SingleOpOperatorRemove(Oid typeOid)
int i; int i;
ScanKeyEntryInitialize(&key[0], ScanKeyEntryInitialize(&key[0],
0, 0, F_OIDEQ, (Datum) typeOid); 0, 0, F_OIDEQ, (Datum) typeOid);
rel = heap_openr(OperatorRelationName); rel = heap_openr(OperatorRelationName);
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i)
{ {
...@@ -192,7 +192,7 @@ AttributeAndRelationRemove(Oid typeOid) ...@@ -192,7 +192,7 @@ AttributeAndRelationRemove(Oid typeOid)
*/ */
ScanKeyEntryInitialize(&key[0], ScanKeyEntryInitialize(&key[0],
0, 3, F_OIDEQ, (Datum) typeOid); 0, 3, F_OIDEQ, (Datum) typeOid);
oidptr = (struct oidlist *) palloc(sizeof(*oidptr)); oidptr = (struct oidlist *) palloc(sizeof(*oidptr));
oidptr->next = NULL; oidptr->next = NULL;
...@@ -232,7 +232,7 @@ AttributeAndRelationRemove(Oid typeOid) ...@@ -232,7 +232,7 @@ AttributeAndRelationRemove(Oid typeOid)
heap_close(rel); heap_close(rel);
} }
#endif /* NOTYET */ #endif /* NOTYET */
/* /*
* TypeRemove * TypeRemove
...@@ -257,15 +257,15 @@ RemoveType(char *typeName) /* type name to be removed */ ...@@ -257,15 +257,15 @@ RemoveType(char *typeName) /* type name to be removed */
relation = heap_openr(TypeRelationName); relation = heap_openr(TypeRelationName);
tup = SearchSysCacheTuple(TYPNAME, tup = SearchSysCacheTuple(TYPNAME,
PointerGetDatum(typeName), PointerGetDatum(typeName),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
{ {
heap_close(relation); heap_close(relation);
elog(ERROR, "RemoveType: type '%s' does not exist", typeName); elog(ERROR, "RemoveType: type '%s' does not exist", typeName);
} }
relation = heap_openr(TypeRelationName); relation = heap_openr(TypeRelationName);
typeOid = tup->t_oid; typeOid = tup->t_oid;
heap_delete(relation, &tup->t_ctid); heap_delete(relation, &tup->t_ctid);
...@@ -273,8 +273,8 @@ RemoveType(char *typeName) /* type name to be removed */ ...@@ -273,8 +273,8 @@ RemoveType(char *typeName) /* type name to be removed */
/* Now, Delete the "array of" that type */ /* Now, Delete the "array of" that type */
shadow_type = makeArrayTypeName(typeName); shadow_type = makeArrayTypeName(typeName);
tup = SearchSysCacheTuple(TYPNAME, tup = SearchSysCacheTuple(TYPNAME,
PointerGetDatum(shadow_type), PointerGetDatum(shadow_type),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
{ {
heap_close(relation); heap_close(relation);
...@@ -308,7 +308,7 @@ RemoveFunction(char *functionName, /* function name to be removed */ ...@@ -308,7 +308,7 @@ RemoveFunction(char *functionName, /* function name to be removed */
char *typename; char *typename;
int i; int i;
MemSet(argList, 0, 8 * sizeof(Oid)); MemSet(argList, 0, 8 * sizeof(Oid));
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
...@@ -340,10 +340,10 @@ RemoveFunction(char *functionName, /* function name to be removed */ ...@@ -340,10 +340,10 @@ RemoveFunction(char *functionName, /* function name to be removed */
relation = heap_openr(ProcedureRelationName); relation = heap_openr(ProcedureRelationName);
tup = SearchSysCacheTuple(PRONAME, tup = SearchSysCacheTuple(PRONAME,
PointerGetDatum(functionName), PointerGetDatum(functionName),
Int32GetDatum(nargs), Int32GetDatum(nargs),
PointerGetDatum(argList), PointerGetDatum(argList),
0); 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
{ {
...@@ -353,8 +353,8 @@ RemoveFunction(char *functionName, /* function name to be removed */ ...@@ -353,8 +353,8 @@ RemoveFunction(char *functionName, /* function name to be removed */
if ((((Form_pg_proc) GETSTRUCT(tup))->prolang) == INTERNALlanguageId) if ((((Form_pg_proc) GETSTRUCT(tup))->prolang) == INTERNALlanguageId)
{ {
heap_close(relation); heap_close(relation);
elog(ERROR, "RemoveFunction: function \"%s\" is built-in",functionName); elog(ERROR, "RemoveFunction: function \"%s\" is built-in", functionName);
} }
heap_delete(relation, &tup->t_ctid); heap_delete(relation, &tup->t_ctid);
...@@ -410,9 +410,9 @@ RemoveAggregate(char *aggName, char *aggType) ...@@ -410,9 +410,9 @@ RemoveAggregate(char *aggName, char *aggType)
relation = heap_openr(AggregateRelationName); relation = heap_openr(AggregateRelationName);
tup = SearchSysCacheTuple(AGGNAME, tup = SearchSysCacheTuple(AGGNAME,
PointerGetDatum(aggName), PointerGetDatum(aggName),
ObjectIdGetDatum(basetypeID), ObjectIdGetDatum(basetypeID),
0, 0); 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.16 1998/09/01 03:22:04 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.17 1998/09/01 04:27:59 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <optimizer/prep.h> /* for find_all_inheritors */ #include <optimizer/prep.h> /* for find_all_inheritors */
#ifndef NO_SECURITY #ifndef NO_SECURITY
#include <utils/acl.h> #include <utils/acl.h>
#endif /* !NO_SECURITY */ #endif /* !NO_SECURITY */
#ifndef HAVE_MEMMOVE #ifndef HAVE_MEMMOVE
#include <regex/utils.h> #include <regex/utils.h>
#else #else
...@@ -73,7 +73,7 @@ renameatt(char *relname, ...@@ -73,7 +73,7 @@ renameatt(char *relname,
newatttup; newatttup;
Relation irelations[Num_pg_attr_indices]; Relation irelations[Num_pg_attr_indices];
Oid relid; Oid relid;
/* /*
* permissions checking. this would normally be done in utility.c, * permissions checking. this would normally be done in utility.c,
* but this particular routine is recursive. * but this particular routine is recursive.
...@@ -111,12 +111,10 @@ renameatt(char *relname, ...@@ -111,12 +111,10 @@ renameatt(char *relname,
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(reltup)) if (!HeapTupleIsValid(reltup))
{
elog(ERROR, "renameatt: unknown relation: \"%s\"", relname); elog(ERROR, "renameatt: unknown relation: \"%s\"", relname);
}
myrelid = reltup->t_oid; myrelid = reltup->t_oid;
/* this routine is actually in the planner */ /* this routine is actually in the planner */
children = find_all_inheritors(lconsi(myrelid, NIL), NIL); children = find_all_inheritors(lconsi(myrelid, NIL), NIL);
...@@ -127,7 +125,7 @@ renameatt(char *relname, ...@@ -127,7 +125,7 @@ renameatt(char *relname,
*/ */
foreach(child, children) foreach(child, children)
{ {
char childname[NAMEDATALEN]; char childname[NAMEDATALEN];
childrelid = lfirsti(child); childrelid = lfirsti(child);
if (childrelid == myrelid) if (childrelid == myrelid)
...@@ -142,10 +140,10 @@ renameatt(char *relname, ...@@ -142,10 +140,10 @@ renameatt(char *relname,
} }
/* make copy of cache value, could disappear in call */ /* make copy of cache value, could disappear in call */
StrNCpy(childname, StrNCpy(childname,
((Form_pg_class) GETSTRUCT(reltup))->relname.data, ((Form_pg_class) GETSTRUCT(reltup))->relname.data,
NAMEDATALEN); NAMEDATALEN);
/* no more recursion! */ /* no more recursion! */
renameatt(childname, oldattname, newattname, userName, 0); renameatt(childname, oldattname, newattname, userName, 0);
} }
} }
...@@ -158,9 +156,9 @@ renameatt(char *relname, ...@@ -158,9 +156,9 @@ renameatt(char *relname,
relid = reltup->t_oid; relid = reltup->t_oid;
oldatttup = SearchSysCacheTupleCopy(ATTNAME, oldatttup = SearchSysCacheTupleCopy(ATTNAME,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
PointerGetDatum(oldattname), PointerGetDatum(oldattname),
0, 0); 0, 0);
if (!HeapTupleIsValid(oldatttup)) if (!HeapTupleIsValid(oldatttup))
elog(ERROR, "renameatt: attribute \"%s\" nonexistent", oldattname); elog(ERROR, "renameatt: attribute \"%s\" nonexistent", oldattname);
...@@ -168,9 +166,9 @@ renameatt(char *relname, ...@@ -168,9 +166,9 @@ renameatt(char *relname,
elog(ERROR, "renameatt: system attribute \"%s\" not renamed", oldattname); elog(ERROR, "renameatt: system attribute \"%s\" not renamed", oldattname);
newatttup = SearchSysCacheTuple(ATTNAME, newatttup = SearchSysCacheTuple(ATTNAME,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
PointerGetDatum(newattname), PointerGetDatum(newattname),
0, 0); 0, 0);
/* should not already exist */ /* should not already exist */
if (HeapTupleIsValid(newatttup)) if (HeapTupleIsValid(newatttup))
{ {
...@@ -179,7 +177,7 @@ renameatt(char *relname, ...@@ -179,7 +177,7 @@ renameatt(char *relname,
} }
StrNCpy((((Form_pg_attribute) (GETSTRUCT(oldatttup)))->attname.data), StrNCpy((((Form_pg_attribute) (GETSTRUCT(oldatttup)))->attname.data),
newattname, NAMEDATALEN); newattname, NAMEDATALEN);
attrelation = heap_openr(AttributeRelationName); attrelation = heap_openr(AttributeRelationName);
heap_replace(attrelation, &oldatttup->t_ctid, oldatttup); heap_replace(attrelation, &oldatttup->t_ctid, oldatttup);
...@@ -212,13 +210,13 @@ renameatt(char *relname, ...@@ -212,13 +210,13 @@ renameatt(char *relname,
void void
renamerel(char *oldrelname, char *newrelname) renamerel(char *oldrelname, char *newrelname)
{ {
Relation relrelation; /* for RELATION relation */ Relation relrelation; /* for RELATION relation */
HeapTuple oldreltup, HeapTuple oldreltup,
newreltup; newreltup;
char oldpath[MAXPGPATH], char oldpath[MAXPGPATH],
newpath[MAXPGPATH]; newpath[MAXPGPATH];
Relation irelations[Num_pg_class_indices]; Relation irelations[Num_pg_class_indices];
if (IsSystemRelationName(oldrelname)) if (IsSystemRelationName(oldrelname))
elog(ERROR, "renamerel: system relation \"%s\" not renamed", elog(ERROR, "renamerel: system relation \"%s\" not renamed",
oldrelname); oldrelname);
...@@ -228,14 +226,14 @@ renamerel(char *oldrelname, char *newrelname) ...@@ -228,14 +226,14 @@ renamerel(char *oldrelname, char *newrelname)
newrelname); newrelname);
oldreltup = SearchSysCacheTupleCopy(RELNAME, oldreltup = SearchSysCacheTupleCopy(RELNAME,
PointerGetDatum(oldrelname), PointerGetDatum(oldrelname),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(oldreltup)) if (!HeapTupleIsValid(oldreltup))
elog(ERROR, "renamerel: relation \"%s\" does not exist", oldrelname); elog(ERROR, "renamerel: relation \"%s\" does not exist", oldrelname);
newreltup = SearchSysCacheTuple(RELNAME, newreltup = SearchSysCacheTuple(RELNAME,
PointerGetDatum(newrelname), PointerGetDatum(newrelname),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(newreltup)) if (HeapTupleIsValid(newreltup))
elog(ERROR, "renamerel: relation \"%s\" exists", newrelname); elog(ERROR, "renamerel: relation \"%s\" exists", newrelname);
...@@ -246,7 +244,7 @@ renamerel(char *oldrelname, char *newrelname) ...@@ -246,7 +244,7 @@ renamerel(char *oldrelname, char *newrelname)
elog(ERROR, "renamerel: unable to rename file: %s", oldpath); elog(ERROR, "renamerel: unable to rename file: %s", oldpath);
StrNCpy((((Form_pg_class) GETSTRUCT(oldreltup))->relname.data), StrNCpy((((Form_pg_class) GETSTRUCT(oldreltup))->relname.data),
newrelname, NAMEDATALEN); newrelname, NAMEDATALEN);
/* insert fixed rel tuple */ /* insert fixed rel tuple */
relrelation = heap_openr(RelationRelationName); relrelation = heap_openr(RelationRelationName);
......
...@@ -316,9 +316,9 @@ currval(struct varlena * seqin) ...@@ -316,9 +316,9 @@ currval(struct varlena * seqin)
int4 int4
setval(struct varlena * seqin, int4 next) setval(struct varlena * seqin, int4 next)
{ {
char *seqname = textout(seqin); char *seqname = textout(seqin);
SeqTable elm; SeqTable elm;
Buffer buf; Buffer buf;
Form_pg_sequence seq; Form_pg_sequence seq;
ItemPointerData iptr; ItemPointerData iptr;
...@@ -329,17 +329,20 @@ setval(struct varlena * seqin, int4 next) ...@@ -329,17 +329,20 @@ setval(struct varlena * seqin, int4 next)
#endif #endif
/* open and WIntentLock sequence */ /* open and WIntentLock sequence */
elm = init_sequence ("setval", seqname); elm = init_sequence("setval", seqname);
seq = read_info ("setval", elm, &buf); /* lock page and read tuple */ seq = read_info("setval", elm, &buf); /* lock page and read
* tuple */
if ( seq->cache_value != 1 ) { if (seq->cache_value != 1)
elog (ERROR, "%s.setval: can't set value of sequence %s, cache != 1", {
seqname, seqname); elog(ERROR, "%s.setval: can't set value of sequence %s, cache != 1",
seqname, seqname);
} }
if ((next < seq->min_value) || (next > seq->max_value)) { if ((next < seq->min_value) || (next > seq->max_value))
elog (ERROR, "%s.setval: value %d is of of bounds (%d,%d)", {
seqname, next, seq->min_value, seq->max_value); elog(ERROR, "%s.setval: value %d is of of bounds (%d,%d)",
seqname, next, seq->min_value, seq->max_value);
} }
/* save info in local cache */ /* save info in local cache */
...@@ -350,11 +353,11 @@ setval(struct varlena * seqin, int4 next) ...@@ -350,11 +353,11 @@ setval(struct varlena * seqin, int4 next)
seq->last_value = next; /* last fetched number */ seq->last_value = next; /* last fetched number */
seq->is_called = 't'; seq->is_called = 't';
if ( WriteBuffer (buf) == STATUS_ERROR ) if (WriteBuffer(buf) == STATUS_ERROR)
elog (ERROR, "%s.settval: WriteBuffer failed", seqname); elog(ERROR, "%s.settval: WriteBuffer failed", seqname);
ItemPointerSet(&iptr, 0, FirstOffsetNumber); ItemPointerSet(&iptr, 0, FirstOffsetNumber);
RelationUnsetSingleWLockPage (elm->rel, &iptr); RelationUnsetSingleWLockPage(elm->rel, &iptr);
return next; return next;
} }
......
...@@ -40,8 +40,7 @@ void RelationBuildTriggers(Relation relation); ...@@ -40,8 +40,7 @@ void RelationBuildTriggers(Relation relation);
void FreeTriggerDesc(Relation relation); void FreeTriggerDesc(Relation relation);
static void DescribeTrigger(TriggerDesc *trigdesc, Trigger *trigger); static void DescribeTrigger(TriggerDesc *trigdesc, Trigger *trigger);
static HeapTuple static HeapTuple GetTupleForTrigger(Relation relation, ItemPointer tid,
GetTupleForTrigger(Relation relation, ItemPointer tid,
bool before); bool before);
extern GlobalMemory CacheCxt; extern GlobalMemory CacheCxt;
...@@ -220,8 +219,8 @@ CreateTrigger(CreateTrigStmt *stmt) ...@@ -220,8 +219,8 @@ CreateTrigger(CreateTrigStmt *stmt)
/* update pg_class */ /* update pg_class */
tuple = SearchSysCacheTupleCopy(RELNAME, tuple = SearchSysCacheTupleCopy(RELNAME,
PointerGetDatum(stmt->relname), PointerGetDatum(stmt->relname),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "CreateTrigger: relation %s not found in pg_class", stmt->relname); elog(ERROR, "CreateTrigger: relation %s not found in pg_class", stmt->relname);
...@@ -258,7 +257,7 @@ DropTrigger(DropTrigStmt *stmt) ...@@ -258,7 +257,7 @@ DropTrigger(DropTrigStmt *stmt)
MemoryContext oldcxt; MemoryContext oldcxt;
int found = 0; int found = 0;
int tgfound = 0; int tgfound = 0;
#ifndef NO_SECURITY #ifndef NO_SECURITY
if (!pg_ownercheck(GetPgUserName(), stmt->relname, RELNAME)) if (!pg_ownercheck(GetPgUserName(), stmt->relname, RELNAME))
elog(ERROR, "%s: %s", stmt->relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]); elog(ERROR, "%s: %s", stmt->relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
...@@ -298,8 +297,8 @@ DropTrigger(DropTrigStmt *stmt) ...@@ -298,8 +297,8 @@ DropTrigger(DropTrigStmt *stmt)
heap_close(tgrel); heap_close(tgrel);
tuple = SearchSysCacheTupleCopy(RELNAME, tuple = SearchSysCacheTupleCopy(RELNAME,
PointerGetDatum(stmt->relname), PointerGetDatum(stmt->relname),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "DropTrigger: relation %s not found in pg_class", stmt->relname); elog(ERROR, "DropTrigger: relation %s not found in pg_class", stmt->relname);
......
...@@ -263,7 +263,7 @@ AlterUser(AlterUserStmt *stmt) ...@@ -263,7 +263,7 @@ AlterUser(AlterUserStmt *stmt)
{ {
RelationUnsetLockForWrite(pg_shadow_rel); RelationUnsetLockForWrite(pg_shadow_rel);
heap_close(pg_shadow_rel); heap_close(pg_shadow_rel);
UserAbortTransactionBlock(); /* needed? */ UserAbortTransactionBlock(); /* needed? */
elog(ERROR, "alterUser: user \"%s\" does not exist", stmt->user); elog(ERROR, "alterUser: user \"%s\" does not exist", stmt->user);
return; return;
} }
...@@ -430,8 +430,8 @@ RemoveUser(char *user) ...@@ -430,8 +430,8 @@ RemoveUser(char *user)
* tables, views, etc owned by the user. * tables, views, etc owned by the user.
* *
* The second option would be to create a means of deleting tables, view, * The second option would be to create a means of deleting tables, view,
* etc. owned by the user from other databases. pg_shadow is global and * etc. owned by the user from other databases. pg_shadow is global
* so this must be done at some point. * and so this must be done at some point.
* *
* Let us not forget that the user should be removed from the pg_groups * Let us not forget that the user should be removed from the pg_groups
* also. * also.
...@@ -466,8 +466,8 @@ CheckPgUserAclNotNull() ...@@ -466,8 +466,8 @@ CheckPgUserAclNotNull()
HeapTuple htup; HeapTuple htup;
htup = SearchSysCacheTuple(RELNAME, htup = SearchSysCacheTuple(RELNAME,
PointerGetDatum(ShadowRelationName), PointerGetDatum(ShadowRelationName),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(htup)) if (!HeapTupleIsValid(htup))
{ {
elog(ERROR, "IsPgUserAclNull: class \"%s\" not found", elog(ERROR, "IsPgUserAclNull: class \"%s\" not found",
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.79 1998/09/01 03:22:08 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.80 1998/09/01 04:28:05 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -288,7 +288,7 @@ vc_getrels(NameData *VacRelP) ...@@ -288,7 +288,7 @@ vc_getrels(NameData *VacRelP)
else else
{ {
ScanKeyEntryInitialize(&key, 0x0, Anum_pg_class_relkind, ScanKeyEntryInitialize(&key, 0x0, Anum_pg_class_relkind,
F_CHAREQ, CharGetDatum('r')); F_CHAREQ, CharGetDatum('r'));
} }
portalmem = PortalGetVariableMemory(vc_portal); portalmem = PortalGetVariableMemory(vc_portal);
...@@ -377,16 +377,16 @@ vc_vacone(Oid relid, bool analyze, List *va_cols) ...@@ -377,16 +377,16 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
HeapTuple tuple, HeapTuple tuple,
typetuple; typetuple;
Relation onerel; Relation onerel;
VPageListData vacuum_pages; /* List of pages to vacuum and/or clean VPageListData vacuum_pages; /* List of pages to vacuum and/or clean
* indices */ * indices */
VPageListData fraged_pages; /* List of pages with space enough for VPageListData fraged_pages; /* List of pages with space enough for
* re-using */ * re-using */
VPageDescr *vpp; VPageDescr *vpp;
Relation *Irel; Relation *Irel;
int32 nindices, int32 nindices,
i; i;
VRelStats *vacrelstats; VRelStats *vacrelstats;
StartTransactionCommand(); StartTransactionCommand();
rel = heap_openr(RelationRelationName); rel = heap_openr(RelationRelationName);
...@@ -397,8 +397,8 @@ vc_vacone(Oid relid, bool analyze, List *va_cols) ...@@ -397,8 +397,8 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
* last time we saw it, we don't need to vacuum it. * last time we saw it, we don't need to vacuum it.
*/ */
tuple = SearchSysCacheTuple(RELOID, tuple = SearchSysCacheTuple(RELOID,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{ {
heap_close(rel); heap_close(rel);
...@@ -499,8 +499,8 @@ vc_vacone(Oid relid, bool analyze, List *va_cols) ...@@ -499,8 +499,8 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
stats->f_cmpgt.fn_addr = NULL; stats->f_cmpgt.fn_addr = NULL;
typetuple = SearchSysCacheTuple(TYPOID, typetuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(stats->attr->atttypid), ObjectIdGetDatum(stats->attr->atttypid),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(typetuple)) if (HeapTupleIsValid(typetuple))
stats->outfunc = ((Form_pg_type) GETSTRUCT(typetuple))->typoutput; stats->outfunc = ((Form_pg_type) GETSTRUCT(typetuple))->typoutput;
else else
...@@ -549,13 +549,14 @@ vc_vacone(Oid relid, bool analyze, List *va_cols) ...@@ -549,13 +549,14 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
} }
} }
if (fraged_pages.vpl_num_pages > 0) /* Try to shrink heap */ if (fraged_pages.vpl_num_pages > 0) /* Try to shrink heap */
vc_rpfheap(vacrelstats, onerel, &vacuum_pages, &fraged_pages, nindices, Irel); vc_rpfheap(vacrelstats, onerel, &vacuum_pages, &fraged_pages, nindices, Irel);
else else
{ {
if (Irel != (Relation *) NULL) if (Irel != (Relation *) NULL)
vc_clsindices(nindices, Irel); vc_clsindices(nindices, Irel);
if (vacuum_pages.vpl_num_pages > 0)/* Clean pages from vacuum_pages list */ if (vacuum_pages.vpl_num_pages > 0) /* Clean pages from
* vacuum_pages list */
vc_vacheap(vacrelstats, onerel, &vacuum_pages); vc_vacheap(vacrelstats, onerel, &vacuum_pages);
} }
...@@ -644,7 +645,7 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel, ...@@ -644,7 +645,7 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
vpc->vpd_offsets_used = 0; vpc->vpd_offsets_used = 0;
elog(MESSAGE_LEVEL, "--Relation %s--", relname); elog(MESSAGE_LEVEL, "--Relation %s--", relname);
for (blkno = 0; blkno < nblocks; blkno++) for (blkno = 0; blkno < nblocks; blkno++)
{ {
buf = ReadBuffer(onerel, blkno); buf = ReadBuffer(onerel, blkno);
...@@ -875,8 +876,8 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel, ...@@ -875,8 +876,8 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
fraged_pages->vpl_empty_end_pages = empty_end_pages; fraged_pages->vpl_empty_end_pages = empty_end_pages;
/* /*
* Try to make fraged_pages keeping in mind that we can't use free space of * Try to make fraged_pages keeping in mind that we can't use free
* "empty" end-pages and last page if it reapped. * space of "empty" end-pages and last page if it reapped.
*/ */
if (do_shrinking && vacuum_pages->vpl_num_pages - empty_end_pages > 0) if (do_shrinking && vacuum_pages->vpl_num_pages - empty_end_pages > 0)
{ {
...@@ -1010,9 +1011,9 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel, ...@@ -1010,9 +1011,9 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
isempty = PageIsEmpty(page); isempty = PageIsEmpty(page);
dowrite = false; dowrite = false;
if (blkno == last_vacuum_block) /* it's reapped page */ if (blkno == last_vacuum_block) /* it's reapped page */
{ {
if (last_vacuum_page->vpd_offsets_free > 0) /* there are dead tuples */ if (last_vacuum_page->vpd_offsets_free > 0) /* there are dead tuples */
{ /* on this page - clean */ { /* on this page - clean */
Assert(!isempty); Assert(!isempty);
vc_vacpage(page, last_vacuum_page); vc_vacpage(page, last_vacuum_page);
...@@ -1025,7 +1026,8 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel, ...@@ -1025,7 +1026,8 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
/* get prev reapped page from vacuum_pages */ /* get prev reapped page from vacuum_pages */
last_vacuum_page = vacuum_pages->vpl_pagedesc[vacuumed_pages - 1]; last_vacuum_page = vacuum_pages->vpl_pagedesc[vacuumed_pages - 1];
last_vacuum_block = last_vacuum_page->vpd_blkno; last_vacuum_block = last_vacuum_page->vpd_blkno;
if (blkno == last_fraged_block) /* this page in fraged_pages too */ if (blkno == last_fraged_block) /* this page in
* fraged_pages too */
{ {
--num_fraged_pages; --num_fraged_pages;
Assert(num_fraged_pages > 0); Assert(num_fraged_pages > 0);
...@@ -1080,7 +1082,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel, ...@@ -1080,7 +1082,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
Assert(num_fraged_pages > cur_item + 1); Assert(num_fraged_pages > cur_item + 1);
memmove(fraged_pages->vpl_pagedesc + cur_item, memmove(fraged_pages->vpl_pagedesc + cur_item,
fraged_pages->vpl_pagedesc + cur_item + 1, fraged_pages->vpl_pagedesc + cur_item + 1,
sizeof(VPageDescr *) * (num_fraged_pages - cur_item - 1)); sizeof(VPageDescr *) * (num_fraged_pages - cur_item - 1));
num_fraged_pages--; num_fraged_pages--;
Assert(last_fraged_page == fraged_pages->vpl_pagedesc[num_fraged_pages - 1]); Assert(last_fraged_page == fraged_pages->vpl_pagedesc[num_fraged_pages - 1]);
} }
...@@ -1121,7 +1123,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel, ...@@ -1121,7 +1123,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
elog(ERROR, "\ elog(ERROR, "\
failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)", failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
tuple_len, cur_page->vpd_blkno, cur_page->vpd_free, tuple_len, cur_page->vpd_blkno, cur_page->vpd_free,
cur_page->vpd_offsets_used, cur_page->vpd_offsets_free); cur_page->vpd_offsets_used, cur_page->vpd_offsets_free);
} }
newitemid = PageGetItemId(ToPage, newoff); newitemid = PageGetItemId(ToPage, newoff);
pfree(newtup); pfree(newtup);
...@@ -1145,7 +1147,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)", ...@@ -1145,7 +1147,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
for (i = 0, idcur = Idesc; i < nindices; i++, idcur++) for (i = 0, idcur = Idesc; i < nindices; i++, idcur++)
{ {
FormIndexDatum(idcur->natts, FormIndexDatum(idcur->natts,
(AttrNumber *) &(idcur->tform->indkey[0]), (AttrNumber *) &(idcur->tform->indkey[0]),
newtup, newtup,
tupdesc, tupdesc,
idatum, idatum,
...@@ -1201,8 +1203,8 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)", ...@@ -1201,8 +1203,8 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
} }
/* /*
* Clean uncleaned reapped pages from vacuum_pages list and set xmin committed * Clean uncleaned reapped pages from vacuum_pages list and set xmin
* for inserted tuples * committed for inserted tuples
*/ */
checked_moved = 0; checked_moved = 0;
for (i = 0, vpp = vacuum_pages->vpl_pagedesc; i < vacuumed_pages; i++, vpp++) for (i = 0, vpp = vacuum_pages->vpl_pagedesc; i < vacuumed_pages; i++, vpp++)
...@@ -1320,7 +1322,7 @@ Elapsed %u/%u sec.", ...@@ -1320,7 +1322,7 @@ Elapsed %u/%u sec.",
elog(FATAL, "VACUUM (vc_rpfheap): BlowawayRelationBuffers returned %d", i); elog(FATAL, "VACUUM (vc_rpfheap): BlowawayRelationBuffers returned %d", i);
blkno = smgrtruncate(DEFAULT_SMGR, onerel, blkno); blkno = smgrtruncate(DEFAULT_SMGR, onerel, blkno);
Assert(blkno >= 0); Assert(blkno >= 0);
vacrelstats->num_pages = blkno; /* set new number of blocks */ vacrelstats->num_pages = blkno; /* set new number of blocks */
} }
if (Irel != (Relation *) NULL) /* pfree index' allocations */ if (Irel != (Relation *) NULL) /* pfree index' allocations */
...@@ -1351,7 +1353,8 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages) ...@@ -1351,7 +1353,8 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages)
int i; int i;
nblocks = vacuum_pages->vpl_num_pages; nblocks = vacuum_pages->vpl_num_pages;
nblocks -= vacuum_pages->vpl_empty_end_pages;/* nothing to do with them */ nblocks -= vacuum_pages->vpl_empty_end_pages; /* nothing to do with
* them */
for (i = 0, vpp = vacuum_pages->vpl_pagedesc; i < nblocks; i++, vpp++) for (i = 0, vpp = vacuum_pages->vpl_pagedesc; i < nblocks; i++, vpp++)
{ {
...@@ -1385,7 +1388,8 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages) ...@@ -1385,7 +1388,8 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages)
nblocks = smgrtruncate(DEFAULT_SMGR, onerel, nblocks); nblocks = smgrtruncate(DEFAULT_SMGR, onerel, nblocks);
Assert(nblocks >= 0); Assert(nblocks >= 0);
vacrelstats->num_pages = nblocks; /* set new number of blocks */ vacrelstats->num_pages = nblocks; /* set new number of
* blocks */
} }
} /* vc_vacheap */ } /* vc_vacheap */
...@@ -1555,7 +1559,7 @@ vc_tidreapped(ItemPointer itemptr, VPageList vpl) ...@@ -1555,7 +1559,7 @@ vc_tidreapped(ItemPointer itemptr, VPageList vpl)
vp = &vpd; vp = &vpd;
vpp = (VPageDescr *) vc_find_eq((char *) (vpl->vpl_pagedesc), vpp = (VPageDescr *) vc_find_eq((char *) (vpl->vpl_pagedesc),
vpl->vpl_num_pages, sizeof(VPageDescr), (char *) &vp, vpl->vpl_num_pages, sizeof(VPageDescr), (char *) &vp,
vc_cmp_blk); vc_cmp_blk);
if (vpp == (VPageDescr *) NULL) if (vpp == (VPageDescr *) NULL)
...@@ -1570,7 +1574,7 @@ vc_tidreapped(ItemPointer itemptr, VPageList vpl) ...@@ -1570,7 +1574,7 @@ vc_tidreapped(ItemPointer itemptr, VPageList vpl)
} }
voff = (OffsetNumber *) vc_find_eq((char *) (vp->vpd_offsets), voff = (OffsetNumber *) vc_find_eq((char *) (vp->vpd_offsets),
vp->vpd_offsets_free, sizeof(OffsetNumber), (char *) &ioffno, vp->vpd_offsets_free, sizeof(OffsetNumber), (char *) &ioffno,
vc_cmp_offno); vc_cmp_offno);
if (voff == (OffsetNumber *) NULL) if (voff == (OffsetNumber *) NULL)
...@@ -1746,16 +1750,16 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats * ...@@ -1746,16 +1750,16 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *
ScanKeyData askey; ScanKeyData askey;
Form_pg_attribute attp; Form_pg_attribute attp;
Buffer buffer; Buffer buffer;
/* /*
* update number of tuples and number of pages in pg_class * update number of tuples and number of pages in pg_class
*/ */
rtup = SearchSysCacheTuple(RELOID, rtup = SearchSysCacheTuple(RELOID,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(rtup)) if (!HeapTupleIsValid(rtup))
elog(ERROR, "pg_class entry for relid %d vanished during vacuuming", elog(ERROR, "pg_class entry for relid %d vanished during vacuuming",
relid); relid);
rd = heap_openr(RelationRelationName); rd = heap_openr(RelationRelationName);
...@@ -2207,16 +2211,20 @@ vc_mkindesc(Relation onerel, int nindices, Relation *Irel, IndDesc **Idesc) ...@@ -2207,16 +2211,20 @@ vc_mkindesc(Relation onerel, int nindices, Relation *Irel, IndDesc **Idesc)
AttrNumber *attnumP; AttrNumber *attnumP;
int natts; int natts;
int i; int i;
*Idesc = (IndDesc *) palloc(nindices * sizeof(IndDesc)); *Idesc = (IndDesc *) palloc(nindices * sizeof(IndDesc));
for (i = 0, idcur = *Idesc; i < nindices; i++, idcur++) for (i = 0, idcur = *Idesc; i < nindices; i++, idcur++)
{ {
cachetuple = SearchSysCacheTupleCopy(INDEXRELID, cachetuple = SearchSysCacheTupleCopy(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(Irel[i])), ObjectIdGetDatum(RelationGetRelid(Irel[i])),
0, 0, 0); 0, 0, 0);
Assert(cachetuple); Assert(cachetuple);
/* we never free the copy we make, because Idesc needs it for later */
/*
* we never free the copy we make, because Idesc needs it for
* later
*/
idcur->tform = (Form_pg_index) GETSTRUCT(cachetuple); idcur->tform = (Form_pg_index) GETSTRUCT(cachetuple);
for (attnumP = &(idcur->tform->indkey[0]), natts = 0; for (attnumP = &(idcur->tform->indkey[0]), natts = 0;
*attnumP != InvalidAttrNumber && natts != INDEX_MAX_KEYS; *attnumP != InvalidAttrNumber && natts != INDEX_MAX_KEYS;
...@@ -2247,7 +2255,8 @@ vc_enough_space(VPageDescr vpd, Size len) ...@@ -2247,7 +2255,8 @@ vc_enough_space(VPageDescr vpd, Size len)
if (len > vpd->vpd_free) if (len > vpd->vpd_free)
return false; return false;
if (vpd->vpd_offsets_used < vpd->vpd_offsets_free) /* there are free itemid(s) */ if (vpd->vpd_offsets_used < vpd->vpd_offsets_free) /* there are free
* itemid(s) */
return true; /* and len <= free_space */ return true; /* and len <= free_space */
/* ok. noff_usd >= noff_free and so we'll have to allocate new itemid */ /* ok. noff_usd >= noff_free and so we'll have to allocate new itemid */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO', * Routines for handling of 'SET var TO',
* 'SHOW var' and 'RESET var' statements. * 'SHOW var' and 'RESET var' statements.
* *
* $Id: variable.c,v 1.11 1998/09/01 03:22:10 momjian Exp $ * $Id: variable.c,v 1.12 1998/09/01 04:28:07 momjian Exp $
* *
*/ */
...@@ -554,7 +554,7 @@ struct VariableParsers ...@@ -554,7 +554,7 @@ struct VariableParsers
{ {
"client_encoding", parse_client_encoding, show_client_encoding, reset_client_encoding "client_encoding", parse_client_encoding, show_client_encoding, reset_client_encoding
}, },
{ {
"server_encoding", parse_server_encoding, show_server_encoding, reset_server_encoding "server_encoding", parse_server_encoding, show_server_encoding, reset_server_encoding
}, },
#endif #endif
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.24 1998/08/06 05:12:30 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.25 1998/09/01 04:28:10 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -223,7 +223,7 @@ UpdateRangeTableOfViewParse(char *viewName, Query *viewParse) ...@@ -223,7 +223,7 @@ UpdateRangeTableOfViewParse(char *viewName, Query *viewParse)
OffsetVarNodes(viewParse->qual, 2); OffsetVarNodes(viewParse->qual, 2);
OffsetVarNodes(viewParse->havingQual, 2); OffsetVarNodes(viewParse->havingQual, 2);
/* /*
* find the old range table... * find the old range table...
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.24 1998/07/27 19:37:54 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.25 1998/09/01 04:28:13 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -54,8 +54,7 @@ ...@@ -54,8 +54,7 @@
#include "access/heapam.h" #include "access/heapam.h"
#include "catalog/heap.h" #include "catalog/heap.h"
static Pointer static Pointer ExecBeginScan(Relation relation, int nkeys, ScanKey skeys,
ExecBeginScan(Relation relation, int nkeys, ScanKey skeys,
bool isindex, ScanDirection dir, Snapshot snapshot); bool isindex, ScanDirection dir, Snapshot snapshot);
static Relation ExecOpenR(Oid relationOid, bool isindex); static Relation ExecOpenR(Oid relationOid, bool isindex);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/execFlatten.c,v 1.6 1998/09/01 03:22:11 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/execFlatten.c,v 1.7 1998/09/01 04:28:14 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
#include "executor/execFlatten.h" #include "executor/execFlatten.h"
#ifdef SETS_FIXED #ifdef SETS_FIXED
static bool static bool FjoinBumpOuterNodes(TargetEntry *tlist, ExprContext *econtext,
FjoinBumpOuterNodes(TargetEntry *tlist, ExprContext *econtext,
DatumPtr results, char *nulls); DatumPtr results, char *nulls);
#endif #endif
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.54 1998/09/01 03:22:14 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.55 1998/09/01 04:28:16 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -54,31 +54,25 @@ ...@@ -54,31 +54,25 @@
#include "catalog/heap.h" #include "catalog/heap.h"
#include "commands/trigger.h" #include "commands/trigger.h"
void void ExecCheckPerms(CmdType operation, int resultRelation, List *rangeTable,
ExecCheckPerms(CmdType operation, int resultRelation, List *rangeTable,
Query *parseTree); Query *parseTree);
/* decls for local routines only used within this module */ /* decls for local routines only used within this module */
static TupleDesc static TupleDesc InitPlan(CmdType operation, Query *parseTree,
InitPlan(CmdType operation, Query *parseTree,
Plan *plan, EState *estate); Plan *plan, EState *estate);
static void EndPlan(Plan *plan, EState *estate); static void EndPlan(Plan *plan, EState *estate);
static TupleTableSlot * static TupleTableSlot *ExecutePlan(EState *estate, Plan *plan,
ExecutePlan(EState *estate, Plan *plan,
Query *parseTree, CmdType operation, Query *parseTree, CmdType operation,
int numberTuples, ScanDirection direction, int numberTuples, ScanDirection direction,
void (*printfunc) ()); void (*printfunc) ());
static void ExecRetrieve(TupleTableSlot *slot, void (*printfunc) (), static void ExecRetrieve(TupleTableSlot *slot, void (*printfunc) (),
EState *estate); EState *estate);
static void static void ExecAppend(TupleTableSlot *slot, ItemPointer tupleid,
ExecAppend(TupleTableSlot *slot, ItemPointer tupleid,
EState *estate); EState *estate);
static void static void ExecDelete(TupleTableSlot *slot, ItemPointer tupleid,
ExecDelete(TupleTableSlot *slot, ItemPointer tupleid,
EState *estate); EState *estate);
static void static void ExecReplace(TupleTableSlot *slot, ItemPointer tupleid,
ExecReplace(TupleTableSlot *slot, ItemPointer tupleid,
EState *estate, Query *parseTree); EState *estate, Query *parseTree);
/* end of local decls */ /* end of local decls */
...@@ -124,7 +118,7 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate) ...@@ -124,7 +118,7 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
palloc(queryDesc->plantree->nParamExec * sizeof(ParamExecData)); palloc(queryDesc->plantree->nParamExec * sizeof(ParamExecData));
memset(estate->es_param_exec_vals, 0, queryDesc->plantree->nParamExec * sizeof(ParamExecData)); memset(estate->es_param_exec_vals, 0, queryDesc->plantree->nParamExec * sizeof(ParamExecData));
} }
estate->es_snapshot = SnapshotNow; estate->es_snapshot = SnapshotNow;
result = InitPlan(queryDesc->operation, result = InitPlan(queryDesc->operation,
...@@ -315,8 +309,8 @@ ExecCheckPerms(CmdType operation, ...@@ -315,8 +309,8 @@ ExecCheckPerms(CmdType operation,
relid = rte->relid; relid = rte->relid;
htup = SearchSysCacheTuple(RELOID, htup = SearchSysCacheTuple(RELOID,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(htup)) if (!HeapTupleIsValid(htup))
elog(ERROR, "ExecCheckPerms: bogus RT relid: %d", elog(ERROR, "ExecCheckPerms: bogus RT relid: %d",
relid); relid);
...@@ -521,19 +515,19 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate) ...@@ -521,19 +515,19 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
* NOTE: in the future we might want to initialize the junk * NOTE: in the future we might want to initialize the junk
* filter for all queries. * filter for all queries.
* ---------------- * ----------------
* SELECT added by daveh@insightdist.com 5/20/98 to allow * SELECT added by daveh@insightdist.com 5/20/98 to allow
* ORDER/GROUP BY have an identifier missing from the target. * ORDER/GROUP BY have an identifier missing from the target.
*/ */
{ {
bool junk_filter_needed = false; bool junk_filter_needed = false;
List *tlist; List *tlist;
if (operation == CMD_SELECT) if (operation == CMD_SELECT)
{ {
foreach(tlist, targetList) foreach(tlist, targetList)
{ {
TargetEntry *tle = lfirst(tlist); TargetEntry *tle = lfirst(tlist);
if (tle->resdom->resjunk) if (tle->resdom->resjunk)
{ {
junk_filter_needed = true; junk_filter_needed = true;
...@@ -547,6 +541,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate) ...@@ -547,6 +541,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
(operation == CMD_SELECT && junk_filter_needed)) (operation == CMD_SELECT && junk_filter_needed))
{ {
JunkFilter *j = (JunkFilter *) ExecInitJunkFilter(targetList); JunkFilter *j = (JunkFilter *) ExecInitJunkFilter(targetList);
estate->es_junkFilter = j; estate->es_junkFilter = j;
if (operation == CMD_SELECT) if (operation == CMD_SELECT)
...@@ -555,7 +550,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate) ...@@ -555,7 +550,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
else else
estate->es_junkFilter = NULL; estate->es_junkFilter = NULL;
} }
/* ---------------- /* ----------------
* initialize the "into" relation * initialize the "into" relation
* ---------------- * ----------------
...@@ -588,7 +583,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate) ...@@ -588,7 +583,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
tupdesc = CreateTupleDescCopy(tupType); tupdesc = CreateTupleDescCopy(tupType);
intoRelationId = heap_create_with_catalog(intoName, intoRelationId = heap_create_with_catalog(intoName,
tupdesc, RELKIND_RELATION); tupdesc, RELKIND_RELATION);
FreeTupleDesc(tupdesc); FreeTupleDesc(tupdesc);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.35 1998/09/01 03:22:18 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.36 1998/09/01 04:28:18 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -68,24 +68,19 @@ int execConstLen; ...@@ -68,24 +68,19 @@ int execConstLen;
/* static functions decls */ /* static functions decls */
static Datum ExecEvalAggreg(Aggreg *agg, ExprContext *econtext, bool *isNull); static Datum ExecEvalAggreg(Aggreg *agg, ExprContext *econtext, bool *isNull);
static Datum static Datum ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
bool *isNull, bool *isDone); bool *isNull, bool *isDone);
static Datum ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull); static Datum ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull);
static Datum static Datum ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
bool *isNull, bool *isDone); bool *isNull, bool *isDone);
static void static void ExecEvalFuncArgs(FunctionCachePtr fcache, ExprContext *econtext,
ExecEvalFuncArgs(FunctionCachePtr fcache, ExprContext *econtext,
List *argList, Datum argV[], bool *argIsDone); List *argList, Datum argV[], bool *argIsDone);
static Datum ExecEvalNot(Expr *notclause, ExprContext *econtext, bool *isNull); static Datum ExecEvalNot(Expr *notclause, ExprContext *econtext, bool *isNull);
static Datum static Datum ExecEvalOper(Expr *opClause, ExprContext *econtext,
ExecEvalOper(Expr *opClause, ExprContext *econtext,
bool *isNull); bool *isNull);
static Datum ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull); static Datum ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull);
static Datum ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull); static Datum ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull);
static Datum static Datum ExecMakeFunctionResult(Node *node, List *arguments,
ExecMakeFunctionResult(Node *node, List *arguments,
ExprContext *econtext, bool *isNull, bool *isDone); ExprContext *econtext, bool *isNull, bool *isDone);
static bool ExecQualClause(Node *clause, ExprContext *econtext); static bool ExecQualClause(Node *clause, ExprContext *econtext);
...@@ -200,7 +195,7 @@ ExecEvalArrayRef(ArrayRef *arrayRef, ...@@ -200,7 +195,7 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
static Datum static Datum
ExecEvalAggreg(Aggreg *agg, ExprContext *econtext, bool *isNull) ExecEvalAggreg(Aggreg *agg, ExprContext *econtext, bool *isNull)
{ {
*isNull = econtext->ecxt_nulls[agg->aggno]; *isNull = econtext->ecxt_nulls[agg->aggno];
return econtext->ecxt_values[agg->aggno]; return econtext->ecxt_values[agg->aggno];
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.7 1998/02/26 12:13:09 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.8 1998/09/01 04:28:20 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -106,9 +106,9 @@ ExecScan(Scan *node, ...@@ -106,9 +106,9 @@ ExecScan(Scan *node,
* NULL, then it means there is nothing more to scan * NULL, then it means there is nothing more to scan
* so we just return the empty slot... * so we just return the empty slot...
* *
* ... with invalid TupleDesc (not the same as in * ... with invalid TupleDesc (not the same as in
* projInfo->pi_slot) and break upper MergeJoin node. * projInfo->pi_slot) and break upper MergeJoin node.
* New code below do what ExecProject() does. - vadim 02/26/98 * New code below do what ExecProject() does. - vadim 02/26/98
* ---------------- * ----------------
*/ */
if (TupIsNull(slot)) if (TupIsNull(slot))
...@@ -116,10 +116,10 @@ ExecScan(Scan *node, ...@@ -116,10 +116,10 @@ ExecScan(Scan *node,
scanstate->cstate.cs_TupFromTlist = false; scanstate->cstate.cs_TupFromTlist = false;
resultSlot = scanstate->cstate.cs_ProjInfo->pi_slot; resultSlot = scanstate->cstate.cs_ProjInfo->pi_slot;
return (TupleTableSlot *) return (TupleTableSlot *)
ExecStoreTuple (NULL, ExecStoreTuple(NULL,
resultSlot, resultSlot,
InvalidBuffer, InvalidBuffer,
true); true);
} }
/* ---------------- /* ----------------
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.37 1998/09/01 03:22:21 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.38 1998/09/01 04:28:22 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -57,8 +57,7 @@ ...@@ -57,8 +57,7 @@
#include "utils/lsyscache.h" #include "utils/lsyscache.h"
#include "utils/mcxt.h" #include "utils/mcxt.h"
static void static void ExecGetIndexKeyInfo(Form_pg_index indexTuple, int *numAttsOutP,
ExecGetIndexKeyInfo(Form_pg_index indexTuple, int *numAttsOutP,
AttrNumber **attsOutP, FuncIndexInfoPtr fInfoP); AttrNumber **attsOutP, FuncIndexInfoPtr fInfoP);
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
...@@ -750,7 +749,7 @@ ExecOpenIndices(Oid resultRelationOid, ...@@ -750,7 +749,7 @@ ExecOpenIndices(Oid resultRelationOid,
*/ */
indexSd = heap_beginscan(indexRd, /* scan desc */ indexSd = heap_beginscan(indexRd, /* scan desc */
false, /* scan backward flag */ false, /* scan backward flag */
SnapshotNow, /* NOW snapshot */ SnapshotNow, /* NOW snapshot */
1, /* number scan keys */ 1, /* number scan keys */
&key); /* scan keys */ &key); /* scan keys */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.19 1998/09/01 03:22:22 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.20 1998/09/01 04:28:23 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -57,16 +57,13 @@ typedef struct local_es ...@@ -57,16 +57,13 @@ typedef struct local_es
/* non-export function prototypes */ /* non-export function prototypes */
static TupleDesc postquel_start(execution_state *es); static TupleDesc postquel_start(execution_state *es);
static execution_state * static execution_state *init_execution_state(FunctionCachePtr fcache,
init_execution_state(FunctionCachePtr fcache,
char *args[]); char *args[]);
static TupleTableSlot *postquel_getnext(execution_state *es); static TupleTableSlot *postquel_getnext(execution_state *es);
static void postquel_end(execution_state *es); static void postquel_end(execution_state *es);
static void static void postquel_sub_params(execution_state *es, int nargs,
postquel_sub_params(execution_state *es, int nargs,
char *args[], bool *nullV); char *args[], bool *nullV);
static Datum static Datum postquel_execute(execution_state *es, FunctionCachePtr fcache,
postquel_execute(execution_state *es, FunctionCachePtr fcache,
List *fTlist, char **args, bool *isNull); List *fTlist, char **args, bool *isNull);
......
This diff is collapsed.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.14 1998/07/15 22:16:18 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.15 1998/09/01 04:28:26 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -158,7 +158,7 @@ exec_append_initialize_next(Append *node) ...@@ -158,7 +158,7 @@ exec_append_initialize_next(Append *node)
{ {
estate->es_result_relation_info = estate->es_result_relation_info =
(RelationInfo *) nth(whichplan, (RelationInfo *) nth(whichplan,
appendstate->as_result_relation_info_list); appendstate->as_result_relation_info_list);
} }
result_slot->ttc_whichplan = whichplan; result_slot->ttc_whichplan = whichplan;
...@@ -505,8 +505,8 @@ void ...@@ -505,8 +505,8 @@ void
ExecReScanAppend(Append *node, ExprContext *exprCtxt, Plan *parent) ExecReScanAppend(Append *node, ExprContext *exprCtxt, Plan *parent)
{ {
AppendState *appendstate = node->appendstate; AppendState *appendstate = node->appendstate;
int nplans = length(node->appendplans); int nplans = length(node->appendplans);
int i; int i;
for (i = 0; i < nplans; i++) for (i = 0; i < nplans; i++)
{ {
...@@ -517,7 +517,7 @@ ExecReScanAppend(Append *node, ExprContext *exprCtxt, Plan *parent) ...@@ -517,7 +517,7 @@ ExecReScanAppend(Append *node, ExprContext *exprCtxt, Plan *parent)
if (rescanNode->chgParam == NULL) if (rescanNode->chgParam == NULL)
{ {
exec_append_initialize_next(node); exec_append_initialize_next(node);
ExecReScan((Plan *)rescanNode, exprCtxt, (Plan *) node); ExecReScan((Plan *) rescanNode, exprCtxt, (Plan *) node);
} }
} }
appendstate->as_whichplan = 0; appendstate->as_whichplan = 0;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* columns. (ie. tuples from the same group are consecutive) * columns. (ie. tuples from the same group are consecutive)
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.21 1998/07/16 02:58:09 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.22 1998/09/01 04:28:28 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -30,8 +30,7 @@ ...@@ -30,8 +30,7 @@
static TupleTableSlot *ExecGroupEveryTuple(Group *node); static TupleTableSlot *ExecGroupEveryTuple(Group *node);
static TupleTableSlot *ExecGroupOneTuple(Group *node); static TupleTableSlot *ExecGroupOneTuple(Group *node);
static bool static bool sameGroup(HeapTuple oldslot, HeapTuple newslot,
sameGroup(HeapTuple oldslot, HeapTuple newslot,
int numCols, AttrNumber *grpColIdx, TupleDesc tupdesc); int numCols, AttrNumber *grpColIdx, TupleDesc tupdesc);
/* --------------------------------------- /* ---------------------------------------
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.22 1998/09/01 03:22:23 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.23 1998/09/01 04:28:29 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -45,8 +45,7 @@ static void mk_hj_temp(char *tempname); ...@@ -45,8 +45,7 @@ static void mk_hj_temp(char *tempname);
static int hashFunc(char *key, int len); static int hashFunc(char *key, int len);
static int ExecHashPartition(Hash *node); static int ExecHashPartition(Hash *node);
static RelativeAddr hashTableAlloc(int size, HashJoinTable hashtable); static RelativeAddr hashTableAlloc(int size, HashJoinTable hashtable);
static void static void ExecHashOverflowInsert(HashJoinTable hashtable,
ExecHashOverflowInsert(HashJoinTable hashtable,
HashBucket bucket, HashBucket bucket,
HeapTuple heapTuple); HeapTuple heapTuple);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.12 1998/09/01 03:22:25 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.13 1998/09/01 04:28:31 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -28,12 +28,10 @@ ...@@ -28,12 +28,10 @@
static TupleTableSlot * static TupleTableSlot *
ExecHashJoinOuterGetTuple(Plan *node, Plan *parent, HashJoinState *hjstate); ExecHashJoinOuterGetTuple(Plan *node, Plan *parent, HashJoinState *hjstate);
static TupleTableSlot * static TupleTableSlot *ExecHashJoinGetSavedTuple(HashJoinState *hjstate, char *buffer,
ExecHashJoinGetSavedTuple(HashJoinState *hjstate, char *buffer,
File file, TupleTableSlot *tupleSlot, int *block, char **position); File file, TupleTableSlot *tupleSlot, int *block, char **position);
static int static int ExecHashJoinGetBatch(int bucketno, HashJoinTable hashtable,
ExecHashJoinGetBatch(int bucketno, HashJoinTable hashtable,
int nbatch); int nbatch);
static int ExecHashJoinNewBatch(HashJoinState *hjstate); static int ExecHashJoinNewBatch(HashJoinState *hjstate);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.26 1998/09/01 03:22:26 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.27 1998/09/01 04:28:32 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -85,8 +85,8 @@ IndexNext(IndexScan *node) ...@@ -85,8 +85,8 @@ IndexNext(IndexScan *node)
EState *estate; EState *estate;
CommonScanState *scanstate; CommonScanState *scanstate;
IndexScanState *indexstate; IndexScanState *indexstate;
ScanDirection direction; ScanDirection direction;
Snapshot snapshot; Snapshot snapshot;
IndexScanDescPtr scanDescs; IndexScanDescPtr scanDescs;
IndexScanDesc scandesc; IndexScanDesc scandesc;
Relation heapRelation; Relation heapRelation;
...@@ -95,7 +95,7 @@ IndexNext(IndexScan *node) ...@@ -95,7 +95,7 @@ IndexNext(IndexScan *node)
TupleTableSlot *slot; TupleTableSlot *slot;
Buffer buffer = InvalidBuffer; Buffer buffer = InvalidBuffer;
int numIndices; int numIndices;
/* ---------------- /* ----------------
* extract necessary information from index scan node * extract necessary information from index scan node
* ---------------- * ----------------
...@@ -122,39 +122,40 @@ IndexNext(IndexScan *node) ...@@ -122,39 +122,40 @@ IndexNext(IndexScan *node)
while ((result = index_getnext(scandesc, direction)) != NULL) while ((result = index_getnext(scandesc, direction)) != NULL)
{ {
tuple = heap_fetch(heapRelation, snapshot, tuple = heap_fetch(heapRelation, snapshot,
&result->heap_iptr, &buffer); &result->heap_iptr, &buffer);
pfree(result); pfree(result);
if (tuple != NULL) if (tuple != NULL)
{ {
bool prev_matches = false; bool prev_matches = false;
int prev_index; int prev_index;
/* ---------------- /* ----------------
* store the scanned tuple in the scan tuple slot of * store the scanned tuple in the scan tuple slot of
* the scan state. Eventually we will only do this and not * the scan state. Eventually we will only do this and not
* return a tuple. Note: we pass 'false' because tuples * return a tuple. Note: we pass 'false' because tuples
* returned by amgetnext are pointers onto disk pages and * returned by amgetnext are pointers onto disk pages and
* were not created with palloc() and so should not be pfree()'d. * were not created with palloc() and so should not be pfree()'d.
* ---------------- * ----------------
*/ */
ExecStoreTuple(tuple, /* tuple to store */ ExecStoreTuple(tuple, /* tuple to store */
slot, /* slot to store in */ slot, /* slot to store in */
buffer, /* buffer associated with tuple */ buffer, /* buffer associated with tuple */
false); /* don't pfree */ false); /* don't pfree */
/* /*
* We must check to see if the current tuple would have been * We must check to see if the current tuple would have
* matched by an earlier index, so we don't double report it. * been matched by an earlier index, so we don't double
* We do this by passing the tuple through ExecQual and look * report it. We do this by passing the tuple through
* for failure with all previous qualifications. * ExecQual and look for failure with all previous
* qualifications.
*/ */
for (prev_index = 0; prev_index < indexstate->iss_IndexPtr; for (prev_index = 0; prev_index < indexstate->iss_IndexPtr;
prev_index++) prev_index++)
{ {
scanstate->cstate.cs_ExprContext->ecxt_scantuple = slot; scanstate->cstate.cs_ExprContext->ecxt_scantuple = slot;
if (ExecQual(nth(prev_index, node->indxqual), if (ExecQual(nth(prev_index, node->indxqual),
scanstate->cstate.cs_ExprContext)) scanstate->cstate.cs_ExprContext))
{ {
prev_matches = true; prev_matches = true;
break; break;
...@@ -259,17 +260,16 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent) ...@@ -259,17 +260,16 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
indxqual = node->indxqual; indxqual = node->indxqual;
numScanKeys = indexstate->iss_NumScanKeys; numScanKeys = indexstate->iss_NumScanKeys;
indexstate->iss_IndexPtr = 0; indexstate->iss_IndexPtr = 0;
/* it's possible in subselects */ /* it's possible in subselects */
if (exprCtxt == NULL) if (exprCtxt == NULL)
exprCtxt = node->scan.scanstate->cstate.cs_ExprContext; exprCtxt = node->scan.scanstate->cstate.cs_ExprContext;
node->scan.scanstate->cstate.cs_ExprContext->ecxt_outertuple = node->scan.scanstate->cstate.cs_ExprContext->ecxt_outertuple =
exprCtxt->ecxt_outertuple; exprCtxt->ecxt_outertuple;
/* /*
* get the index qualifications and recalculate the appropriate * get the index qualifications and recalculate the appropriate values
* values
*/ */
for (i = 0; i < numIndices; i++) for (i = 0; i < numIndices; i++)
{ {
...@@ -282,17 +282,19 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent) ...@@ -282,17 +282,19 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
run_keys = (int *) runtimeKeyInfo[i]; run_keys = (int *) runtimeKeyInfo[i];
for (j = 0; j < n_keys; j++) for (j = 0; j < n_keys; j++)
{ {
/* /*
* If we have a run-time key, then extract the run-time * If we have a run-time key, then extract the run-time
* expression and evaluate it with respect to the current * expression and evaluate it with respect to the current
* outer tuple. We then stick the result into the scan key. * outer tuple. We then stick the result into the scan
* key.
*/ */
if (run_keys[j] != NO_OP) if (run_keys[j] != NO_OP)
{ {
clause = nth(j, qual); clause = nth(j, qual);
scanexpr = (run_keys[j] == RIGHT_OP) ? scanexpr = (run_keys[j] == RIGHT_OP) ?
(Node *) get_rightop(clause) : (Node *) get_leftop(clause); (Node *) get_rightop(clause) : (Node *) get_leftop(clause);
/* /*
* pass in isDone but ignore it. We don't iterate in * pass in isDone but ignore it. We don't iterate in
* quals * quals
...@@ -333,7 +335,7 @@ ExecEndIndexScan(IndexScan *node) ...@@ -333,7 +335,7 @@ ExecEndIndexScan(IndexScan *node)
IndexScanState *indexstate; IndexScanState *indexstate;
Pointer *runtimeKeyInfo; Pointer *runtimeKeyInfo;
ScanKey *scanKeys; ScanKey *scanKeys;
List *indxqual; List *indxqual;
int *numScanKeys; int *numScanKeys;
int numIndices; int numIndices;
int i; int i;
...@@ -342,7 +344,7 @@ ExecEndIndexScan(IndexScan *node) ...@@ -342,7 +344,7 @@ ExecEndIndexScan(IndexScan *node)
indexstate = node->indxstate; indexstate = node->indxstate;
indxqual = node->indxqual; indxqual = node->indxqual;
runtimeKeyInfo = (Pointer *) indexstate->iss_RuntimeKeyInfo; runtimeKeyInfo = (Pointer *) indexstate->iss_RuntimeKeyInfo;
/* ---------------- /* ----------------
* extract information from the node * extract information from the node
* ---------------- * ----------------
...@@ -381,7 +383,7 @@ ExecEndIndexScan(IndexScan *node) ...@@ -381,7 +383,7 @@ ExecEndIndexScan(IndexScan *node)
pfree(numScanKeys); pfree(numScanKeys);
if (runtimeKeyInfo) if (runtimeKeyInfo)
{ {
for (i = 0; i < numIndices; i++) for (i = 0; i < numIndices; i++)
{ {
List *qual; List *qual;
...@@ -394,7 +396,7 @@ ExecEndIndexScan(IndexScan *node) ...@@ -394,7 +396,7 @@ ExecEndIndexScan(IndexScan *node)
} }
pfree(runtimeKeyInfo); pfree(runtimeKeyInfo);
} }
/* ---------------- /* ----------------
* clear out tuple table slots * clear out tuple table slots
* ---------------- * ----------------
...@@ -428,7 +430,7 @@ ExecIndexMarkPos(IndexScan *node) ...@@ -428,7 +430,7 @@ ExecIndexMarkPos(IndexScan *node)
#if 0 #if 0
IndexScanMarkPosition(scanDesc); IndexScanMarkPosition(scanDesc);
#endif #endif
index_markpos (scanDesc); index_markpos(scanDesc);
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
...@@ -457,7 +459,7 @@ ExecIndexRestrPos(IndexScan *node) ...@@ -457,7 +459,7 @@ ExecIndexRestrPos(IndexScan *node)
#if 0 #if 0
IndexScanRestorePosition(scanDesc); IndexScanRestorePosition(scanDesc);
#endif #endif
index_restrpos (scanDesc); index_restrpos(scanDesc);
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
...@@ -504,7 +506,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent) ...@@ -504,7 +506,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
HeapScanDesc currentScanDesc; HeapScanDesc currentScanDesc;
ScanDirection direction; ScanDirection direction;
int baseid; int baseid;
List *execParam = NULL; List *execParam = NULL;
/* ---------------- /* ----------------
...@@ -727,22 +729,22 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent) ...@@ -727,22 +729,22 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
* it identifies the value to place in our scan key. * it identifies the value to place in our scan key.
* ---------------- * ----------------
*/ */
/* Life was so easy before ... subselects */ /* Life was so easy before ... subselects */
if ( ((Param *) leftop)->paramkind == PARAM_EXEC ) if (((Param *) leftop)->paramkind == PARAM_EXEC)
{ {
have_runtime_keys = true; have_runtime_keys = true;
run_keys[j] = LEFT_OP; run_keys[j] = LEFT_OP;
execParam = lappendi (execParam, ((Param*) leftop)->paramid); execParam = lappendi(execParam, ((Param *) leftop)->paramid);
} }
else else
{ {
scanvalue = ExecEvalParam((Param *) leftop, scanvalue = ExecEvalParam((Param *) leftop,
scanstate->cstate.cs_ExprContext, scanstate->cstate.cs_ExprContext,
&isnull); &isnull);
if (isnull) if (isnull)
flags |= SK_ISNULL; flags |= SK_ISNULL;
run_keys[j] = NO_OP; run_keys[j] = NO_OP;
} }
} }
...@@ -820,22 +822,22 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent) ...@@ -820,22 +822,22 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
* it identifies the value to place in our scan key. * it identifies the value to place in our scan key.
* ---------------- * ----------------
*/ */
/* Life was so easy before ... subselects */ /* Life was so easy before ... subselects */
if ( ((Param *) rightop)->paramkind == PARAM_EXEC ) if (((Param *) rightop)->paramkind == PARAM_EXEC)
{ {
have_runtime_keys = true; have_runtime_keys = true;
run_keys[j] = RIGHT_OP; run_keys[j] = RIGHT_OP;
execParam = lappendi (execParam, ((Param*) rightop)->paramid); execParam = lappendi(execParam, ((Param *) rightop)->paramid);
} }
else else
{ {
scanvalue = ExecEvalParam((Param *) rightop, scanvalue = ExecEvalParam((Param *) rightop,
scanstate->cstate.cs_ExprContext, scanstate->cstate.cs_ExprContext,
&isnull); &isnull);
if (isnull) if (isnull)
flags |= SK_ISNULL; flags |= SK_ISNULL;
run_keys[j] = NO_OP; run_keys[j] = NO_OP;
} }
} }
...@@ -992,13 +994,13 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent) ...@@ -992,13 +994,13 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
indexstate->iss_ScanDescs = scanDescs; indexstate->iss_ScanDescs = scanDescs;
indexstate->cstate.cs_TupFromTlist = false; indexstate->cstate.cs_TupFromTlist = false;
/* /*
* if there are some PARAM_EXEC in skankeys then * if there are some PARAM_EXEC in skankeys then force index rescan on
* force index rescan on first scan. * first scan.
*/ */
((Plan*) node)->chgParam = execParam; ((Plan *) node)->chgParam = execParam;
/* ---------------- /* ----------------
* all done. * all done.
* ---------------- * ----------------
...@@ -1010,5 +1012,5 @@ int ...@@ -1010,5 +1012,5 @@ int
ExecCountSlotsIndexScan(IndexScan *node) ExecCountSlotsIndexScan(IndexScan *node)
{ {
return ExecCountSlotsNode(outerPlan((Plan *) node)) + return ExecCountSlotsNode(outerPlan((Plan *) node)) +
ExecCountSlotsNode(innerPlan((Plan *) node)) + INDEXSCAN_NSLOTS; ExecCountSlotsNode(innerPlan((Plan *) node)) + INDEXSCAN_NSLOTS;
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.16 1998/09/01 03:22:27 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.17 1998/09/01 04:28:34 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -173,7 +173,7 @@ ExecMaterial(Material *node) ...@@ -173,7 +173,7 @@ ExecMaterial(Material *node)
return ExecStoreTuple(heapTuple, /* tuple to store */ return ExecStoreTuple(heapTuple, /* tuple to store */
slot, /* slot to store in */ slot, /* slot to store in */
currentScanDesc->rs_cbuf, /* buffer for this tuple */ currentScanDesc->rs_cbuf, /* buffer for this tuple */
false); /* don't pfree this pointer */ false); /* don't pfree this pointer */
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.18 1998/07/19 10:05:19 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.19 1998/09/01 04:28:35 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -480,8 +480,8 @@ ExecMergeJoin(MergeJoin *node) ...@@ -480,8 +480,8 @@ ExecMergeJoin(MergeJoin *node)
* means that this is the first time ExecMergeJoin() has * means that this is the first time ExecMergeJoin() has
* been called and so we have to initialize the inner, * been called and so we have to initialize the inner,
* outer and marked tuples as well as various stuff in the * outer and marked tuples as well as various stuff in the
* expression context. * expression context. ********************************
* ******************************** *
*/ */
case EXEC_MJ_INITIALIZE: case EXEC_MJ_INITIALIZE:
MJ_printf("ExecMergeJoin: EXEC_MJ_INITIALIZE\n"); MJ_printf("ExecMergeJoin: EXEC_MJ_INITIALIZE\n");
...@@ -514,7 +514,7 @@ ExecMergeJoin(MergeJoin *node) ...@@ -514,7 +514,7 @@ ExecMergeJoin(MergeJoin *node)
mergestate->mj_MarkedTupleSlot->ttc_tupleDescriptor = mergestate->mj_MarkedTupleSlot->ttc_tupleDescriptor =
innerTupleSlot->ttc_tupleDescriptor; innerTupleSlot->ttc_tupleDescriptor;
/* ---------------- /* ----------------
* initialize merge join state to skip inner tuples. * initialize merge join state to skip inner tuples.
* ---------------- * ----------------
...@@ -526,8 +526,8 @@ ExecMergeJoin(MergeJoin *node) ...@@ -526,8 +526,8 @@ ExecMergeJoin(MergeJoin *node)
* ******************************** EXEC_MJ_JOINMARK means * ******************************** EXEC_MJ_JOINMARK means
* we have just found a new outer tuple and a possible * we have just found a new outer tuple and a possible
* matching inner tuple. This is the case after the * matching inner tuple. This is the case after the
* INITIALIZE, SKIPOUTER or SKIPINNER states. * INITIALIZE, SKIPOUTER or SKIPINNER states. ********************************
* ******************************** *
*/ */
case EXEC_MJ_JOINMARK: case EXEC_MJ_JOINMARK:
MJ_printf("ExecMergeJoin: EXEC_MJ_JOINMARK\n"); MJ_printf("ExecMergeJoin: EXEC_MJ_JOINMARK\n");
...@@ -655,8 +655,8 @@ ExecMergeJoin(MergeJoin *node) ...@@ -655,8 +655,8 @@ ExecMergeJoin(MergeJoin *node)
break; break;
/* /*
* ******************************** EXEC_MJ_TESTOUTER * ******************************** EXEC_MJ_TESTOUTER If
* If the new outer tuple and the marked tuple satisify the * the new outer tuple and the marked tuple satisify the
* merge clause then we know we have duplicates in the * merge clause then we know we have duplicates in the
* outer scan so we have to restore the inner scan to the * outer scan so we have to restore the inner scan to the
* marked tuple and proceed to join the new outer tuples * marked tuple and proceed to join the new outer tuples
...@@ -680,7 +680,9 @@ ExecMergeJoin(MergeJoin *node) ...@@ -680,7 +680,9 @@ ExecMergeJoin(MergeJoin *node)
* *
* new outer tuple > marked tuple * new outer tuple > marked tuple
* *
* **************************** ***************************
*
*
*/ */
case EXEC_MJ_TESTOUTER: case EXEC_MJ_TESTOUTER:
MJ_printf("ExecMergeJoin: EXEC_MJ_TESTOUTER\n"); MJ_printf("ExecMergeJoin: EXEC_MJ_TESTOUTER\n");
...@@ -698,13 +700,14 @@ ExecMergeJoin(MergeJoin *node) ...@@ -698,13 +700,14 @@ ExecMergeJoin(MergeJoin *node)
if (qualResult) if (qualResult)
{ {
/*
* the merge clause matched so now we juggle the slots /*
* back the way they were and proceed to JOINTEST. * the merge clause matched so now we juggle the slots
* back the way they were and proceed to JOINTEST.
* *
* I can't understand why we have to go to JOINTEST * I can't understand why we have to go to JOINTEST and
* and compare outer tuple with the same inner one * compare outer tuple with the same inner one again
* again -> go to JOINTUPLES... - vadim 02/27/98 * -> go to JOINTUPLES... - vadim 02/27/98
*/ */
ExecRestrPos(innerPlan); ExecRestrPos(innerPlan);
...@@ -738,7 +741,7 @@ ExecMergeJoin(MergeJoin *node) ...@@ -738,7 +741,7 @@ ExecMergeJoin(MergeJoin *node)
return NULL; return NULL;
} }
/* continue on to skip outer tuples */ /* continue on to skip outer tuples */
mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER; mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
} }
break; break;
...@@ -756,7 +759,9 @@ ExecMergeJoin(MergeJoin *node) ...@@ -756,7 +759,9 @@ ExecMergeJoin(MergeJoin *node)
* we have to advance the outer scan until we find the outer * we have to advance the outer scan until we find the outer
* 8. * 8.
* *
**************************** **************************
*
*
* *
* *
* *
...@@ -856,7 +861,9 @@ ExecMergeJoin(MergeJoin *node) ...@@ -856,7 +861,9 @@ ExecMergeJoin(MergeJoin *node)
* we have to advance the inner scan until we find the inner * we have to advance the inner scan until we find the inner
* 12. * 12.
* *
**************************** **************************
*
*
* *
* *
* *
...@@ -988,10 +995,10 @@ bool ...@@ -988,10 +995,10 @@ bool
ExecInitMergeJoin(MergeJoin *node, EState *estate, Plan *parent) ExecInitMergeJoin(MergeJoin *node, EState *estate, Plan *parent)
{ {
MergeJoinState *mergestate; MergeJoinState *mergestate;
List *joinclauses; List *joinclauses;
RegProcedure rightsortop; RegProcedure rightsortop;
RegProcedure leftsortop; RegProcedure leftsortop;
RegProcedure sortop; RegProcedure sortop;
TupleTableSlot *mjSlot; TupleTableSlot *mjSlot;
List *OSortopI; List *OSortopI;
...@@ -1042,7 +1049,7 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate, Plan *parent) ...@@ -1042,7 +1049,7 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate, Plan *parent)
mjSlot->ttc_whichplan = -1; mjSlot->ttc_whichplan = -1;
mjSlot->ttc_descIsNew = true; mjSlot->ttc_descIsNew = true;
mergestate->mj_MarkedTupleSlot = mjSlot; mergestate->mj_MarkedTupleSlot = mjSlot;
/* ---------------- /* ----------------
* get merge sort operators. * get merge sort operators.
* *
...@@ -1166,9 +1173,9 @@ ExecEndMergeJoin(MergeJoin *node) ...@@ -1166,9 +1173,9 @@ ExecEndMergeJoin(MergeJoin *node)
*/ */
ExecClearTuple(mergestate->jstate.cs_ResultTupleSlot); ExecClearTuple(mergestate->jstate.cs_ResultTupleSlot);
ExecClearTuple(mergestate->mj_MarkedTupleSlot); ExecClearTuple(mergestate->mj_MarkedTupleSlot);
pfree (mergestate->mj_MarkedTupleSlot); pfree(mergestate->mj_MarkedTupleSlot);
mergestate->mj_MarkedTupleSlot = NULL; mergestate->mj_MarkedTupleSlot = NULL;
MJ1_printf("ExecEndMergeJoin: %s\n", MJ1_printf("ExecEndMergeJoin: %s\n",
"node processing ended"); "node processing ended");
} }
...@@ -1185,12 +1192,12 @@ ExecReScanMergeJoin(MergeJoin *node, ExprContext *exprCtxt, Plan *parent) ...@@ -1185,12 +1192,12 @@ ExecReScanMergeJoin(MergeJoin *node, ExprContext *exprCtxt, Plan *parent)
mjSlot->ttc_tupleDescriptor = NULL; mjSlot->ttc_tupleDescriptor = NULL;
mjSlot->ttc_whichplan = -1; mjSlot->ttc_whichplan = -1;
mjSlot->ttc_descIsNew = true; mjSlot->ttc_descIsNew = true;
mergestate->mj_JoinState = EXEC_MJ_INITIALIZE; mergestate->mj_JoinState = EXEC_MJ_INITIALIZE;
/* /*
* if chgParam of subnodes is not null then plans will be re-scanned by * if chgParam of subnodes is not null then plans will be re-scanned
* first ExecProcNode. * by first ExecProcNode.
*/ */
if (((Plan *) node)->lefttree->chgParam == NULL) if (((Plan *) node)->lefttree->chgParam == NULL)
ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node); ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.13 1998/09/01 03:22:28 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.14 1998/09/01 04:28:37 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -30,8 +30,7 @@ ...@@ -30,8 +30,7 @@
#include "access/heapam.h" #include "access/heapam.h"
#include "parser/parsetree.h" #include "parser/parsetree.h"
static Oid static Oid InitScanRelation(SeqScan *node, EState *estate,
InitScanRelation(SeqScan *node, EState *estate,
CommonScanState *scanstate, Plan *outerPlan); CommonScanState *scanstate, Plan *outerPlan);
static TupleTableSlot *SeqNext(SeqScan *node); static TupleTableSlot *SeqNext(SeqScan *node);
...@@ -83,7 +82,8 @@ SeqNext(SeqScan *node) ...@@ -83,7 +82,8 @@ SeqNext(SeqScan *node)
slot = ExecStoreTuple(tuple,/* tuple to store */ slot = ExecStoreTuple(tuple,/* tuple to store */
slot, /* slot to store in */ slot, /* slot to store in */
scandesc->rs_cbuf,/* buffer associated with this tuple */ scandesc->rs_cbuf, /* buffer associated with
* this tuple */
false); /* don't pfree this pointer */ false); /* don't pfree this pointer */
/* ---------------- /* ----------------
......
...@@ -112,8 +112,8 @@ ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent) ...@@ -112,8 +112,8 @@ ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent)
{ {
EState *sp_estate = CreateExecutorState(); EState *sp_estate = CreateExecutorState();
ExecCheckPerms (CMD_SELECT, 0, node->rtable, (Query*) NULL); ExecCheckPerms(CMD_SELECT, 0, node->rtable, (Query *) NULL);
sp_estate->es_range_table = node->rtable; sp_estate->es_range_table = node->rtable;
sp_estate->es_param_list_info = estate->es_param_list_info; sp_estate->es_param_list_info = estate->es_param_list_info;
sp_estate->es_param_exec_vals = estate->es_param_exec_vals; sp_estate->es_param_exec_vals = estate->es_param_exec_vals;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* ExecEndTee * ExecEndTee
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.22 1998/09/01 03:22:32 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.23 1998/09/01 04:28:40 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -168,8 +168,8 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent) ...@@ -168,8 +168,8 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent)
bufferRel = heap_openr(teeState->tee_bufferRelname); bufferRel = heap_openr(teeState->tee_bufferRelname);
else else
bufferRel = heap_open( bufferRel = heap_open(
heap_create_with_catalog(teeState->tee_bufferRelname, heap_create_with_catalog(teeState->tee_bufferRelname,
tupType, RELKIND_RELATION)); tupType, RELKIND_RELATION));
} }
else else
{ {
...@@ -178,8 +178,8 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent) ...@@ -178,8 +178,8 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent)
newoid()); newoid());
/* bufferRel = ExecCreatR(len, tupType, _TEMP_RELATION_ID); */ /* bufferRel = ExecCreatR(len, tupType, _TEMP_RELATION_ID); */
bufferRel = heap_open( bufferRel = heap_open(
heap_create_with_catalog(teeState->tee_bufferRelname, heap_create_with_catalog(teeState->tee_bufferRelname,
tupType, RELKIND_RELATION)); tupType, RELKIND_RELATION));
} }
teeState->tee_bufferRel = bufferRel; teeState->tee_bufferRel = bufferRel;
...@@ -228,11 +228,11 @@ ExecCountSlotsTee(Tee *node) ...@@ -228,11 +228,11 @@ ExecCountSlotsTee(Tee *node)
static void static void
initTeeScanDescs(Tee *node) initTeeScanDescs(Tee *node)
{ {
TeeState *teeState; TeeState *teeState;
Relation bufferRel; Relation bufferRel;
ScanDirection dir; ScanDirection dir;
Snapshot snapshot; Snapshot snapshot;
MemoryContext orig; MemoryContext orig;
teeState = node->teestate; teeState = node->teestate;
if (teeState->tee_leftScanDesc && teeState->tee_rightScanDesc) if (teeState->tee_leftScanDesc && teeState->tee_rightScanDesc)
...@@ -250,18 +250,18 @@ initTeeScanDescs(Tee *node) ...@@ -250,18 +250,18 @@ initTeeScanDescs(Tee *node)
{ {
teeState->tee_leftScanDesc = heap_beginscan(bufferRel, teeState->tee_leftScanDesc = heap_beginscan(bufferRel,
ScanDirectionIsBackward(dir), ScanDirectionIsBackward(dir),
snapshot, snapshot,
0, /* num scan keys */ 0, /* num scan keys */
NULL /* scan keys */ NULL /* scan keys */
); );
} }
if (teeState->tee_rightScanDesc == NULL) if (teeState->tee_rightScanDesc == NULL)
{ {
teeState->tee_rightScanDesc = heap_beginscan(bufferRel, teeState->tee_rightScanDesc = heap_beginscan(bufferRel,
ScanDirectionIsBackward(dir), ScanDirectionIsBackward(dir),
snapshot, snapshot,
0, /* num scan keys */ 0, /* num scan keys */
NULL /* scan keys */ NULL /* scan keys */
); );
} }
...@@ -365,7 +365,7 @@ ExecTee(Tee *node, Plan *parent) ...@@ -365,7 +365,7 @@ ExecTee(Tee *node, Plan *parent)
HeapTuple throwAway; HeapTuple throwAway;
/* Buffer buffer; */ /* Buffer buffer; */
throwAway = heap_getnext(scanDesc,ScanDirectionIsBackward(dir)); throwAway = heap_getnext(scanDesc, ScanDirectionIsBackward(dir));
} }
/* /*
...@@ -406,7 +406,7 @@ ExecTee(Tee *node, Plan *parent) ...@@ -406,7 +406,7 @@ ExecTee(Tee *node, Plan *parent)
result = ExecStoreTuple(heapTuple, /* tuple to store */ result = ExecStoreTuple(heapTuple, /* tuple to store */
slot, /* slot to store in */ slot, /* slot to store in */
scanDesc->rs_cbuf, /* this tuple's buffer */ scanDesc->rs_cbuf, /* this tuple's buffer */
false); /* don't free stuff from false); /* don't free stuff from
* heap_getnext */ * heap_getnext */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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