diff options
Diffstat (limited to 'src/backend/access')
26 files changed, 279 insertions, 263 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index be725418021..2a07be49f8e 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.50 1999/03/14 20:17:20 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.51 1999/05/25 16:06:35 momjian Exp $ * * NOTES * The old interface functions have been converted to macros @@ -124,7 +124,7 @@ DataFill(char *data, *bitP |= bitmask; } - data = (char *)att_align((long)data, att[i]->attlen, att[i]->attalign); + data = (char *) att_align((long) data, att[i]->attlen, att[i]->attalign); switch (att[i]->attlen) { case -1: @@ -151,7 +151,7 @@ DataFill(char *data, att[i]->attlen); break; } - data = (char *)att_addlength((long)data, att[i]->attlen, value[i]); + data = (char *) att_addlength((long) data, att[i]->attlen, value[i]); } } @@ -210,7 +210,7 @@ heap_attisnull(HeapTuple tup, int attnum) int heap_sysattrlen(AttrNumber attno) { - HeapTupleHeader f = NULL; + HeapTupleHeader f = NULL; switch (attno) { @@ -301,6 +301,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum) } return (Datum) NULL; } + #endif /* ---------------- @@ -328,11 +329,11 @@ nocachegetattr(HeapTuple tuple, TupleDesc tupleDesc, bool *isnull) { - char *tp; /* ptr to att in tuple */ - HeapTupleHeader tup = tuple->t_data; - bits8 *bp = tup->t_bits; /* ptr to att in tuple */ - Form_pg_attribute *att = tupleDesc->attrs; - int slow = 0; /* do we have to walk nulls? */ + char *tp; /* ptr to att in tuple */ + HeapTupleHeader tup = tuple->t_data; + bits8 *bp = tup->t_bits; /* ptr to att in tuple */ + Form_pg_attribute *att = tupleDesc->attrs; + int slow = 0; /* do we have to walk nulls? */ #if IN_MACRO @@ -376,6 +377,7 @@ nocachegetattr(HeapTuple tuple, } else { + /* * there's a null somewhere in the tuple */ @@ -404,12 +406,13 @@ nocachegetattr(HeapTuple tuple, int finalbit = attnum & 0x07; /* check for nulls "before" final bit of last byte */ - if ((~ bp[byte]) & ((1 << finalbit) - 1)) + if ((~bp[byte]) & ((1 << finalbit) - 1)) slow = 1; else { /* check for nulls in any "earlier" bytes */ - int i; + int i; + for (i = 0; i < byte; i++) { if (bp[i] != 0xFF) @@ -439,6 +442,7 @@ nocachegetattr(HeapTuple tuple, else if (!HeapTupleAllFixed(tuple)) { int j; + /* * In for(), we make this <= and not < because we want to test * if we can go past it in initializing offsets. @@ -456,9 +460,9 @@ nocachegetattr(HeapTuple tuple, /* * If slow is zero, and we got here, we know that we have a tuple with - * no nulls or varlenas before the target attribute. - * If possible, we also want to initialize the remainder of the - * attribute cached offset values. + * no nulls or varlenas before the target attribute. If possible, we + * also want to initialize the remainder of the attribute cached + * offset values. */ if (!slow) { @@ -570,7 +574,7 @@ heap_copytuple(HeapTuple tuple) newTuple->t_len = tuple->t_len; newTuple->t_self = tuple->t_self; newTuple->t_data = (HeapTupleHeader) ((char *) newTuple + HEAPTUPLESIZE); - memmove((char *) newTuple->t_data, + memmove((char *) newTuple->t_data, (char *) tuple->t_data, (int) tuple->t_len); return newTuple; } @@ -589,11 +593,11 @@ heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest) dest->t_data = NULL; return; } - + dest->t_len = src->t_len; dest->t_self = src->t_self; dest->t_data = (HeapTupleHeader) palloc(src->t_len); - memmove((char *) dest->t_data, + memmove((char *) dest->t_data, (char *) src->t_data, (int) src->t_len); return; } @@ -657,14 +661,14 @@ heap_formtuple(TupleDesc tupleDescriptor, Datum *value, char *nulls) { - HeapTuple tuple; /* return tuple */ - HeapTupleHeader td; /* tuple data */ - int bitmaplen; - long len; - int hoff; - bool hasnull = false; - int i; - int numberOfAttributes = tupleDescriptor->natts; + HeapTuple tuple; /* return tuple */ + HeapTupleHeader td; /* tuple data */ + int bitmaplen; + long len; + int hoff; + bool hasnull = false; + int i; + int numberOfAttributes = tupleDescriptor->natts; len = offsetof(HeapTupleHeaderData, t_bits); @@ -760,9 +764,9 @@ heap_modifytuple(HeapTuple tuple, if (repl[attoff] == ' ') { value[attoff] = heap_getattr(tuple, - AttrOffsetGetAttrNumber(attoff), - RelationGetDescr(relation), - &isNull); + AttrOffsetGetAttrNumber(attoff), + RelationGetDescr(relation), + &isNull); nulls[attoff] = (isNull) ? 'n' : ' '; } @@ -790,12 +794,12 @@ heap_modifytuple(HeapTuple tuple, infomask = newTuple->t_data->t_infomask; memmove((char *) &newTuple->t_data->t_oid, /* XXX */ (char *) &tuple->t_data->t_oid, - ((char *) &tuple->t_data->t_hoff - - (char *) &tuple->t_data->t_oid)); /* XXX */ + ((char *) &tuple->t_data->t_hoff - + (char *) &tuple->t_data->t_oid)); /* XXX */ newTuple->t_data->t_infomask = infomask; newTuple->t_data->t_natts = numberOfAttributes; newTuple->t_self = tuple->t_self; - + return newTuple; } @@ -809,10 +813,10 @@ heap_addheader(uint32 natts, /* max domain index */ int structlen, /* its length */ char *structure) /* pointer to the struct */ { - HeapTuple tuple; - HeapTupleHeader td; /* tuple data */ - long len; - int hoff; + HeapTuple tuple; + HeapTupleHeader td; /* tuple data */ + long len; + int hoff; AssertArg(natts > 0); diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index 7615c79a748..0a2eee932f5 100644 --- a/src/backend/access/common/printtup.c +++ b/src/backend/access/common/printtup.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.45 1999/05/10 00:44:50 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.46 1999/05/25 16:06:39 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -25,9 +25,9 @@ #include "libpq/pqformat.h" #include "utils/syscache.h" -static void printtup_setup(DestReceiver* self, TupleDesc typeinfo); -static void printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self); -static void printtup_cleanup(DestReceiver* self); +static void printtup_setup(DestReceiver * self, TupleDesc typeinfo); +static void printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver * self); +static void printtup_cleanup(DestReceiver * self); /* ---------------------------------------------------------------- * printtup / debugtup support @@ -43,7 +43,7 @@ static void printtup_cleanup(DestReceiver* self); * ---------------- */ int -getTypeOutAndElem(Oid type, Oid* typOutput, Oid* typElem) +getTypeOutAndElem(Oid type, Oid *typOutput, Oid *typElem) { HeapTuple typeTuple; @@ -54,6 +54,7 @@ getTypeOutAndElem(Oid type, Oid* typOutput, Oid* typElem) if (HeapTupleIsValid(typeTuple)) { Form_pg_type pt = (Form_pg_type) GETSTRUCT(typeTuple); + *typOutput = (Oid) pt->typoutput; *typElem = (Oid) pt->typelem; return OidIsValid(*typOutput); @@ -70,27 +71,29 @@ getTypeOutAndElem(Oid type, Oid* typOutput, Oid* typElem) * Private state for a printtup destination object * ---------------- */ -typedef struct { /* Per-attribute information */ +typedef struct +{ /* Per-attribute information */ Oid typoutput; /* Oid for the attribute's type output fn */ Oid typelem; /* typelem value to pass to the output fn */ FmgrInfo finfo; /* Precomputed call info for typoutput */ -} PrinttupAttrInfo; +} PrinttupAttrInfo; -typedef struct { - DestReceiver pub; /* publicly-known function pointers */ - TupleDesc attrinfo; /* The attr info we are set up for */ - int nattrs; - PrinttupAttrInfo *myinfo; /* Cached info about each attr */ -} DR_printtup; +typedef struct +{ + DestReceiver pub; /* publicly-known function pointers */ + TupleDesc attrinfo; /* The attr info we are set up for */ + int nattrs; + PrinttupAttrInfo *myinfo; /* Cached info about each attr */ +} DR_printtup; /* ---------------- * Initialize: create a DestReceiver for printtup * ---------------- */ -DestReceiver* +DestReceiver * printtup_create_DR() { - DR_printtup* self = (DR_printtup*) palloc(sizeof(DR_printtup)); + DR_printtup *self = (DR_printtup *) palloc(sizeof(DR_printtup)); self->pub.receiveTuple = printtup; self->pub.setup = printtup_setup; @@ -100,42 +103,43 @@ printtup_create_DR() self->nattrs = 0; self->myinfo = NULL; - return (DestReceiver*) self; + return (DestReceiver *) self; } static void -printtup_setup(DestReceiver* self, TupleDesc typeinfo) +printtup_setup(DestReceiver * self, TupleDesc typeinfo) { /* ---------------- * We could set up the derived attr info at this time, but we postpone it * until the first call of printtup, for 3 reasons: * 1. We don't waste time (compared to the old way) if there are no - * tuples at all to output. + * tuples at all to output. * 2. Checking in printtup allows us to handle the case that the tuples - * change type midway through (although this probably can't happen in - * the current executor). + * change type midway through (although this probably can't happen in + * the current executor). * 3. Right now, ExecutorRun passes a NULL for typeinfo anyway :-( * ---------------- */ } static void -printtup_prepare_info(DR_printtup* myState, TupleDesc typeinfo, int numAttrs) +printtup_prepare_info(DR_printtup * myState, TupleDesc typeinfo, int numAttrs) { - int i; + int i; if (myState->myinfo) - pfree(myState->myinfo); /* get rid of any old data */ + pfree(myState->myinfo); /* get rid of any old data */ myState->myinfo = NULL; myState->attrinfo = typeinfo; myState->nattrs = numAttrs; if (numAttrs <= 0) return; - myState->myinfo = (PrinttupAttrInfo*) + myState->myinfo = (PrinttupAttrInfo *) palloc(numAttrs * sizeof(PrinttupAttrInfo)); for (i = 0; i < numAttrs; i++) { - PrinttupAttrInfo* thisState = myState->myinfo + i; + PrinttupAttrInfo *thisState = myState->myinfo + i; + if (getTypeOutAndElem((Oid) typeinfo->attrs[i]->atttypid, &thisState->typoutput, &thisState->typelem)) fmgr_info(thisState->typoutput, &thisState->finfo); @@ -147,9 +151,9 @@ printtup_prepare_info(DR_printtup* myState, TupleDesc typeinfo, int numAttrs) * ---------------- */ static void -printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self) +printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver * self) { - DR_printtup *myState = (DR_printtup*) self; + DR_printtup *myState = (DR_printtup *) self; StringInfoData buf; int i, j, @@ -178,7 +182,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self) k = 1 << 7; for (i = 0; i < tuple->t_data->t_natts; ++i) { - if (! heap_attisnull(tuple, i + 1)) + if (!heap_attisnull(tuple, i + 1)) j |= k; /* set bit if not null */ k >>= 1; if (k == 0) /* end of byte? */ @@ -197,7 +201,8 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self) */ for (i = 0; i < tuple->t_data->t_natts; ++i) { - PrinttupAttrInfo* thisState = myState->myinfo + i; + PrinttupAttrInfo *thisState = myState->myinfo + i; + attr = heap_getattr(tuple, i + 1, typeinfo, &isnull); if (isnull) continue; @@ -223,9 +228,10 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self) * ---------------- */ static void -printtup_cleanup(DestReceiver* self) +printtup_cleanup(DestReceiver * self) { - DR_printtup* myState = (DR_printtup*) self; + DR_printtup *myState = (DR_printtup *) self; + if (myState->myinfo) pfree(myState->myinfo); pfree(myState); @@ -274,7 +280,7 @@ showatts(char *name, TupleDesc tupleDesc) * ---------------- */ void -debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self) +debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver * self) { int i; Datum attr; @@ -310,7 +316,7 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self) * ---------------- */ void -printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self) +printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver * self) { StringInfoData buf; int i, @@ -334,7 +340,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self) k = 1 << 7; for (i = 0; i < tuple->t_data->t_natts; ++i) { - if (! heap_attisnull(tuple, i + 1)) + if (!heap_attisnull(tuple, i + 1)) j |= k; /* set bit if not null */ k >>= 1; if (k == 0) /* end of byte? */ diff --git a/src/backend/access/common/scankey.c b/src/backend/access/common/scankey.c index bd3e047e6a7..7dd9b6a9206 100644 --- a/src/backend/access/common/scankey.c +++ b/src/backend/access/common/scankey.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.13 1999/02/13 23:14:13 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.14 1999/05/25 16:06:41 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -18,7 +18,7 @@ #include <access/skey.h> /* - * ScanKeyEntryIsLegal + * ScanKeyEntryIsLegal * True iff the scan key entry is legal. */ #define ScanKeyEntryIsLegal(entry) \ @@ -28,7 +28,7 @@ ) /* - * ScanKeyEntrySetIllegal + * ScanKeyEntrySetIllegal * Marks a scan key entry as illegal. */ void @@ -43,7 +43,7 @@ ScanKeyEntrySetIllegal(ScanKey entry) } /* - * ScanKeyEntryInitialize + * ScanKeyEntryInitialize * Initializes an scan key entry. * * Note: diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c index 656b997404d..71e8db45a43 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.48 1999/02/13 23:14:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.49 1999/05/25 16:06:42 momjian Exp $ * * NOTES * some of the executor utility code such as "ExecTypeFromTL" should be @@ -487,7 +487,7 @@ BuildDescForRelation(List *schema, char *relname) { /* array of XXX is _XXX */ snprintf(typename, NAMEDATALEN, - "_%.*s", NAMEDATALEN - 2, entry->typename->name); + "_%.*s", NAMEDATALEN - 2, entry->typename->name); attdim = length(arry); } else diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 1342bc6aec8..06321990a8d 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -344,7 +344,7 @@ gistinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation /* * Notes in ExecUtils:ExecOpenIndices() * - RelationSetLockForWrite(r); + * RelationSetLockForWrite(r); */ res = gistdoinsert(r, itup, &giststate); @@ -1106,10 +1106,10 @@ gistdelete(Relation r, ItemPointer tid) Page page; /* - * Notes in ExecUtils:ExecOpenIndices() - * Also note that only vacuum deletes index tuples now... + * Notes in ExecUtils:ExecOpenIndices() Also note that only vacuum + * deletes index tuples now... * - RelationSetLockForWrite(r); + * RelationSetLockForWrite(r); */ blkno = ItemPointerGetBlockNumber(tid); diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c index 92353d71b2b..d26387d8280 100644 --- a/src/backend/access/gist/gistscan.c +++ b/src/backend/access/gist/gistscan.c @@ -68,7 +68,7 @@ gistbeginscan(Relation r, /* * Let index_beginscan does its work... * - RelationSetLockForRead(r); + * RelationSetLockForRead(r); */ s = RelationGetIndexScan(r, fromEnd, nkeys, key); diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c index 122c9ad3797..65d04658c50 100644 --- a/src/backend/access/hash/hash.c +++ b/src/backend/access/hash/hash.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.25 1999/02/13 23:14:17 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.26 1999/05/25 16:06:54 momjian Exp $ * * NOTES * This file contains only the public interface routines. @@ -485,9 +485,9 @@ hashrestrpos(IndexScanDesc scan) /* bump lock on currentMarkData and copy to currentItemData */ if (ItemPointerIsValid(&(scan->currentMarkData))) { - so->hashso_curbuf =_hash_getbuf(scan->relation, - BufferGetBlockNumber(so->hashso_mrkbuf), - HASH_READ); + so->hashso_curbuf = _hash_getbuf(scan->relation, + BufferGetBlockNumber(so->hashso_mrkbuf), + HASH_READ); scan->currentItemData = scan->currentMarkData; } diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c index c8be6dc60ed..f5605a3f109 100644 --- a/src/backend/access/hash/hashfunc.c +++ b/src/backend/access/hash/hashfunc.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.16 1999/03/14 16:27:59 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.17 1999/05/25 16:06:56 momjian Exp $ * * NOTES * These functions are stored in pg_amproc. For each operator class @@ -34,9 +34,9 @@ hashint4(uint32 key) } uint32 -hashint8(int64 *key) +hashint8(int64 * key) { - return ~((uint32)*key); + return ~((uint32) *key); } /* Hash function from Chris Torek. */ diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c index 7c81e7ab5c1..bcda5f85e73 100644 --- a/src/backend/access/hash/hashpage.c +++ b/src/backend/access/hash/hashpage.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.19 1999/02/13 23:14:20 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.20 1999/05/25 16:06:58 momjian Exp $ * * NOTES * Postgres hash pages look like ordinary relation pages. The opaque @@ -321,7 +321,7 @@ _hash_setpagelock(Relation rel, { switch (access) { - case HASH_WRITE: + case HASH_WRITE: LockPage(rel, blkno, ExclusiveLock); break; case HASH_READ: @@ -345,7 +345,7 @@ _hash_unsetpagelock(Relation rel, { switch (access) { - case HASH_WRITE: + case HASH_WRITE: UnlockPage(rel, blkno, ExclusiveLock); break; case HASH_READ: diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 63fd52d124f..1ea78ec8633 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.42 1999/03/28 20:31:56 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.43 1999/05/25 16:07:04 momjian Exp $ * * * INTERFACE ROUTINES @@ -117,7 +117,7 @@ initscan(HeapScanDesc scan, * relation is empty * ---------------- */ - scan->rs_ntup.t_data = scan->rs_ctup.t_data = + scan->rs_ntup.t_data = scan->rs_ctup.t_data = scan->rs_ptup.t_data = NULL; scan->rs_nbuf = scan->rs_cbuf = scan->rs_pbuf = InvalidBuffer; } @@ -216,15 +216,15 @@ heapgettup(Relation relation, int nkeys, ScanKey key) { - ItemId lpp; - Page dp; - int page; - int pages; - int lines; - OffsetNumber lineoff; - int linesleft; - ItemPointer tid = (tuple->t_data == NULL) ? - (ItemPointer) NULL : &(tuple->t_self); + ItemId lpp; + Page dp; + int page; + int pages; + int lines; + OffsetNumber lineoff; + int linesleft; + ItemPointer tid = (tuple->t_data == NULL) ? + (ItemPointer) NULL : &(tuple->t_self); /* ---------------- * increment access statistics @@ -290,8 +290,8 @@ heapgettup(Relation relation, return; } *buffer = RelationGetBufferWithBuffer(relation, - ItemPointerGetBlockNumber(tid), - *buffer); + ItemPointerGetBlockNumber(tid), + *buffer); if (!BufferIsValid(*buffer)) elog(ERROR, "heapgettup: failed ReadBuffer"); @@ -439,7 +439,8 @@ heapgettup(Relation relation, } else { - ++lpp; /* move forward in this page's ItemId array */ + ++lpp; /* move forward in this page's ItemId + * array */ ++lineoff; } } @@ -816,6 +817,7 @@ heap_getnext(HeapScanDesc scandesc, int backw) } else { /* NONTUP */ + /* * Don't release scan->rs_cbuf at this point, because * heapgettup doesn't increase PrivateRefCount if it is @@ -897,6 +899,7 @@ heap_getnext(HeapScanDesc scandesc, int backw) } else { /* NONTUP */ + /* * Don't release scan->rs_cbuf at this point, because * heapgettup doesn't increase PrivateRefCount if it is @@ -966,11 +969,11 @@ heap_fetch(Relation relation, HeapTuple tuple, Buffer *userbuf) { - ItemId lp; - Buffer buffer; - PageHeader dp; - ItemPointer tid = &(tuple->t_self); - OffsetNumber offnum; + ItemId lp; + Buffer buffer; + PageHeader dp; + ItemPointer tid = &(tuple->t_self); + OffsetNumber offnum; AssertMacro(PointerIsValid(userbuf)); /* see comments above */ @@ -1093,9 +1096,7 @@ heap_insert(Relation relation, HeapTuple tup) RelationPutHeapTupleAtEnd(relation, tup); if (IsSystemRelationName(RelationGetRelationName(relation)->data)) - { RelationInvalidateHeapTuple(relation, tup); - } return tup->t_data->t_oid; } @@ -1106,11 +1107,11 @@ heap_insert(Relation relation, HeapTuple tup) int heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid) { - ItemId lp; - HeapTupleData tp; - PageHeader dp; - Buffer buffer; - int result; + ItemId lp; + HeapTupleData tp; + PageHeader dp; + Buffer buffer; + int result; /* increment access statistics */ IncrHeapAccessStat(local_delete); @@ -1130,10 +1131,10 @@ heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid) tp.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp); tp.t_len = ItemIdGetLength(lp); tp.t_self = *tid; - + l1: result = HeapTupleSatisfiesUpdate(&tp); - + if (result == HeapTupleInvisible) { LockBuffer(buffer, BUFFER_LOCK_UNLOCK); @@ -1142,7 +1143,7 @@ l1: } else if (result == HeapTupleBeingUpdated) { - TransactionId xwait = tp.t_data->t_xmax; + TransactionId xwait = tp.t_data->t_xmax; /* sleep untill concurrent transaction ends */ LockBuffer(buffer, BUFFER_LOCK_UNLOCK); @@ -1177,8 +1178,8 @@ l1: /* store transaction information of xact deleting the tuple */ TransactionIdStore(GetCurrentTransactionId(), &(tp.t_data->t_xmax)); tp.t_data->t_cmax = GetCurrentCommandId(); - tp.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED | - HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE); + tp.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED | + HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE); LockBuffer(buffer, BUFFER_LOCK_UNLOCK); @@ -1194,14 +1195,14 @@ l1: * heap_replace - replace a tuple */ int -heap_replace(Relation relation, ItemPointer otid, HeapTuple newtup, - ItemPointer ctid) +heap_replace(Relation relation, ItemPointer otid, HeapTuple newtup, + ItemPointer ctid) { - ItemId lp; - HeapTupleData oldtup; - PageHeader dp; - Buffer buffer; - int result; + ItemId lp; + HeapTupleData oldtup; + PageHeader dp; + Buffer buffer; + int result; /* increment access statistics */ IncrHeapAccessStat(local_replace); @@ -1223,7 +1224,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple newtup, l2: result = HeapTupleSatisfiesUpdate(&oldtup); - + if (result == HeapTupleInvisible) { LockBuffer(buffer, BUFFER_LOCK_UNLOCK); @@ -1232,7 +1233,7 @@ l2: } else if (result == HeapTupleBeingUpdated) { - TransactionId xwait = oldtup.t_data->t_xmax; + TransactionId xwait = oldtup.t_data->t_xmax; /* sleep untill concurrent transaction ends */ LockBuffer(buffer, BUFFER_LOCK_UNLOCK); @@ -1275,19 +1276,20 @@ l2: /* logically delete old item */ TransactionIdStore(GetCurrentTransactionId(), &(oldtup.t_data->t_xmax)); oldtup.t_data->t_cmax = GetCurrentCommandId(); - oldtup.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED | - HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE); + oldtup.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED | + HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE); /* insert new item */ if ((unsigned) DOUBLEALIGN(newtup->t_len) <= PageGetFreeSpace((Page) dp)) RelationPutHeapTuple(relation, buffer, newtup); else { + /* - * New item won't fit on same page as old item, have to look - * for a new place to put it. Note that we have to unlock - * current buffer context - not good but RelationPutHeapTupleAtEnd - * uses extend lock. + * New item won't fit on same page as old item, have to look for a + * new place to put it. Note that we have to unlock current buffer + * context - not good but RelationPutHeapTupleAtEnd uses extend + * lock. */ LockBuffer(buffer, BUFFER_LOCK_UNLOCK); RelationPutHeapTupleAtEnd(relation, newtup); @@ -1295,8 +1297,8 @@ l2: } /* - * New item in place, now record address of new tuple in - * t_ctid of old one. + * New item in place, now record address of new tuple in t_ctid of old + * one. */ oldtup.t_data->t_ctid = newtup->t_self; @@ -1316,10 +1318,10 @@ l2: int heap_mark4update(Relation relation, HeapTuple tuple, Buffer *buffer) { - ItemPointer tid = &(tuple->t_self); - ItemId lp; - PageHeader dp; - int result; + ItemPointer tid = &(tuple->t_self); + ItemId lp; + PageHeader dp; + int result; /* increment access statistics */ IncrHeapAccessStat(local_mark4update); @@ -1336,10 +1338,10 @@ heap_mark4update(Relation relation, HeapTuple tuple, Buffer *buffer) lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(tid)); tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp); tuple->t_len = ItemIdGetLength(lp); - + l3: result = HeapTupleSatisfiesUpdate(tuple); - + if (result == HeapTupleInvisible) { LockBuffer(*buffer, BUFFER_LOCK_UNLOCK); @@ -1348,7 +1350,7 @@ l3: } else if (result == HeapTupleBeingUpdated) { - TransactionId xwait = tuple->t_data->t_xmax; + TransactionId xwait = tuple->t_data->t_xmax; /* sleep untill concurrent transaction ends */ LockBuffer(*buffer, BUFFER_LOCK_UNLOCK); diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c index f991b206d44..682c072c199 100644 --- a/src/backend/access/heap/hio.c +++ b/src/backend/access/heap/hio.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Id: hio.c,v 1.19 1999/05/07 01:22:53 vadim Exp $ + * $Id: hio.c,v 1.20 1999/05/25 16:07:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -39,11 +39,11 @@ RelationPutHeapTuple(Relation relation, Buffer buffer, HeapTuple tuple) { - Page pageHeader; - OffsetNumber offnum; - unsigned int len; - ItemId itemId; - Item item; + Page pageHeader; + OffsetNumber offnum; + unsigned int len; + ItemId itemId; + Item item; /* ---------------- * increment access statistics @@ -62,13 +62,13 @@ RelationPutHeapTuple(Relation relation, itemId = PageGetItemId((Page) pageHeader, offnum); item = PageGetItem((Page) pageHeader, itemId); - ItemPointerSet(&((HeapTupleHeader) item)->t_ctid, - BufferGetBlockNumber(buffer), offnum); + ItemPointerSet(&((HeapTupleHeader) item)->t_ctid, + BufferGetBlockNumber(buffer), offnum); /* * Let the caller do this! * - WriteBuffer(buffer); + * WriteBuffer(buffer); */ /* return an accurate tuple */ @@ -111,8 +111,8 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple) Item item; /* - * Lock relation for extention. We can use LockPage here as long as - * in all other places we use page-level locking for indices only. + * Lock relation for extention. We can use LockPage here as long as in + * all other places we use page-level locking for indices only. * Alternatevely, we could define pseudo-table as we do for * transactions with XactLockTable. */ @@ -132,6 +132,7 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple) { buffer = ReadBuffer(relation, lastblock); pageHeader = (Page) BufferGetPage(buffer); + /* * There was IF instead of ASSERT here ?! */ diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c index 5752f2cf443..70b9ae2a4b0 100644 --- a/src/backend/access/index/genam.c +++ b/src/backend/access/index/genam.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.16 1999/02/13 23:14:29 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.17 1999/05/25 16:07:12 momjian Exp $ * * NOTES * many of the old access method routines have been turned into @@ -270,5 +270,5 @@ IndexScanRestorePosition(IndexScanDesc scan) scan->flags = 0x0; /* XXX should have a symbolic name */ } -#endif +#endif diff --git a/src/backend/access/index/istrat.c b/src/backend/access/index/istrat.c index e0b4e61a15b..61cbe560656 100644 --- a/src/backend/access/index/istrat.c +++ b/src/backend/access/index/istrat.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.31 1999/02/13 23:14:30 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.32 1999/05/25 16:07:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ static bool StrategyTermIsValid(StrategyTerm term, */ /* - * StrategyMapGetScanKeyEntry + * StrategyMapGetScanKeyEntry * Returns a scan key entry of a index strategy mapping member. * * Note: @@ -75,7 +75,7 @@ StrategyMapGetScanKeyEntry(StrategyMap map, } /* - * IndexStrategyGetStrategyMap + * IndexStrategyGetStrategyMap * Returns an index strategy mapping of an index strategy. * * Note: @@ -97,7 +97,7 @@ IndexStrategyGetStrategyMap(IndexStrategy indexStrategy, } /* - * AttributeNumberGetIndexStrategySize + * AttributeNumberGetIndexStrategySize * Computes the size of an index strategy. */ Size @@ -294,8 +294,8 @@ RelationGetStrategy(Relation relation, Assert(RegProcedureIsValid(procedure)); strategyMap = IndexStrategyGetStrategyMap(RelationGetIndexStrategy(relation), - evaluation->maxStrategy, - attributeNumber); + evaluation->maxStrategy, + attributeNumber); /* get a strategy number for the procedure ignoring flags for now */ for (index = 0; index < evaluation->maxStrategy; index += 1) @@ -526,7 +526,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation, /* - * IndexSupportInitialize + * IndexSupportInitialize * Initializes an index strategy and associated support procedures. */ void diff --git a/src/backend/access/nbtree/nbtcompare.c b/src/backend/access/nbtree/nbtcompare.c index 127f2b03576..796087f812f 100644 --- a/src/backend/access/nbtree/nbtcompare.c +++ b/src/backend/access/nbtree/nbtcompare.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.22 1999/03/14 05:08:56 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.23 1999/05/25 16:07:21 momjian Exp $ * * NOTES * These functions are stored in pg_amproc. For each operator class @@ -40,7 +40,7 @@ btint4cmp(int32 a, int32 b) } int32 -btint8cmp(int64 *a, int64 *b) +btint8cmp(int64 * a, int64 * b) { if (*a > *b) return 1; diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index 265a658363a..3cc67661cd2 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.39 1999/05/01 16:09:45 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.40 1999/05/25 16:07:23 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -99,13 +99,13 @@ l1: /* key on the page before trying to compare it */ if (!PageIsEmpty(page) && offset <= maxoff) { - TupleDesc itupdesc; - BTItem cbti; - HeapTupleData htup; - BTPageOpaque opaque; - Buffer nbuf; - BlockNumber blkno; - bool chtup = true; + TupleDesc itupdesc; + BTItem cbti; + HeapTupleData htup; + BTPageOpaque opaque; + Buffer nbuf; + BlockNumber blkno; + bool chtup = true; itupdesc = RelationGetDescr(rel); nbuf = InvalidBuffer; @@ -122,15 +122,16 @@ l1: */ while (_bt_isequal(itupdesc, page, offset, natts, itup_scankey)) { /* they're equal */ + /* - * Have to check is inserted heap tuple deleted one - * (i.e. just moved to another place by vacuum)! + * Have to check is inserted heap tuple deleted one (i.e. + * just moved to another place by vacuum)! */ if (chtup) { htup.t_self = btitem->bti_itup.t_tid; heap_fetch(heapRel, SnapshotDirty, &htup, &buffer); - if (htup.t_data == NULL) /* YES! */ + if (htup.t_data == NULL) /* YES! */ break; /* Live tuple was inserted */ ReleaseBuffer(buffer); @@ -139,11 +140,11 @@ l1: cbti = (BTItem) PageGetItem(page, PageGetItemId(page, offset)); htup.t_self = cbti->bti_itup.t_tid; heap_fetch(heapRel, SnapshotDirty, &htup, &buffer); - if (htup.t_data != NULL) /* it is a duplicate */ + if (htup.t_data != NULL) /* it is a duplicate */ { - TransactionId xwait = - (TransactionIdIsValid(SnapshotDirty->xmin)) ? - SnapshotDirty->xmin : SnapshotDirty->xmax; + TransactionId xwait = + (TransactionIdIsValid(SnapshotDirty->xmin)) ? + SnapshotDirty->xmin : SnapshotDirty->xmax; /* * If this tuple is being updated by other transaction @@ -156,7 +157,7 @@ l1: _bt_relbuf(rel, nbuf, BT_READ); _bt_relbuf(rel, buf, BT_WRITE); XactLockTableWait(xwait); - goto l1; /* continue from the begin */ + goto l1;/* continue from the begin */ } elog(ERROR, "Cannot insert a duplicate key into a unique index"); } @@ -571,10 +572,10 @@ _bt_insertonpg(Relation rel, * reasoning). */ -l_spl:; +l_spl: ; if (stack == (BTStack) NULL) { - if (!is_root) /* if this page was not root page */ + if (!is_root) /* if this page was not root page */ { elog(DEBUG, "btree: concurrent ROOT page split"); stack = (BTStack) palloc(sizeof(BTStackData)); @@ -1144,8 +1145,8 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf) lpage = BufferGetPage(lbuf); rpage = BufferGetPage(rbuf); - ((BTPageOpaque) PageGetSpecialPointer(lpage))->btpo_parent = - ((BTPageOpaque) PageGetSpecialPointer(rpage))->btpo_parent = + ((BTPageOpaque) PageGetSpecialPointer(lpage))->btpo_parent = + ((BTPageOpaque) PageGetSpecialPointer(rpage))->btpo_parent = rootbknum; /* diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c index daff4e6bdd4..5a936160549 100644 --- a/src/backend/access/nbtree/nbtpage.c +++ b/src/backend/access/nbtree/nbtpage.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.20 1999/04/22 08:19:59 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.21 1999/05/25 16:07:26 momjian Exp $ * * NOTES * Postgres btree pages look like ordinary relation pages. The opaque @@ -421,7 +421,7 @@ _bt_pageinit(Page page, Size size) MemSet(page, 0, size); PageInit(page, size, sizeof(BTPageOpaqueData)); - ((BTPageOpaque) PageGetSpecialPointer(page))->btpo_parent = + ((BTPageOpaque) PageGetSpecialPointer(page))->btpo_parent = InvalidBlockNumber; } @@ -494,17 +494,16 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access) opaque = (BTPageOpaque) PageGetSpecialPointer(page); maxoff = PageGetMaxOffsetNumber(page); - if (stack->bts_offset == InvalidOffsetNumber || + if (stack->bts_offset == InvalidOffsetNumber || maxoff >= stack->bts_offset) { + /* - * _bt_insertonpg set bts_offset to InvalidOffsetNumber - * in the case of concurrent ROOT page split + * _bt_insertonpg set bts_offset to InvalidOffsetNumber in the + * case of concurrent ROOT page split */ if (stack->bts_offset == InvalidOffsetNumber) - { i = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY; - } else { itemid = PageGetItemId(page, stack->bts_offset); @@ -524,7 +523,7 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access) } /* if the item has just moved right on this page, we're done */ - for ( ; + for (; i <= maxoff; i = OffsetNumberNext(i)) { diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index 2ded78b1a67..b45d189a855 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.37 1999/03/28 20:31:58 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.38 1999/05/25 16:07:27 momjian Exp $ * * NOTES * This file contains only the public interface routines. @@ -367,7 +367,7 @@ btinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation btitem = _bt_formitem(itup); res = _bt_doinsert(rel, btitem, - IndexIsUnique(RelationGetRelid(rel)), heapRel); + IndexIsUnique(RelationGetRelid(rel)), heapRel); pfree(btitem); pfree(itup); @@ -391,9 +391,10 @@ btgettuple(IndexScanDesc scan, ScanDirection dir) if (ItemPointerIsValid(&(scan->currentItemData))) { + /* - * Restore scan position using heap TID returned - * by previous call to btgettuple(). + * Restore scan position using heap TID returned by previous call + * to btgettuple(). */ _bt_restscan(scan); res = _bt_next(scan, dir); @@ -623,16 +624,15 @@ _bt_restscan(IndexScanDesc scan) BlockNumber blkno; /* - * We use this as flag when first index tuple on page - * is deleted but we do not move left (this would - * slowdown vacuum) - so we set current->ip_posid - * before first index tuple on the current page + * We use this as flag when first index tuple on page is deleted but + * we do not move left (this would slowdown vacuum) - so we set + * current->ip_posid before first index tuple on the current page * (_bt_step will move it right)... */ if (!ItemPointerIsValid(&target)) { - ItemPointerSetOffsetNumber(&(scan->currentItemData), - OffsetNumberPrev(P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY)); + ItemPointerSetOffsetNumber(&(scan->currentItemData), + OffsetNumberPrev(P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY)); return; } diff --git a/src/backend/access/nbtree/nbtscan.c b/src/backend/access/nbtree/nbtscan.c index a2a6707d195..79e0c879d04 100644 --- a/src/backend/access/nbtree/nbtscan.c +++ b/src/backend/access/nbtree/nbtscan.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.20 1999/03/28 20:31:58 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.21 1999/05/25 16:07:29 momjian Exp $ * * * NOTES @@ -112,12 +112,12 @@ _bt_adjscans(Relation rel, ItemPointer tid) static void _bt_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno) { - ItemPointer current; - Buffer buf; - BTScanOpaque so; - OffsetNumber start; - Page page; - BTPageOpaque opaque; + ItemPointer current; + Buffer buf; + BTScanOpaque so; + OffsetNumber start; + Page page; + BTPageOpaque opaque; so = (BTScanOpaque) scan->opaque; buf = so->btso_curbuf; @@ -140,7 +140,7 @@ _bt_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno) { Page pg = BufferGetPage(buf); BTItem btitem = (BTItem) PageGetItem(pg, - PageGetItemId(pg, ItemPointerGetOffsetNumber(current))); + PageGetItemId(pg, ItemPointerGetOffsetNumber(current))); so->curHeapIptr = btitem->bti_itup.t_tid; } @@ -181,7 +181,7 @@ _bt_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno) { Page pg = BufferGetPage(buf); BTItem btitem = (BTItem) PageGetItem(pg, - PageGetItemId(pg, ItemPointerGetOffsetNumber(current))); + PageGetItemId(pg, ItemPointerGetOffsetNumber(current))); so->mrkHeapIptr = btitem->bti_itup.t_tid; } diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c index 1ea080abd72..cc3fc7475b4 100644 --- a/src/backend/access/nbtree/nbtsearch.c +++ b/src/backend/access/nbtree/nbtsearch.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.43 1999/04/13 17:18:28 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.44 1999/05/25 16:07:31 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -706,7 +706,7 @@ _bt_next(IndexScanDesc scan, ScanDirection dir) so = (BTScanOpaque) scan->opaque; current = &(scan->currentItemData); - Assert (BufferIsValid(so->btso_curbuf)); + Assert(BufferIsValid(so->btso_curbuf)); /* we still have the buffer pinned and locked */ buf = so->btso_curbuf; @@ -733,8 +733,8 @@ _bt_next(IndexScanDesc scan, ScanDirection dir) return res; } - } while (keysok >= so->numberOfFirstKeys || - (keysok == -1 && ScanDirectionIsBackward(dir))); + } while (keysok >= so->numberOfFirstKeys || + (keysok == -1 && ScanDirectionIsBackward(dir))); ItemPointerSetInvalid(current); so->btso_curbuf = InvalidBuffer; @@ -776,8 +776,8 @@ _bt_first(IndexScanDesc scan, ScanDirection dir) BTScanOpaque so; ScanKeyData skdata; Size keysok; - int i; - int nKeyIndex = -1; + int i; + int nKeyIndex = -1; rel = scan->relation; so = (BTScanOpaque) scan->opaque; @@ -795,27 +795,27 @@ _bt_first(IndexScanDesc scan, ScanDirection dir) if (ScanDirectionIsBackward(dir)) { - for (i=0; i<so->numberOfKeys; i++) + for (i = 0; i < so->numberOfKeys; i++) { if (so->keyData[i].sk_attno != 1) break; - strat = _bt_getstrat(rel, so->keyData[i].sk_attno, - so->keyData[i].sk_procedure); + strat = _bt_getstrat(rel, so->keyData[i].sk_attno, + so->keyData[i].sk_procedure); if (strat == BTLessStrategyNumber || - strat == BTLessEqualStrategyNumber|| - strat == BTEqualStrategyNumber) + strat == BTLessEqualStrategyNumber || + strat == BTEqualStrategyNumber) { nKeyIndex = i; break; } } } - else + else { strat = _bt_getstrat(rel, 1, so->keyData[0].sk_procedure); if (strat == BTLessStrategyNumber || - strat == BTLessEqualStrategyNumber) + strat == BTLessEqualStrategyNumber) ; else nKeyIndex = 0; @@ -850,7 +850,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir) } proc = index_getprocid(rel, 1, BTORDER_PROC); ScanKeyEntryInitialize(&skdata, so->keyData[nKeyIndex].sk_flags, - 1, proc, so->keyData[nKeyIndex].sk_argument); + 1, proc, so->keyData[nKeyIndex].sk_argument); stack = _bt_search(rel, 1, &skdata, &buf); _bt_freestack(stack); @@ -1104,9 +1104,10 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir) rel = scan->relation; current = &(scan->currentItemData); + /* - * Don't use ItemPointerGetOffsetNumber or you risk to get - * assertion due to ability of ip_posid to be equal 0. + * Don't use ItemPointerGetOffsetNumber or you risk to get assertion + * due to ability of ip_posid to be equal 0. */ offnum = current->ip_posid; page = BufferGetPage(*bufP); diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c index c8c494d3f94..d5c2c30bef8 100644 --- a/src/backend/access/nbtree/nbtsort.c +++ b/src/backend/access/nbtree/nbtsort.c @@ -5,7 +5,7 @@ * * * IDENTIFICATION - * $Id: nbtsort.c,v 1.38 1999/05/09 00:53:19 tgl Exp $ + * $Id: nbtsort.c,v 1.39 1999/05/25 16:07:34 momjian Exp $ * * NOTES * @@ -552,16 +552,16 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique) btspool->bts_tape = 0; btspool->isunique = isunique; - btspool->bts_itape =(BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes); - btspool->bts_otape =(BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes); + btspool->bts_itape = (BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes); + btspool->bts_otape = (BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes); if (btspool->bts_itape == (BTTapeBlock **) NULL || btspool->bts_otape == (BTTapeBlock **) NULL) elog(ERROR, "_bt_spoolinit: out of memory"); for (i = 0; i < ntapes; ++i) { - btspool->bts_itape[i] = _bt_tapecreate(); - btspool->bts_otape[i] = _bt_tapecreate(); + btspool->bts_itape[i] = _bt_tapecreate(); + btspool->bts_otape[i] = _bt_tapecreate(); } _bt_isortcmpinit(index, btspool); diff --git a/src/backend/access/rtree/rtree.c b/src/backend/access/rtree/rtree.c index 57e89424500..f62a4bf648a 100644 --- a/src/backend/access/rtree/rtree.c +++ b/src/backend/access/rtree/rtree.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.31 1999/02/13 23:14:42 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.32 1999/05/25 16:07:38 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -307,7 +307,7 @@ rtinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation he /* * Notes in ExecUtils:ExecOpenIndices() * - RelationSetLockForWrite(r); + * RelationSetLockForWrite(r); */ res = rtdoinsert(r, itup, &rtState); @@ -947,10 +947,10 @@ rtdelete(Relation r, ItemPointer tid) Page page; /* - * Notes in ExecUtils:ExecOpenIndices() - * Also note that only vacuum deletes index tuples now... + * Notes in ExecUtils:ExecOpenIndices() Also note that only vacuum + * deletes index tuples now... * - RelationSetLockForWrite(r); + * RelationSetLockForWrite(r); */ blkno = ItemPointerGetBlockNumber(tid); diff --git a/src/backend/access/rtree/rtscan.c b/src/backend/access/rtree/rtscan.c index 596972960bd..b74a341304a 100644 --- a/src/backend/access/rtree/rtscan.c +++ b/src/backend/access/rtree/rtscan.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.22 1999/02/13 23:14:43 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.23 1999/05/25 16:07:40 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -69,7 +69,7 @@ rtbeginscan(Relation r, /* * Let index_beginscan does its work... * - RelationSetLockForRead(r); + * RelationSetLockForRead(r); */ s = RelationGetIndexScan(r, fromEnd, nkeys, key); diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c index 35f07e6185a..fe1d57d769c 100644 --- a/src/backend/access/transam/transam.c +++ b/src/backend/access/transam/transam.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.25 1999/03/30 01:37:21 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.26 1999/05/25 16:07:45 momjian Exp $ * * NOTES * This file contains the high level access-method interface to the @@ -221,7 +221,7 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */ /* * update (invalidate) our single item TransactionLogTest cache. * - if (status != XID_COMMIT) + * if (status != XID_COMMIT) * * What's the hell ?! Why != XID_COMMIT ?! */ @@ -374,7 +374,7 @@ TransRecover(Relation logRelation) */ /* - * InitializeTransactionLog + * InitializeTransactionLog * Initializes transaction logging. */ void @@ -484,7 +484,7 @@ InitializeTransactionLog(void) */ /* - * TransactionIdDidCommit + * TransactionIdDidCommit * True iff transaction associated with the identifier did commit. * * Note: @@ -500,7 +500,7 @@ TransactionIdDidCommit(TransactionId transactionId) } /* - * TransactionIdDidAborted + * TransactionIdDidAborted * True iff transaction associated with the identifier did abort. * * Note: @@ -541,7 +541,7 @@ TransactionIdIsInProgress(TransactionId transactionId) */ /* - * TransactionIdCommit + * TransactionIdCommit * Commits the transaction associated with the identifier. * * Note: @@ -557,7 +557,7 @@ TransactionIdCommit(TransactionId transactionId) } /* - * TransactionIdAbort + * TransactionIdAbort * Aborts the transaction associated with the identifier. * * Note: diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index f910ea5f0f1..4bcc55bb92c 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.19 1999/02/13 23:14:48 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.20 1999/05/25 16:07:48 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -260,7 +260,7 @@ VariableRelationPutNextOid(Oid *oidP) * In the version 2 transaction system, transaction id's are * restricted in several ways. * - * -- Old comments removed + * -- Old comments removed * * Second, since we may someday preform compression of the data * in the log and time relations, we cause the numbering of the diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index f125baed6db..000abbc7ecb 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.35 1999/05/13 00:34:57 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.36 1999/05/25 16:07:50 momjian Exp $ * * NOTES * Transaction aborts can now occur two ways: @@ -194,8 +194,8 @@ TransactionStateData CurrentTransactionStateData = { TransactionState CurrentTransactionState = &CurrentTransactionStateData; -int DefaultXactIsoLevel = XACT_READ_COMMITTED; -int XactIsoLevel; +int DefaultXactIsoLevel = XACT_READ_COMMITTED; +int XactIsoLevel; /* ---------------- * info returned when the system is disabled @@ -299,6 +299,7 @@ IsTransactionState(void) */ return false; } + #endif /* -------------------------------- @@ -516,7 +517,7 @@ CommandCounterIncrement() AtStart_Cache(); TransactionIdFlushCache(); - + } void @@ -695,9 +696,9 @@ AtCommit_Memory() /* ---------------- * Release memory in the blank portal. - * Since EndPortalAllocMode implicitly works on the current context, - * first make real sure that the blank portal is the selected context. - * (This is probably not necessary, but seems like a good idea...) + * Since EndPortalAllocMode implicitly works on the current context, + * first make real sure that the blank portal is the selected context. + * (This is probably not necessary, but seems like a good idea...) * ---------------- */ portal = GetPortalByName(NULL); @@ -789,9 +790,9 @@ AtAbort_Memory() /* ---------------- * Release memory in the blank portal. - * Since EndPortalAllocMode implicitly works on the current context, - * first make real sure that the blank portal is the selected context. - * (This is ESSENTIAL in case we aborted from someplace where it wasn't.) + * Since EndPortalAllocMode implicitly works on the current context, + * first make real sure that the blank portal is the selected context. + * (This is ESSENTIAL in case we aborted from someplace where it wasn't.) * ---------------- */ portal = GetPortalByName(NULL); @@ -1074,7 +1075,7 @@ StartTransactionCommand() break; /* ---------------- - * As with BEGIN, we should never experience this + * As with BEGIN, we should never experience this * if we do it means the END state was not changed in the * previous CommitTransactionCommand(). If we get it, we * print a warning, commit the transaction, start a new @@ -1509,6 +1510,7 @@ AbortOutOfAnyTransaction() */ if (s->state != TRANS_DEFAULT) AbortTransaction(); + /* * Now reset the high-level state */ diff --git a/src/backend/access/transam/xid.c b/src/backend/access/transam/xid.c index e7b68d48e7f..2b15fec1bf6 100644 --- a/src/backend/access/transam/xid.c +++ b/src/backend/access/transam/xid.c @@ -5,7 +5,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: xid.c,v 1.21 1999/02/13 23:14:49 momjian Exp $ + * $Id: xid.c,v 1.22 1999/05/25 16:07:52 momjian Exp $ * * OLD COMMENTS * XXX WARNING |