mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Phase 3 of pgindent updates.
Don't move parenthesized lines to the left, even if that means they flow past the right margin. By default, BSD indent lines up statement continuation lines that are within parentheses so that they start just to the right of the preceding left parenthesis. However, traditionally, if that resulted in the continuation line extending to the right of the desired right margin, then indent would push it left just far enough to not overrun the margin, if it could do so without making the continuation line start to the left of the current statement indent. That makes for a weird mix of indentations unless one has been completely rigid about never violating the 80-column limit. This behavior has been pretty universally panned by Postgres developers. Hence, disable it with indent's new -lpl switch, so that parenthesized lines are always lined up with the preceding left paren. This patch is much less interesting than the first round of indent changes, but also bulkier, so I thought it best to separate the effects. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
@ -28,7 +28,7 @@
|
||||
/* non-export function prototypes */
|
||||
static void gistfixsplit(GISTInsertState *state, GISTSTATE *giststate);
|
||||
static bool gistinserttuple(GISTInsertState *state, GISTInsertStack *stack,
|
||||
GISTSTATE *giststate, IndexTuple tuple, OffsetNumber oldoffnum);
|
||||
GISTSTATE *giststate, IndexTuple tuple, OffsetNumber oldoffnum);
|
||||
static bool gistinserttuples(GISTInsertState *state, GISTInsertStack *stack,
|
||||
GISTSTATE *giststate,
|
||||
IndexTuple *tuples, int ntup, OffsetNumber oldoffnum,
|
||||
@ -1170,7 +1170,7 @@ gistfixsplit(GISTInsertState *state, GISTSTATE *giststate)
|
||||
*/
|
||||
static bool
|
||||
gistinserttuple(GISTInsertState *state, GISTInsertStack *stack,
|
||||
GISTSTATE *giststate, IndexTuple tuple, OffsetNumber oldoffnum)
|
||||
GISTSTATE *giststate, IndexTuple tuple, OffsetNumber oldoffnum)
|
||||
{
|
||||
return gistinserttuples(state, stack, giststate, &tuple, 1, oldoffnum,
|
||||
InvalidBuffer, InvalidBuffer, false, false);
|
||||
@ -1360,9 +1360,9 @@ gistSplit(Relation r,
|
||||
if (len == 1)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||
errmsg("index row size %zu exceeds maximum %zu for index \"%s\"",
|
||||
IndexTupleSize(itup[0]), GiSTPageSize,
|
||||
RelationGetRelationName(r))));
|
||||
errmsg("index row size %zu exceeds maximum %zu for index \"%s\"",
|
||||
IndexTupleSize(itup[0]), GiSTPageSize,
|
||||
RelationGetRelationName(r))));
|
||||
|
||||
memset(v.spl_lisnull, TRUE, sizeof(bool) * giststate->tupdesc->natts);
|
||||
memset(v.spl_risnull, TRUE, sizeof(bool) * giststate->tupdesc->natts);
|
||||
@ -1471,7 +1471,7 @@ initGISTstate(Relation index)
|
||||
/* opclasses are not required to provide a Distance method */
|
||||
if (OidIsValid(index_getprocid(index, i + 1, GIST_DISTANCE_PROC)))
|
||||
fmgr_info_copy(&(giststate->distanceFn[i]),
|
||||
index_getprocinfo(index, i + 1, GIST_DISTANCE_PROC),
|
||||
index_getprocinfo(index, i + 1, GIST_DISTANCE_PROC),
|
||||
scanCxt);
|
||||
else
|
||||
giststate->distanceFn[i].fn_oid = InvalidOid;
|
||||
|
@ -248,7 +248,7 @@ gistValidateBufferingOption(char *value)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("invalid value for \"buffering\" option"),
|
||||
errdetail("Valid values are \"on\", \"off\", and \"auto\".")));
|
||||
errdetail("Valid values are \"on\", \"off\", and \"auto\".")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1083,7 +1083,7 @@ gistGetMaxLevel(Relation index)
|
||||
* everywhere, so we just pick the first one.
|
||||
*/
|
||||
itup = (IndexTuple) PageGetItem(page,
|
||||
PageGetItemId(page, FirstOffsetNumber));
|
||||
PageGetItemId(page, FirstOffsetNumber));
|
||||
blkno = ItemPointerGetBlockNumber(&(itup->t_tid));
|
||||
UnlockReleaseBuffer(buffer);
|
||||
|
||||
@ -1143,7 +1143,7 @@ gistInitParentMap(GISTBuildState *buildstate)
|
||||
buildstate->parentMap = hash_create("gistbuild parent map",
|
||||
1024,
|
||||
&hashCtl,
|
||||
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
|
||||
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -102,7 +102,7 @@ gistInitBuildBuffers(int pagesPerBuffer, int levelStep, int maxLevel)
|
||||
*/
|
||||
gfbb->loadedBuffersLen = 32;
|
||||
gfbb->loadedBuffers = (GISTNodeBuffer **) palloc(gfbb->loadedBuffersLen *
|
||||
sizeof(GISTNodeBuffer *));
|
||||
sizeof(GISTNodeBuffer *));
|
||||
gfbb->loadedBuffersCount = 0;
|
||||
|
||||
gfbb->rootlevel = maxLevel;
|
||||
|
@ -910,64 +910,64 @@ gist_box_leaf_consistent(BOX *key, BOX *query, StrategyNumber strategy)
|
||||
case RTLeftStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_left,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTOverLeftStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_overleft,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTOverlapStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_overlap,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTOverRightStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_overright,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTRightStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_right,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTSameStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_same,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTContainsStrategyNumber:
|
||||
case RTOldContainsStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_contain,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTContainedByStrategyNumber:
|
||||
case RTOldContainedByStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_contained,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTOverBelowStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_overbelow,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTBelowStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_below,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTAboveStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_above,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTOverAboveStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_overabove,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized strategy number: %d", strategy);
|
||||
@ -997,60 +997,60 @@ rtree_internal_consistent(BOX *key, BOX *query, StrategyNumber strategy)
|
||||
case RTLeftStrategyNumber:
|
||||
retval = !DatumGetBool(DirectFunctionCall2(box_overright,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTOverLeftStrategyNumber:
|
||||
retval = !DatumGetBool(DirectFunctionCall2(box_right,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTOverlapStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_overlap,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTOverRightStrategyNumber:
|
||||
retval = !DatumGetBool(DirectFunctionCall2(box_left,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTRightStrategyNumber:
|
||||
retval = !DatumGetBool(DirectFunctionCall2(box_overleft,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTSameStrategyNumber:
|
||||
case RTContainsStrategyNumber:
|
||||
case RTOldContainsStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_contain,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTContainedByStrategyNumber:
|
||||
case RTOldContainedByStrategyNumber:
|
||||
retval = DatumGetBool(DirectFunctionCall2(box_overlap,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTOverBelowStrategyNumber:
|
||||
retval = !DatumGetBool(DirectFunctionCall2(box_above,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTBelowStrategyNumber:
|
||||
retval = !DatumGetBool(DirectFunctionCall2(box_overabove,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTAboveStrategyNumber:
|
||||
retval = !DatumGetBool(DirectFunctionCall2(box_overbelow,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
case RTOverAboveStrategyNumber:
|
||||
retval = !DatumGetBool(DirectFunctionCall2(box_below,
|
||||
PointerGetDatum(key),
|
||||
PointerGetDatum(query)));
|
||||
PointerGetDatum(query)));
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized strategy number: %d", strategy);
|
||||
@ -1419,11 +1419,11 @@ gist_point_consistent(PG_FUNCTION_ARGS)
|
||||
POLYGON *query = PG_GETARG_POLYGON_P(1);
|
||||
|
||||
result = DatumGetBool(DirectFunctionCall5(
|
||||
gist_poly_consistent,
|
||||
PointerGetDatum(entry),
|
||||
PolygonPGetDatum(query),
|
||||
Int16GetDatum(RTOverlapStrategyNumber),
|
||||
0, PointerGetDatum(recheck)));
|
||||
gist_poly_consistent,
|
||||
PointerGetDatum(entry),
|
||||
PolygonPGetDatum(query),
|
||||
Int16GetDatum(RTOverlapStrategyNumber),
|
||||
0, PointerGetDatum(recheck)));
|
||||
|
||||
if (GIST_LEAF(entry) && result)
|
||||
{
|
||||
@ -1437,8 +1437,8 @@ gist_point_consistent(PG_FUNCTION_ARGS)
|
||||
&& box->high.y == box->low.y);
|
||||
result = DatumGetBool(DirectFunctionCall2(
|
||||
poly_contain_pt,
|
||||
PolygonPGetDatum(query),
|
||||
PointPGetDatum(&box->high)));
|
||||
PolygonPGetDatum(query),
|
||||
PointPGetDatum(&box->high)));
|
||||
*recheck = false;
|
||||
}
|
||||
}
|
||||
@ -1448,11 +1448,11 @@ gist_point_consistent(PG_FUNCTION_ARGS)
|
||||
CIRCLE *query = PG_GETARG_CIRCLE_P(1);
|
||||
|
||||
result = DatumGetBool(DirectFunctionCall5(
|
||||
gist_circle_consistent,
|
||||
PointerGetDatum(entry),
|
||||
CirclePGetDatum(query),
|
||||
Int16GetDatum(RTOverlapStrategyNumber),
|
||||
0, PointerGetDatum(recheck)));
|
||||
gist_circle_consistent,
|
||||
PointerGetDatum(entry),
|
||||
CirclePGetDatum(query),
|
||||
Int16GetDatum(RTOverlapStrategyNumber),
|
||||
0, PointerGetDatum(recheck)));
|
||||
|
||||
if (GIST_LEAF(entry) && result)
|
||||
{
|
||||
@ -1465,9 +1465,9 @@ gist_point_consistent(PG_FUNCTION_ARGS)
|
||||
Assert(box->high.x == box->low.x
|
||||
&& box->high.y == box->low.y);
|
||||
result = DatumGetBool(DirectFunctionCall2(
|
||||
circle_contain_pt,
|
||||
CirclePGetDatum(query),
|
||||
PointPGetDatum(&box->high)));
|
||||
circle_contain_pt,
|
||||
CirclePGetDatum(query),
|
||||
PointPGetDatum(&box->high)));
|
||||
*recheck = false;
|
||||
}
|
||||
}
|
||||
|
@ -443,8 +443,8 @@ gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVec
|
||||
*/
|
||||
ereport(DEBUG1,
|
||||
(errcode(ERRCODE_INTERNAL_ERROR),
|
||||
errmsg("picksplit method for column %d of index \"%s\" failed",
|
||||
attno + 1, RelationGetRelationName(r)),
|
||||
errmsg("picksplit method for column %d 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.")));
|
||||
|
||||
/*
|
||||
|
@ -552,7 +552,7 @@ gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
|
||||
gistentryinit(*e, k, r, pg, o, l);
|
||||
dep = (GISTENTRY *)
|
||||
DatumGetPointer(FunctionCall1Coll(&giststate->decompressFn[nkey],
|
||||
giststate->supportCollation[nkey],
|
||||
giststate->supportCollation[nkey],
|
||||
PointerGetDatum(e)));
|
||||
/* decompressFn may just return the given pointer */
|
||||
if (dep != e)
|
||||
@ -587,7 +587,7 @@ gistFormTuple(GISTSTATE *giststate, Relation r,
|
||||
isleaf);
|
||||
cep = (GISTENTRY *)
|
||||
DatumGetPointer(FunctionCall1Coll(&giststate->compressFn[i],
|
||||
giststate->supportCollation[i],
|
||||
giststate->supportCollation[i],
|
||||
PointerGetDatum(¢ry)));
|
||||
compatt[i] = cep->key;
|
||||
}
|
||||
@ -733,9 +733,9 @@ gistcheckpage(Relation rel, Buffer buf)
|
||||
if (PageIsNew(page))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INDEX_CORRUPTED),
|
||||
errmsg("index \"%s\" contains unexpected zero page at block %u",
|
||||
RelationGetRelationName(rel),
|
||||
BufferGetBlockNumber(buf)),
|
||||
errmsg("index \"%s\" contains unexpected zero page at block %u",
|
||||
RelationGetRelationName(rel),
|
||||
BufferGetBlockNumber(buf)),
|
||||
errhint("Please REINDEX it.")));
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user