mirror of
https://github.com/postgres/postgres.git
synced 2025-08-30 06:01:21 +03:00
OK, folks, here is the pgindent output.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* These functions are stored in pg_amproc. For each operator class
|
||||
@@ -87,10 +87,11 @@ btoidcmp(Oid a, Oid b)
|
||||
int32
|
||||
btoid8cmp(Oid *a, Oid *b)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < 8; i++)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
/* 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]))
|
||||
return 1;
|
||||
else
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* 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
|
||||
int natts = rel->rd_rel->relnatts;
|
||||
InsertIndexResult res;
|
||||
Buffer buffer;
|
||||
|
||||
|
||||
itup = &(btitem->bti_itup);
|
||||
|
||||
/* we need a scan key to do our search, so build one */
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* This file contains only the public interface routines.
|
||||
@@ -44,7 +44,7 @@ bool BuildingBtree = false; /* see comment in btbuild() */
|
||||
bool FastBuild = true; /* use sort/build instead of insertion
|
||||
* build */
|
||||
|
||||
static void _bt_restscan(IndexScanDesc scan);
|
||||
static void _bt_restscan(IndexScanDesc scan);
|
||||
|
||||
/*
|
||||
* btbuild() -- build a new btree index.
|
||||
@@ -151,7 +151,7 @@ btbuild(Relation heap,
|
||||
*/
|
||||
usefast = false;
|
||||
}
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
|
||||
/* start a heap scan */
|
||||
/* build the index */
|
||||
@@ -184,7 +184,7 @@ btbuild(Relation heap,
|
||||
nitups++;
|
||||
continue;
|
||||
}
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -198,7 +198,7 @@ btbuild(Relation heap,
|
||||
slot->val = htup;
|
||||
if (ExecQual((List *) pred, econtext) == false)
|
||||
continue;
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
}
|
||||
|
||||
nitups++;
|
||||
@@ -283,7 +283,7 @@ btbuild(Relation heap,
|
||||
#ifndef OMIT_PARTIAL_INDEX
|
||||
ExecDestroyTupleTable(tupleTable, true);
|
||||
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
|
||||
/*
|
||||
* See comments in btbuild.
|
||||
*
|
||||
* if (itup->t_info & INDEX_NULL_MASK)
|
||||
return (InsertIndexResult) NULL;
|
||||
* if (itup->t_info & INDEX_NULL_MASK) return (InsertIndexResult) NULL;
|
||||
*/
|
||||
|
||||
btitem = _bt_formitem(itup);
|
||||
|
||||
res = _bt_doinsert(rel, btitem,
|
||||
IndexIsUnique(RelationGetRelid(rel)), heapRel);
|
||||
IndexIsUnique(RelationGetRelid(rel)), heapRel);
|
||||
|
||||
pfree(btitem);
|
||||
pfree(itup);
|
||||
@@ -397,27 +396,26 @@ btgettuple(IndexScanDesc scan, ScanDirection dir)
|
||||
|
||||
if (ItemPointerIsValid(&(scan->currentItemData)))
|
||||
{
|
||||
|
||||
/*
|
||||
* Now we don't adjust scans on insertion (comments in
|
||||
* nbtscan.c:_bt_scandel()) and I hope that we will unlock
|
||||
* current index page before leaving index in LLL: this
|
||||
* means that current index tuple could be moved right
|
||||
* before we get here and we have to restore our scan
|
||||
* position. We save heap TID pointed by current index
|
||||
* tuple and use it. This will work untill we start
|
||||
* to re-use (move heap tuples) without vacuum...
|
||||
* - vadim 07/29/98
|
||||
* nbtscan.c:_bt_scandel()) and I hope that we will unlock current
|
||||
* index page before leaving index in LLL: this means that current
|
||||
* index tuple could be moved right before we get here and we have
|
||||
* to restore our scan position. We save heap TID pointed by
|
||||
* current index tuple and use it. This will work untill we start
|
||||
* to re-use (move heap tuples) without vacuum... - vadim 07/29/98
|
||||
*/
|
||||
_bt_restscan(scan);
|
||||
res = _bt_next(scan, dir);
|
||||
}
|
||||
else
|
||||
res = _bt_first(scan, dir);
|
||||
|
||||
|
||||
/* Save heap TID to use it in _bt_restscan */
|
||||
if (res)
|
||||
((BTScanOpaque)scan->opaque)->curHeapIptr = res->heap_iptr;
|
||||
|
||||
((BTScanOpaque) scan->opaque)->curHeapIptr = res->heap_iptr;
|
||||
|
||||
return (char *) res;
|
||||
}
|
||||
|
||||
@@ -627,33 +625,34 @@ btdelete(Relation rel, ItemPointer tid)
|
||||
static void
|
||||
_bt_restscan(IndexScanDesc scan)
|
||||
{
|
||||
Relation rel = scan->relation;
|
||||
BTScanOpaque so = (BTScanOpaque) scan->opaque;
|
||||
Buffer buf = so->btso_curbuf;
|
||||
Page page = BufferGetPage(buf);
|
||||
ItemPointer current = &(scan->currentItemData);
|
||||
OffsetNumber offnum = ItemPointerGetOffsetNumber(current),
|
||||
maxoff = PageGetMaxOffsetNumber(page);
|
||||
BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page);
|
||||
ItemPointerData target = so->curHeapIptr;
|
||||
BTItem item;
|
||||
BlockNumber blkno;
|
||||
Relation rel = scan->relation;
|
||||
BTScanOpaque so = (BTScanOpaque) scan->opaque;
|
||||
Buffer buf = so->btso_curbuf;
|
||||
Page page = BufferGetPage(buf);
|
||||
ItemPointer current = &(scan->currentItemData);
|
||||
OffsetNumber offnum = ItemPointerGetOffsetNumber(current),
|
||||
maxoff = PageGetMaxOffsetNumber(page);
|
||||
BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page);
|
||||
ItemPointerData target = so->curHeapIptr;
|
||||
BTItem item;
|
||||
BlockNumber blkno;
|
||||
|
||||
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 = OffsetNumberNext(offnum))
|
||||
{
|
||||
item = (BTItem) PageGetItem(page, PageGetItemId(page, offnum));
|
||||
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 == \
|
||||
target.ip_blkid.bi_lo && \
|
||||
target.ip_blkid.bi_lo && \
|
||||
item->bti_itup.t_tid.ip_posid == target.ip_posid)
|
||||
{
|
||||
current->ip_posid = offnum;
|
||||
@@ -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 (;;)
|
||||
{
|
||||
@@ -678,15 +677,15 @@ _bt_restscan(IndexScanDesc scan)
|
||||
opaque = (BTPageOpaque) PageGetSpecialPointer(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 = OffsetNumberNext(offnum))
|
||||
{
|
||||
item = (BTItem) PageGetItem(page, PageGetItemId(page, offnum));
|
||||
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 == \
|
||||
target.ip_blkid.bi_lo && \
|
||||
target.ip_blkid.bi_lo && \
|
||||
item->bti_itup.t_tid.ip_posid == target.ip_posid)
|
||||
{
|
||||
ItemPointerSet(current, blkno, offnum);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@@ -166,10 +166,10 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
|
||||
so->btso_curbuf = buf;
|
||||
if (ItemPointerIsValid(current))
|
||||
{
|
||||
Page page = BufferGetPage(buf);
|
||||
BTItem btitem = (BTItem) PageGetItem(page,
|
||||
PageGetItemId(page, ItemPointerGetOffsetNumber(current)));
|
||||
|
||||
Page page = BufferGetPage(buf);
|
||||
BTItem btitem = (BTItem) PageGetItem(page,
|
||||
PageGetItemId(page, ItemPointerGetOffsetNumber(current)));
|
||||
|
||||
so->curHeapIptr = btitem->bti_itup.t_tid;
|
||||
}
|
||||
}
|
||||
@@ -209,10 +209,10 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
|
||||
scan->currentItemData = tmp;
|
||||
if (ItemPointerIsValid(current))
|
||||
{
|
||||
Page page = BufferGetPage(buf);
|
||||
BTItem btitem = (BTItem) PageGetItem(page,
|
||||
PageGetItemId(page, ItemPointerGetOffsetNumber(current)));
|
||||
|
||||
Page page = BufferGetPage(buf);
|
||||
BTItem btitem = (BTItem) PageGetItem(page,
|
||||
PageGetItemId(page, ItemPointerGetOffsetNumber(current)));
|
||||
|
||||
so->mrkHeapIptr = btitem->bti_itup.t_tid;
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* 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 @@
|
||||
#endif
|
||||
|
||||
|
||||
static BTStack
|
||||
_bt_searchr(Relation rel, int keysz, ScanKey scankey,
|
||||
static BTStack _bt_searchr(Relation rel, int keysz, ScanKey scankey,
|
||||
Buffer *bufP, BTStack stack_in);
|
||||
static OffsetNumber
|
||||
_bt_firsteq(Relation rel, TupleDesc itupdesc, Page page,
|
||||
static OffsetNumber _bt_firsteq(Relation rel, TupleDesc itupdesc, Page page,
|
||||
Size keysz, ScanKey scankey, OffsetNumber offnum);
|
||||
static int
|
||||
_bt_compare(Relation rel, TupleDesc itupdesc, Page page,
|
||||
static int _bt_compare(Relation rel, TupleDesc itupdesc, Page page,
|
||||
int keysz, ScanKey scankey, OffsetNumber offnum);
|
||||
static bool
|
||||
_bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir);
|
||||
@@ -219,8 +216,8 @@ _bt_moveright(Relation rel,
|
||||
if (_bt_skeycmp(rel, keysz, scankey, page,
|
||||
PageGetItemId(page, P_FIRSTKEY),
|
||||
BTEqualStrategyNumber))
|
||||
elog(FATAL, "btree: BTP_CHAIN flag was expected in %s (access = %s)",
|
||||
rel->rd_rel->relname, access ? "bt_write" : "bt_read");
|
||||
elog(FATAL, "btree: BTP_CHAIN flag was expected in %s (access = %s)",
|
||||
rel->rd_rel->relname, access ? "bt_write" : "bt_read");
|
||||
if (_bt_skeycmp(rel, keysz, scankey, page,
|
||||
PageGetItemId(page, offmax),
|
||||
BTEqualStrategyNumber))
|
||||
|
@@ -5,7 +5,7 @@
|
||||
*
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -184,7 +184,7 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2)
|
||||
return 1; /* 1 > 2 */
|
||||
}
|
||||
else if (k2->btsk_item == (BTItem) NULL)
|
||||
return -1; /* 1 < 2 */
|
||||
return -1; /* 1 < 2 */
|
||||
|
||||
for (i = 0; i < _bt_nattr; i++)
|
||||
{
|
||||
@@ -198,14 +198,14 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2)
|
||||
return 1; /* NULL ">" NOT_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,
|
||||
k1_datum[i], k2_datum[i]))
|
||||
return 1; /* 1 > 2 */
|
||||
else if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber,
|
||||
k2_datum[i], k1_datum[i]))
|
||||
return -1; /* 1 < 2 */
|
||||
return -1; /* 1 < 2 */
|
||||
}
|
||||
|
||||
if (_bt_inspool->isunique && !equal_isnull)
|
||||
@@ -731,7 +731,7 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
|
||||
printf("_bt_spool: inserted <%x> into output tape %d\n",
|
||||
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)
|
||||
printf("_bt_buildadd: moved <%x> to offset %d at level %d\n",
|
||||
d, n, state->btps_level);
|
||||
}
|
||||
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
|
||||
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
d, off, state->btps_level);
|
||||
}
|
||||
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
|
||||
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
|
||||
#endif
|
||||
if (last_bti == (BTItem) NULL)
|
||||
first_off = P_FIRSTKEY;
|
||||
@@ -1254,7 +1254,7 @@ _bt_merge(Relation index, BTSpool *btspool)
|
||||
npass, nruns, d, t,
|
||||
BufferGetBlockNumber(state->btps_buf));
|
||||
}
|
||||
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
|
||||
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1283,7 +1283,7 @@ _bt_merge(Relation index, BTSpool *btspool)
|
||||
npass, nruns, d, t,
|
||||
btspool->bts_tape);
|
||||
}
|
||||
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
|
||||
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
|
||||
}
|
||||
|
||||
if (btsk.btsk_datum != (Datum *) NULL)
|
||||
@@ -1408,7 +1408,7 @@ _bt_upperbuild(Relation index)
|
||||
printf("_bt_upperbuild: inserting <%x> at %d\n",
|
||||
d, state->btps_level);
|
||||
}
|
||||
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
|
||||
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
|
||||
_bt_buildadd(index, state, nbti, 0);
|
||||
pfree((void *) nbti);
|
||||
}
|
||||
|
Reference in New Issue
Block a user