aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/tablesample/bernoulli.c15
-rw-r--r--src/backend/access/tablesample/tablesample.c9
-rw-r--r--src/backend/executor/execUtils.c4
-rw-r--r--src/backend/executor/nodeAgg.c8
-rw-r--r--src/backend/executor/nodeHash.c8
-rw-r--r--src/backend/optimizer/plan/planner.c25
-rw-r--r--src/backend/rewrite/rowsecurity.c4
-rw-r--r--src/backend/utils/adt/jsonb.c2
-rw-r--r--src/backend/utils/adt/ruleutils.c4
9 files changed, 42 insertions, 37 deletions
diff --git a/src/backend/access/tablesample/bernoulli.c b/src/backend/access/tablesample/bernoulli.c
index 563a9168f0f..0a539008221 100644
--- a/src/backend/access/tablesample/bernoulli.c
+++ b/src/backend/access/tablesample/bernoulli.c
@@ -80,8 +80,7 @@ Datum
tsm_bernoulli_nextblock(PG_FUNCTION_ARGS)
{
TableSampleDesc *tsdesc = (TableSampleDesc *) PG_GETARG_POINTER(0);
- BernoulliSamplerData *sampler =
- (BernoulliSamplerData *) tsdesc->tsmdata;
+ BernoulliSamplerData *sampler = (BernoulliSamplerData *) tsdesc->tsmdata;
/*
* Bernoulli sampling scans all blocks on the table and supports syncscan
@@ -117,10 +116,10 @@ tsm_bernoulli_nextblock(PG_FUNCTION_ARGS)
* tuples have same probability of being returned the visible and invisible
* tuples will be returned in same ratio as they have in the actual table.
* This means that there is no skew towards either visible or invisible tuples
- * and the number returned visible tuples to from the executor node is the
- * fraction of visible tuples which was specified in input.
+ * and the number of visible tuples returned from the executor node should
+ * match the fraction of visible tuples which was specified by user.
*
- * This is faster than doing the coinflip in the examinetuple because we don't
+ * This is faster than doing the coinflip in examinetuple because we don't
* have to do visibility checks on uninteresting tuples.
*
* If we reach end of the block return InvalidOffsetNumber which tells
@@ -131,8 +130,7 @@ tsm_bernoulli_nexttuple(PG_FUNCTION_ARGS)
{
TableSampleDesc *tsdesc = (TableSampleDesc *) PG_GETARG_POINTER(0);
OffsetNumber maxoffset = PG_GETARG_UINT16(2);
- BernoulliSamplerData *sampler =
- (BernoulliSamplerData *) tsdesc->tsmdata;
+ BernoulliSamplerData *sampler = (BernoulliSamplerData *) tsdesc->tsmdata;
OffsetNumber tupoffset = sampler->lt;
float4 probability = sampler->probability;
@@ -185,8 +183,7 @@ Datum
tsm_bernoulli_reset(PG_FUNCTION_ARGS)
{
TableSampleDesc *tsdesc = (TableSampleDesc *) PG_GETARG_POINTER(0);
- BernoulliSamplerData *sampler =
- (BernoulliSamplerData *) tsdesc->tsmdata;
+ BernoulliSamplerData *sampler = (BernoulliSamplerData *) tsdesc->tsmdata;
sampler->blockno = InvalidBlockNumber;
sampler->lt = InvalidOffsetNumber;
diff --git a/src/backend/access/tablesample/tablesample.c b/src/backend/access/tablesample/tablesample.c
index 3398d02f854..44a24340f6b 100644
--- a/src/backend/access/tablesample/tablesample.c
+++ b/src/backend/access/tablesample/tablesample.c
@@ -78,9 +78,12 @@ tablesample_init(SampleScanState *scanstate, TableSampleClause *tablesample)
fcinfo.argnull[0] = false;
/*
- * Second arg for init function is always REPEATABLE When
- * tablesample->repeatable is NULL then REPEATABLE clause was not
- * specified. When specified, the expression cannot evaluate to NULL.
+ * Second arg for init function is always REPEATABLE.
+ *
+ * If tablesample->repeatable is NULL then REPEATABLE clause was not
+ * specified, and we insert a random value as default.
+ *
+ * When specified, the expression cannot evaluate to NULL.
*/
if (tablesample->repeatable)
{
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 7e15b797a7e..3c611b938bc 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -645,10 +645,12 @@ get_last_attnums(Node *node, ProjectionInfo *projInfo)
* overall targetlist's econtext. GroupingFunc arguments are never
* evaluated at all.
*/
- if (IsA(node, Aggref) ||IsA(node, GroupingFunc))
+ if (IsA(node, Aggref))
return false;
if (IsA(node, WindowFunc))
return false;
+ if (IsA(node, GroupingFunc))
+ return false;
return expression_tree_walker(node, get_last_attnums,
(void *) projInfo);
}
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 31d74e94778..2bf48c54e3c 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -1519,8 +1519,9 @@ agg_retrieve_direct(AggState *aggstate)
/*
* get state info from node
*
- * econtext is the per-output-tuple expression context tmpcontext is the
- * per-input-tuple expression context
+ * econtext is the per-output-tuple expression context
+ *
+ * tmpcontext is the per-input-tuple expression context
*/
econtext = aggstate->ss.ps.ps_ExprContext;
tmpcontext = aggstate->tmpcontext;
@@ -1609,7 +1610,7 @@ agg_retrieve_direct(AggState *aggstate)
else
nextSetSize = 0;
- /*-
+ /*----------
* If a subgroup for the current grouping set is present, project it.
*
* We have a new group if:
@@ -1624,6 +1625,7 @@ agg_retrieve_direct(AggState *aggstate)
* AND
* - the previous and pending rows differ on the grouping columns
* of the next grouping set
+ *----------
*/
if (aggstate->input_done ||
(node->aggstrategy == AGG_SORTED &&
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 2a049240549..906cb46b658 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -527,8 +527,8 @@ ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew,
* Buckets are simple pointers to hashjoin tuples, while tupsize
* includes the pointer, hash code, and MinimalTupleData. So buckets
* should never really exceed 25% of work_mem (even for
- * NTUP_PER_BUCKET=1); except maybe * for work_mem values that are not
- * 2^N bytes, where we might get more * because of doubling. So let's
+ * NTUP_PER_BUCKET=1); except maybe for work_mem values that are not
+ * 2^N bytes, where we might get more because of doubling. So let's
* look for 50% here.
*/
Assert(bucket_bytes <= hash_table_bytes / 2);
@@ -691,9 +691,9 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable)
if (batchno == curbatch)
{
/* keep tuple in memory - copy it into the new chunk */
- HashJoinTuple copyTuple =
- (HashJoinTuple) dense_alloc(hashtable, hashTupleSize);
+ HashJoinTuple copyTuple;
+ copyTuple = (HashJoinTuple) dense_alloc(hashtable, hashTupleSize);
memcpy(copyTuple, hashTuple, hashTupleSize);
/* and add it back to the appropriate bucket */
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 920c2b77fff..8afde2b7d50 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -1918,10 +1918,10 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
* whether HAVING succeeds. Furthermore, there cannot be any
* variables in either HAVING or the targetlist, so we
* actually do not need the FROM table at all! We can just
- * throw away the plan-so-far and generate a Result node.
- * This is a sufficiently unusual corner case that it's not
- * worth contorting the structure of this routine to avoid
- * having to generate the plan in the first place.
+ * throw away the plan-so-far and generate a Result node. This
+ * is a sufficiently unusual corner case that it's not worth
+ * contorting the structure of this routine to avoid having to
+ * generate the plan in the first place.
*/
result_plan = (Plan *) make_result(root,
tlist,
@@ -3157,22 +3157,23 @@ extract_rollup_sets(List *groupingSets)
if (!lc1)
return list_make1(groupingSets);
- /*
+ /*----------
* We don't strictly need to remove duplicate sets here, but if we don't,
* they tend to become scattered through the result, which is a bit
- * confusing (and irritating if we ever decide to optimize them out). So
- * we remove them here and add them back after.
+ * confusing (and irritating if we ever decide to optimize them out).
+ * So we remove them here and add them back after.
*
* For each non-duplicate set, we fill in the following:
*
- * orig_sets[i] = list of the original set lists set_masks[i] = bitmapset
- * for testing inclusion adjacency[i] = array [n, v1, v2, ... vn] of
- * adjacency indices
+ * orig_sets[i] = list of the original set lists
+ * set_masks[i] = bitmapset for testing inclusion
+ * adjacency[i] = array [n, v1, v2, ... vn] of adjacency indices
*
* chains[i] will be the result group this set is assigned to.
*
- * We index all of these from 1 rather than 0 because it is convenient to
- * leave 0 free for the NIL node in the graph algorithm.
+ * We index all of these from 1 rather than 0 because it is convenient
+ * to leave 0 free for the NIL node in the graph algorithm.
+ *----------
*/
orig_sets = palloc0((num_sets_raw + 1) * sizeof(List *));
set_masks = palloc0((num_sets_raw + 1) * sizeof(Bitmapset *));
diff --git a/src/backend/rewrite/rowsecurity.c b/src/backend/rewrite/rowsecurity.c
index 5a2f696934a..aaf0061164b 100644
--- a/src/backend/rewrite/rowsecurity.c
+++ b/src/backend/rewrite/rowsecurity.c
@@ -596,8 +596,8 @@ process_policies(Query *root, List *policies, int rt_index, Expr **qual_eval,
*qual_eval = (Expr *) linitial(quals);
/*
- * Similairly, if more than one WITH CHECK qual is returned, then they
- * need to be combined together.
+ * Similarly, if more than one WITH CHECK qual is returned, then they need
+ * to be combined together.
*
* with_check_quals is allowed to be NIL here since this might not be the
* resultRelation (see above).
diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.c
index c0959a0ee2a..e68972221ab 100644
--- a/src/backend/utils/adt/jsonb.c
+++ b/src/backend/utils/adt/jsonb.c
@@ -584,7 +584,7 @@ add_indent(StringInfo out, bool indent, int level)
*
* Given the datatype OID, return its JsonbTypeCategory, as well as the type's
* output function OID. If the returned category is JSONBTYPE_JSONCAST,
- * we return the OID of the relevant cast function instead.
+ * we return the OID of the relevant cast function instead.
*/
static void
jsonb_categorize_type(Oid typoid,
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index c404ae5e4c8..55171131518 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -106,8 +106,8 @@ typedef struct
int wrapColumn; /* max line length, or -1 for no limit */
int indentLevel; /* current indent level for prettyprint */
bool varprefix; /* TRUE to print prefixes on Vars */
- ParseExprKind special_exprkind; /* set only for exprkinds needing */
- /* special handling */
+ ParseExprKind special_exprkind; /* set only for exprkinds needing
+ * special handling */
} deparse_context;
/*