mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Initial pgindent run for v12.
This is still using the 2.0 version of pg_bsd_indent. I thought it would be good to commit this separately, so as to document the differences between 2.0 and 2.1 behavior. Discussion: https://postgr.es/m/16296.1558103386@sss.pgh.pa.us
This commit is contained in:
@ -160,7 +160,7 @@ static inline bool invariant_l_nontarget_offset(BtreeCheckState *state,
|
||||
OffsetNumber upperbound);
|
||||
static Page palloc_btree_page(BtreeCheckState *state, BlockNumber blocknum);
|
||||
static inline BTScanInsert bt_mkscankey_pivotsearch(Relation rel,
|
||||
IndexTuple itup);
|
||||
IndexTuple itup);
|
||||
static ItemId PageGetItemIdCareful(BtreeCheckState *state, BlockNumber block,
|
||||
Page page, OffsetNumber offset);
|
||||
static inline ItemPointer BTreeTupleGetHeapTIDCareful(BtreeCheckState *state,
|
||||
@ -1029,7 +1029,7 @@ bt_target_page_check(BtreeCheckState *state)
|
||||
/* Fingerprint leaf page tuples (those that point to the heap) */
|
||||
if (state->heapallindexed && P_ISLEAF(topaque) && !ItemIdIsDead(itemid))
|
||||
{
|
||||
IndexTuple norm;
|
||||
IndexTuple norm;
|
||||
|
||||
norm = bt_normalize_tuple(state, itup);
|
||||
bloom_add_element(state->filter, (unsigned char *) norm,
|
||||
@ -1174,7 +1174,7 @@ bt_target_page_check(BtreeCheckState *state)
|
||||
*/
|
||||
else if (offset == max)
|
||||
{
|
||||
BTScanInsert rightkey;
|
||||
BTScanInsert rightkey;
|
||||
|
||||
/* Get item in next/right page */
|
||||
rightkey = bt_right_page_check_scankey(state);
|
||||
@ -1851,7 +1851,8 @@ bt_tuple_present_callback(Relation index, HeapTuple htup, Datum *values,
|
||||
bool *isnull, bool tupleIsAlive, void *checkstate)
|
||||
{
|
||||
BtreeCheckState *state = (BtreeCheckState *) checkstate;
|
||||
IndexTuple itup, norm;
|
||||
IndexTuple itup,
|
||||
norm;
|
||||
|
||||
Assert(state->heapallindexed);
|
||||
|
||||
@ -1931,7 +1932,7 @@ bt_normalize_tuple(BtreeCheckState *state, IndexTuple itup)
|
||||
|
||||
for (i = 0; i < tupleDescriptor->natts; i++)
|
||||
{
|
||||
Form_pg_attribute att;
|
||||
Form_pg_attribute att;
|
||||
|
||||
att = TupleDescAttr(tupleDescriptor, i);
|
||||
|
||||
|
@ -156,7 +156,7 @@ cube_a_f8_f8(PG_FUNCTION_ARGS)
|
||||
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||
errmsg("can't extend cube"),
|
||||
errdetail("A cube cannot have more than %d dimensions.",
|
||||
CUBE_MAX_DIM)));
|
||||
CUBE_MAX_DIM)));
|
||||
|
||||
if (ARRNELEMS(ll) != dim)
|
||||
ereport(ERROR,
|
||||
@ -220,7 +220,7 @@ cube_a_f8(PG_FUNCTION_ARGS)
|
||||
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||
errmsg("array is too long"),
|
||||
errdetail("A cube cannot have more than %d dimensions.",
|
||||
CUBE_MAX_DIM)));
|
||||
CUBE_MAX_DIM)));
|
||||
|
||||
dur = ARRPTR(ur);
|
||||
|
||||
@ -260,7 +260,7 @@ cube_subset(PG_FUNCTION_ARGS)
|
||||
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||
errmsg("array is too long"),
|
||||
errdetail("A cube cannot have more than %d dimensions.",
|
||||
CUBE_MAX_DIM)));
|
||||
CUBE_MAX_DIM)));
|
||||
|
||||
size = IS_POINT(c) ? POINT_SIZE(dim) : CUBE_SIZE(dim);
|
||||
result = (NDBOX *) palloc0(size);
|
||||
@ -1780,7 +1780,7 @@ cube_c_f8(PG_FUNCTION_ARGS)
|
||||
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||
errmsg("can't extend cube"),
|
||||
errdetail("A cube cannot have more than %d dimensions.",
|
||||
CUBE_MAX_DIM)));
|
||||
CUBE_MAX_DIM)));
|
||||
|
||||
if (IS_POINT(cube))
|
||||
{
|
||||
@ -1828,7 +1828,7 @@ cube_c_f8_f8(PG_FUNCTION_ARGS)
|
||||
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||
errmsg("can't extend cube"),
|
||||
errdetail("A cube cannot have more than %d dimensions.",
|
||||
CUBE_MAX_DIM)));
|
||||
CUBE_MAX_DIM)));
|
||||
|
||||
if (IS_POINT(cube) && (x1 == x2))
|
||||
{
|
||||
|
@ -922,8 +922,11 @@ check_selective_binary_conversion(RelOptInfo *baserel,
|
||||
/* Skip dropped attributes (probably shouldn't see any here). */
|
||||
if (attr->attisdropped)
|
||||
continue;
|
||||
/* Skip generated columns (COPY won't accept them in the column
|
||||
* list) */
|
||||
|
||||
/*
|
||||
* Skip generated columns (COPY won't accept them in the column
|
||||
* list)
|
||||
*/
|
||||
if (attr->attgenerated)
|
||||
continue;
|
||||
*columns = lappend(*columns, makeString(pstrdup(attname)));
|
||||
|
@ -212,41 +212,44 @@ g_int_compress(PG_FUNCTION_ARGS)
|
||||
*/
|
||||
for (j = i = len - 1; i > 0 && lenr > 0; i--, j--)
|
||||
{
|
||||
int r_end = dr[i];
|
||||
int r_start = r_end;
|
||||
while (i > 0 && lenr > 0 && dr[i-1] == r_start - 1)
|
||||
int r_end = dr[i];
|
||||
int r_start = r_end;
|
||||
|
||||
while (i > 0 && lenr > 0 && dr[i - 1] == r_start - 1)
|
||||
--r_start, --i, --lenr;
|
||||
dr[2*j] = r_start;
|
||||
dr[2*j+1] = r_end;
|
||||
dr[2 * j] = r_start;
|
||||
dr[2 * j + 1] = r_end;
|
||||
}
|
||||
/* just copy the rest, if any, as trivial ranges */
|
||||
for (; i >= 0; i--, j--)
|
||||
dr[2*j] = dr[2*j + 1] = dr[i];
|
||||
dr[2 * j] = dr[2 * j + 1] = dr[i];
|
||||
|
||||
if (++j)
|
||||
{
|
||||
/*
|
||||
* shunt everything down to start at the right place
|
||||
*/
|
||||
memmove((void *) &dr[0], (void *) &dr[2*j], 2*(len - j) * sizeof(int32));
|
||||
memmove((void *) &dr[0], (void *) &dr[2 * j], 2 * (len - j) * sizeof(int32));
|
||||
}
|
||||
|
||||
/*
|
||||
* make "len" be number of array elements, not ranges
|
||||
*/
|
||||
len = 2*(len - j);
|
||||
len = 2 * (len - j);
|
||||
cand = 1;
|
||||
while (len > MAXNUMRANGE * 2)
|
||||
{
|
||||
min = PG_INT64_MAX;
|
||||
for (i = 2; i < len; i += 2)
|
||||
if (min > ((int64)dr[i] - (int64)dr[i - 1]))
|
||||
if (min > ((int64) dr[i] - (int64) dr[i - 1]))
|
||||
{
|
||||
min = ((int64)dr[i] - (int64)dr[i - 1]);
|
||||
min = ((int64) dr[i] - (int64) dr[i - 1]);
|
||||
cand = i;
|
||||
}
|
||||
memmove((void *) &dr[cand - 1], (void *) &dr[cand + 1], (len - cand - 1) * sizeof(int32));
|
||||
len -= 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* check sparseness of result
|
||||
*/
|
||||
|
@ -298,10 +298,10 @@ internal_size(int *a, int len)
|
||||
for (i = 0; i < len; i += 2)
|
||||
{
|
||||
if (!i || a[i] != a[i - 1]) /* do not count repeated range */
|
||||
size += (int64)(a[i + 1]) - (int64)(a[i]) + 1;
|
||||
size += (int64) (a[i + 1]) - (int64) (a[i]) + 1;
|
||||
}
|
||||
|
||||
if (size > (int64)INT_MAX || size < (int64)INT_MIN)
|
||||
if (size > (int64) INT_MAX || size < (int64) INT_MIN)
|
||||
return -1; /* overflow */
|
||||
return (int) size;
|
||||
}
|
||||
|
@ -1153,8 +1153,9 @@ pgss_store(const char *query, uint64 queryId,
|
||||
queryId = pgss_hash_string(query, query_len);
|
||||
|
||||
/*
|
||||
* If we are unlucky enough to get a hash of zero(invalid), use queryID
|
||||
* as 2 instead, queryID 1 is already in use for normal statements.
|
||||
* If we are unlucky enough to get a hash of zero(invalid), use
|
||||
* queryID as 2 instead, queryID 1 is already in use for normal
|
||||
* statements.
|
||||
*/
|
||||
if (queryId == UINT64CONST(0))
|
||||
queryId = UINT64CONST(2);
|
||||
|
@ -1138,7 +1138,7 @@ mp_int_mod(mp_int a, mp_int m, mp_int c)
|
||||
}
|
||||
|
||||
mp_result
|
||||
mp_int_div_value(mp_int a, mp_small value, mp_int q, mp_small * r)
|
||||
mp_int_div_value(mp_int a, mp_small value, mp_int q, mp_small *r)
|
||||
{
|
||||
mpz_t vtmp;
|
||||
mp_digit vbuf[MP_VALUE_DIGITS(value)];
|
||||
@ -1819,7 +1819,7 @@ mp_int_root(mp_int a, mp_small b, mp_int c)
|
||||
}
|
||||
|
||||
mp_result
|
||||
mp_int_to_int(mp_int z, mp_small * out)
|
||||
mp_int_to_int(mp_int z, mp_small *out)
|
||||
{
|
||||
assert(z != NULL);
|
||||
|
||||
@ -1850,7 +1850,7 @@ mp_int_to_int(mp_int z, mp_small * out)
|
||||
}
|
||||
|
||||
mp_result
|
||||
mp_int_to_uint(mp_int z, mp_usmall * out)
|
||||
mp_int_to_uint(mp_int z, mp_usmall *out)
|
||||
{
|
||||
assert(z != NULL);
|
||||
|
||||
|
@ -218,7 +218,7 @@ mp_result mp_int_div(mp_int a, mp_int b, mp_int q, mp_int r);
|
||||
/** Sets `q` and `*r` to the quotent and remainder of `a / value`. Division by
|
||||
powers of 2 is detected and handled efficiently. The remainder is pinned to
|
||||
`0 <= *r < b`. Either of `q` or `r` may be NULL. */
|
||||
mp_result mp_int_div_value(mp_int a, mp_small value, mp_int q, mp_small * r);
|
||||
mp_result mp_int_div_value(mp_int a, mp_small value, mp_int q, mp_small *r);
|
||||
|
||||
/** Sets `q` and `r` to the quotient and remainder of `a / 2^p2`. This is a
|
||||
special case for division by powers of two that is more efficient than
|
||||
@ -246,7 +246,7 @@ mp_result mp_int_expt_full(mp_int a, mp_int b, mp_int c);
|
||||
The remainder is pinned to `0 <= r < value`. */
|
||||
static inline
|
||||
mp_result
|
||||
mp_int_mod_value(mp_int a, mp_small value, mp_small * r)
|
||||
mp_int_mod_value(mp_int a, mp_small value, mp_small *r)
|
||||
{
|
||||
return mp_int_div_value(a, value, 0, r);
|
||||
}
|
||||
@ -339,11 +339,11 @@ mp_int_sqrt(mp_int a, mp_int c)
|
||||
|
||||
/** Returns `MP_OK` if `z` is representable as `mp_small`, else `MP_RANGE`.
|
||||
If `out` is not NULL, `*out` is set to the value of `z` when `MP_OK`. */
|
||||
mp_result mp_int_to_int(mp_int z, mp_small * out);
|
||||
mp_result mp_int_to_int(mp_int z, mp_small *out);
|
||||
|
||||
/** Returns `MP_OK` if `z` is representable as `mp_usmall`, or `MP_RANGE`.
|
||||
If `out` is not NULL, `*out` is set to the value of `z` when `MP_OK`. */
|
||||
mp_result mp_int_to_uint(mp_int z, mp_usmall * out);
|
||||
mp_result mp_int_to_uint(mp_int z, mp_usmall *out);
|
||||
|
||||
/** Converts `z` to a zero-terminated string of characters in the specified
|
||||
`radix`, writing at most `limit` characters to `str` including the
|
||||
|
@ -339,7 +339,7 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo)
|
||||
|
||||
InitDirtySnapshot(SnapshotDirty);
|
||||
|
||||
nblocks = hscan->rs_nblocks; /* # blocks to be scanned */
|
||||
nblocks = hscan->rs_nblocks; /* # blocks to be scanned */
|
||||
|
||||
/* scan the relation */
|
||||
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
|
||||
|
@ -1858,7 +1858,7 @@ postgresExecForeignInsert(EState *estate,
|
||||
if (fmstate->aux_fmstate)
|
||||
resultRelInfo->ri_FdwState = fmstate->aux_fmstate;
|
||||
rslot = execute_foreign_modify(estate, resultRelInfo, CMD_INSERT,
|
||||
slot, planSlot);
|
||||
slot, planSlot);
|
||||
/* Revert that change */
|
||||
if (fmstate->aux_fmstate)
|
||||
resultRelInfo->ri_FdwState = fmstate;
|
||||
@ -1934,11 +1934,11 @@ postgresBeginForeignInsert(ModifyTableState *mtstate,
|
||||
bool doNothing = false;
|
||||
|
||||
/*
|
||||
* If the foreign table we are about to insert routed rows into is also
|
||||
* an UPDATE subplan result rel that will be updated later, proceeding
|
||||
* with the INSERT will result in the later UPDATE incorrectly modifying
|
||||
* those routed rows, so prevent the INSERT --- it would be nice if we
|
||||
* could handle this case; but for now, throw an error for safety.
|
||||
* If the foreign table we are about to insert routed rows into is also an
|
||||
* UPDATE subplan result rel that will be updated later, proceeding with
|
||||
* the INSERT will result in the later UPDATE incorrectly modifying those
|
||||
* routed rows, so prevent the INSERT --- it would be nice if we could
|
||||
* handle this case; but for now, throw an error for safety.
|
||||
*/
|
||||
if (plan && plan->operation == CMD_UPDATE &&
|
||||
(resultRelInfo->ri_usesFdwDirectModify ||
|
||||
@ -3169,7 +3169,7 @@ adjust_foreign_grouping_path_cost(PlannerInfo *root,
|
||||
if (!grouping_is_sortable(root->parse->groupClause) ||
|
||||
!pathkeys_contained_in(pathkeys, root->group_pathkeys))
|
||||
{
|
||||
Path sort_path; /* dummy for result of cost_sort */
|
||||
Path sort_path; /* dummy for result of cost_sort */
|
||||
|
||||
cost_sort(&sort_path,
|
||||
root,
|
||||
@ -3191,7 +3191,7 @@ adjust_foreign_grouping_path_cost(PlannerInfo *root,
|
||||
* add 1/4th of that default.
|
||||
*/
|
||||
double sort_multiplier = 1.0 + (DEFAULT_FDW_SORT_MULTIPLIER
|
||||
- 1.0) * 0.25;
|
||||
- 1.0) * 0.25;
|
||||
|
||||
*p_startup_cost *= sort_multiplier;
|
||||
*p_run_cost *= sort_multiplier;
|
||||
@ -3773,6 +3773,7 @@ store_returning_result(PgFdwModifyState *fmstate,
|
||||
fmstate->retrieved_attrs,
|
||||
NULL,
|
||||
fmstate->temp_cxt);
|
||||
|
||||
/*
|
||||
* The returning slot will not necessarily be suitable to store
|
||||
* heaptuples directly, so allow for conversion.
|
||||
@ -6059,8 +6060,8 @@ add_foreign_final_paths(PlannerInfo *root, RelOptInfo *input_rel,
|
||||
/*
|
||||
* Grouping and aggregation are not supported with FOR UPDATE/SHARE,
|
||||
* so the input_rel should be a base, join, or ordered relation; and
|
||||
* if it's an ordered relation, its input relation should be a base
|
||||
* or join relation.
|
||||
* if it's an ordered relation, its input relation should be a base or
|
||||
* join relation.
|
||||
*/
|
||||
Assert(input_rel->reloptkind == RELOPT_BASEREL ||
|
||||
input_rel->reloptkind == RELOPT_JOINREL ||
|
||||
|
Reference in New Issue
Block a user