mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.80 2009/01/01 17:23:35 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.81 2009/06/11 14:48:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -79,7 +79,7 @@ gistgettuple(PG_FUNCTION_ARGS)
|
||||
|
||||
so = (GISTScanOpaque) scan->opaque;
|
||||
|
||||
if (dir != ForwardScanDirection)
|
||||
if (dir != ForwardScanDirection)
|
||||
elog(ERROR, "GiST doesn't support other scan directions than forward");
|
||||
|
||||
/*
|
||||
@ -101,8 +101,8 @@ Datum
|
||||
gistgetbitmap(PG_FUNCTION_ARGS)
|
||||
{
|
||||
IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
|
||||
TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1);
|
||||
int64 ntids;
|
||||
TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1);
|
||||
int64 ntids;
|
||||
|
||||
ntids = gistnext(scan, tbm);
|
||||
|
||||
@ -136,10 +136,10 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
|
||||
|
||||
so = (GISTScanOpaque) scan->opaque;
|
||||
|
||||
if ( so->qual_ok == false )
|
||||
if (so->qual_ok == false)
|
||||
return 0;
|
||||
|
||||
if ( so->curbuf == InvalidBuffer )
|
||||
if (so->curbuf == InvalidBuffer)
|
||||
{
|
||||
if (ItemPointerIsValid(&so->curpos) == false)
|
||||
{
|
||||
@ -155,7 +155,7 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
|
||||
stk->block = GIST_ROOT_BLKNO;
|
||||
|
||||
pgstat_count_index_scan(scan->indexRelation);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* scan is finished */
|
||||
@ -164,25 +164,25 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
|
||||
}
|
||||
|
||||
/*
|
||||
* check stored pointers from last visit
|
||||
* check stored pointers from last visit
|
||||
*/
|
||||
if ( so->nPageData > 0 )
|
||||
if (so->nPageData > 0)
|
||||
{
|
||||
/*
|
||||
* gistgetmulti never should go here
|
||||
*/
|
||||
Assert( tbm == NULL );
|
||||
Assert(tbm == NULL);
|
||||
|
||||
if ( so->curPageData < so->nPageData )
|
||||
if (so->curPageData < so->nPageData)
|
||||
{
|
||||
scan->xs_ctup.t_self = so->pageData[ so->curPageData ].heapPtr;
|
||||
scan->xs_recheck = so->pageData[ so->curPageData ].recheck;
|
||||
scan->xs_ctup.t_self = so->pageData[so->curPageData].heapPtr;
|
||||
scan->xs_recheck = so->pageData[so->curPageData].recheck;
|
||||
|
||||
ItemPointerSet(&so->curpos,
|
||||
BufferGetBlockNumber(so->curbuf),
|
||||
so->pageData[ so->curPageData ].pageOffset);
|
||||
BufferGetBlockNumber(so->curbuf),
|
||||
so->pageData[so->curPageData].pageOffset);
|
||||
|
||||
so->curPageData ++;
|
||||
so->curPageData++;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -227,7 +227,7 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
|
||||
if (!XLogRecPtrIsInvalid(so->stack->parentlsn) &&
|
||||
XLByteLT(so->stack->parentlsn, opaque->nsn) &&
|
||||
opaque->rightlink != InvalidBlockNumber /* sanity check */ &&
|
||||
(so->stack->next == NULL || so->stack->next->block != opaque->rightlink) /* check if already
|
||||
(so->stack->next == NULL || so->stack->next->block != opaque->rightlink) /* check if already
|
||||
added */ )
|
||||
{
|
||||
/* detect page split, follow right link to add pages */
|
||||
@ -272,12 +272,12 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
|
||||
if (!OffsetNumberIsValid(n))
|
||||
{
|
||||
/*
|
||||
* If we was called from gistgettuple and current buffer contains
|
||||
* something matched then make a recursive call - it will return
|
||||
* ItemPointer from so->pageData. But we save buffer pinned to
|
||||
* support tuple's killing
|
||||
* If we was called from gistgettuple and current buffer
|
||||
* contains something matched then make a recursive call - it
|
||||
* will return ItemPointer from so->pageData. But we save
|
||||
* buffer pinned to support tuple's killing
|
||||
*/
|
||||
if ( !tbm && so->nPageData > 0 )
|
||||
if (!tbm && so->nPageData > 0)
|
||||
{
|
||||
LockBuffer(so->curbuf, GIST_UNLOCK);
|
||||
return gistnext(scan, NULL);
|
||||
@ -324,12 +324,12 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
|
||||
ntids++;
|
||||
if (tbm != NULL)
|
||||
tbm_add_tuples(tbm, &it->t_tid, 1, scan->xs_recheck);
|
||||
else
|
||||
else
|
||||
{
|
||||
so->pageData[ so->nPageData ].heapPtr = it->t_tid;
|
||||
so->pageData[ so->nPageData ].pageOffset = n;
|
||||
so->pageData[ so->nPageData ].recheck = scan->xs_recheck;
|
||||
so->nPageData ++;
|
||||
so->pageData[so->nPageData].heapPtr = it->t_tid;
|
||||
so->pageData[so->nPageData].pageOffset = n;
|
||||
so->pageData[so->nPageData].recheck = scan->xs_recheck;
|
||||
so->nPageData++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -437,8 +437,8 @@ gistindex_keytest(IndexTuple tuple,
|
||||
/*
|
||||
* Call the Consistent function to evaluate the test. The
|
||||
* arguments are the index datum (as a GISTENTRY*), the comparison
|
||||
* datum, the comparison operator's strategy number and
|
||||
* subtype from pg_amop, and the recheck flag.
|
||||
* datum, the comparison operator's strategy number and subtype
|
||||
* from pg_amop, and the recheck flag.
|
||||
*
|
||||
* (Presently there's no need to pass the subtype since it'll
|
||||
* always be zero, but might as well pass it for possible future
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistproc.c,v 1.16 2009/04/06 14:27:27 teodor Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistproc.c,v 1.17 2009/06/11 14:48:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -86,6 +86,7 @@ gist_box_consistent(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
BOX *query = PG_GETARG_BOX_P(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
|
||||
@ -279,11 +280,11 @@ chooseLR(GIST_SPLITVEC *v,
|
||||
static void
|
||||
fallbackSplit(GistEntryVector *entryvec, GIST_SPLITVEC *v)
|
||||
{
|
||||
OffsetNumber i,
|
||||
maxoff;
|
||||
BOX *unionL = NULL,
|
||||
*unionR = NULL;
|
||||
int nbytes;
|
||||
OffsetNumber i,
|
||||
maxoff;
|
||||
BOX *unionL = NULL,
|
||||
*unionR = NULL;
|
||||
int nbytes;
|
||||
|
||||
maxoff = entryvec->n - 1;
|
||||
|
||||
@ -294,7 +295,7 @@ fallbackSplit(GistEntryVector *entryvec, GIST_SPLITVEC *v)
|
||||
|
||||
for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
|
||||
{
|
||||
BOX * cur = DatumGetBoxP(entryvec->vector[i].key);
|
||||
BOX *cur = DatumGetBoxP(entryvec->vector[i].key);
|
||||
|
||||
if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
|
||||
{
|
||||
@ -767,6 +768,7 @@ gist_poly_consistent(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
POLYGON *query = PG_GETARG_POLYGON_P(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
bool result;
|
||||
@ -843,6 +845,7 @@ gist_circle_consistent(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
CIRCLE *query = PG_GETARG_CIRCLE_P(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
BOX bbox;
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.75 2009/01/01 17:23:35 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.76 2009/06/11 14:48:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -94,11 +94,13 @@ gistrescan(PG_FUNCTION_ARGS)
|
||||
* Next, if any of keys is a NULL and that key is not marked with
|
||||
* SK_SEARCHNULL then nothing can be found.
|
||||
*/
|
||||
for (i = 0; i < scan->numberOfKeys; i++) {
|
||||
for (i = 0; i < scan->numberOfKeys; i++)
|
||||
{
|
||||
scan->keyData[i].sk_func = so->giststate->consistentFn[scan->keyData[i].sk_attno - 1];
|
||||
|
||||
if ( scan->keyData[i].sk_flags & SK_ISNULL ) {
|
||||
if ( (scan->keyData[i].sk_flags & SK_SEARCHNULL) == 0 )
|
||||
if (scan->keyData[i].sk_flags & SK_ISNULL)
|
||||
{
|
||||
if ((scan->keyData[i].sk_flags & SK_SEARCHNULL) == 0)
|
||||
so->qual_ok = false;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistsplit.c,v 1.9 2009/06/10 20:02:15 petere Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistsplit.c,v 1.10 2009/06/11 14:48:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -281,7 +281,7 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno, GIST_SPLITVEC
|
||||
}
|
||||
|
||||
/*
|
||||
* Trivial picksplit implementaion. Function called only
|
||||
* Trivial picksplit implementaion. Function called only
|
||||
* if user-defined picksplit puts all keys to the one page.
|
||||
* That is a bug of user-defined picksplit but we'd like
|
||||
* to "fix" that.
|
||||
@ -289,10 +289,10 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno, GIST_SPLITVEC
|
||||
static void
|
||||
genericPickSplit(GISTSTATE *giststate, GistEntryVector *entryvec, GIST_SPLITVEC *v, int attno)
|
||||
{
|
||||
OffsetNumber i,
|
||||
maxoff;
|
||||
int nbytes;
|
||||
GistEntryVector *evec;
|
||||
OffsetNumber i,
|
||||
maxoff;
|
||||
int nbytes;
|
||||
GistEntryVector *evec;
|
||||
|
||||
maxoff = entryvec->n - 1;
|
||||
|
||||
@ -320,21 +320,21 @@ genericPickSplit(GISTSTATE *giststate, GistEntryVector *entryvec, GIST_SPLITVEC
|
||||
* Form unions of each page
|
||||
*/
|
||||
|
||||
evec = palloc( sizeof(GISTENTRY) * entryvec->n + GEVHDRSZ );
|
||||
evec = palloc(sizeof(GISTENTRY) * entryvec->n + GEVHDRSZ);
|
||||
|
||||
evec->n = v->spl_nleft;
|
||||
memcpy(evec->vector, entryvec->vector + FirstOffsetNumber,
|
||||
sizeof(GISTENTRY) * evec->n);
|
||||
v->spl_ldatum = FunctionCall2(&giststate->unionFn[attno],
|
||||
PointerGetDatum(evec),
|
||||
PointerGetDatum(&nbytes));
|
||||
memcpy(evec->vector, entryvec->vector + FirstOffsetNumber,
|
||||
sizeof(GISTENTRY) * evec->n);
|
||||
v->spl_ldatum = FunctionCall2(&giststate->unionFn[attno],
|
||||
PointerGetDatum(evec),
|
||||
PointerGetDatum(&nbytes));
|
||||
|
||||
evec->n = v->spl_nright;
|
||||
memcpy(evec->vector, entryvec->vector + FirstOffsetNumber + v->spl_nleft,
|
||||
sizeof(GISTENTRY) * evec->n);
|
||||
v->spl_rdatum = FunctionCall2(&giststate->unionFn[attno],
|
||||
PointerGetDatum(evec),
|
||||
PointerGetDatum(&nbytes));
|
||||
memcpy(evec->vector, entryvec->vector + FirstOffsetNumber + v->spl_nleft,
|
||||
sizeof(GISTENTRY) * evec->n);
|
||||
v->spl_rdatum = FunctionCall2(&giststate->unionFn[attno],
|
||||
PointerGetDatum(evec),
|
||||
PointerGetDatum(&nbytes));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -365,17 +365,17 @@ gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVec
|
||||
PointerGetDatum(entryvec),
|
||||
PointerGetDatum(sv));
|
||||
|
||||
if ( sv->spl_nleft == 0 || sv->spl_nright == 0 )
|
||||
if (sv->spl_nleft == 0 || sv->spl_nright == 0)
|
||||
{
|
||||
ereport(DEBUG1,
|
||||
(errcode(ERRCODE_INTERNAL_ERROR),
|
||||
errmsg("picksplit method for %d column of index \"%s\" failed",
|
||||
attno+1, RelationGetRelationName(r)),
|
||||
errmsg("picksplit method for %d column of index \"%s\" failed",
|
||||
attno + 1, RelationGetRelationName(r)),
|
||||
errhint("The index is not optimal. To optimize it, contact a developer, or try to use the column as the second one in the CREATE INDEX command.")));
|
||||
|
||||
/*
|
||||
* Reinit GIST_SPLITVEC. Although that fields are not used
|
||||
* by genericPickSplit(), let us set up it for further processing
|
||||
* Reinit GIST_SPLITVEC. Although that fields are not used by
|
||||
* genericPickSplit(), let us set up it for further processing
|
||||
*/
|
||||
sv->spl_ldatum_exists = (v->spl_lisnull[attno]) ? false : true;
|
||||
sv->spl_rdatum_exists = (v->spl_risnull[attno]) ? false : true;
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.33 2009/01/05 17:14:28 alvherre Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.34 2009/06/11 14:48:53 momjian Exp $
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
@ -43,7 +43,8 @@ gistfillbuffer(Page page, IndexTuple *itup, int len, OffsetNumber off)
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
Size sz = IndexTupleSize(itup[i]);
|
||||
Size sz = IndexTupleSize(itup[i]);
|
||||
|
||||
l = PageAddItem(page, (Item) itup[i], sz, off, false, false);
|
||||
if (l == InvalidOffsetNumber)
|
||||
elog(ERROR, "failed to add item to GiST index page, item %d out of %d, size %d bytes",
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.44 2009/06/06 22:13:50 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.45 2009/06/11 14:48:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -510,7 +510,7 @@ gistvacuumcleanup(PG_FUNCTION_ARGS)
|
||||
Relation rel = info->index;
|
||||
BlockNumber npages,
|
||||
blkno;
|
||||
BlockNumber totFreePages;
|
||||
BlockNumber totFreePages;
|
||||
BlockNumber lastBlock = GIST_ROOT_BLKNO,
|
||||
lastFilledBlock = GIST_ROOT_BLKNO;
|
||||
bool needLock;
|
||||
|
Reference in New Issue
Block a user