1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Reindent table partitioning code.

We've accumulated quite a bit of stuff with which pgindent is not
quite happy in this code; clean it up to provide a less-annoying base
for future pgindent runs.
This commit is contained in:
Robert Haas
2017-01-24 10:20:02 -05:00
parent 96e0ccc2b5
commit 27cdb3414b
15 changed files with 130 additions and 130 deletions

View File

@ -1222,7 +1222,7 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo,
Relation partition_root,
int instrument_options)
{
List *partition_check = NIL;
List *partition_check = NIL;
MemSet(resultRelInfo, 0, sizeof(ResultRelInfo));
resultRelInfo->type = T_ResultRelInfo;
@ -1754,10 +1754,10 @@ ExecPartitionCheck(ResultRelInfo *resultRelInfo, TupleTableSlot *slot,
*/
if (resultRelInfo->ri_PartitionCheckExpr == NULL)
{
List *qual = resultRelInfo->ri_PartitionCheck;
List *qual = resultRelInfo->ri_PartitionCheck;
resultRelInfo->ri_PartitionCheckExpr = (List *)
ExecPrepareExpr((Expr *) qual, estate);
ExecPrepareExpr((Expr *) qual, estate);
}
/*
@ -1837,7 +1837,7 @@ ExecConstraints(ResultRelInfo *resultRelInfo,
ereport(ERROR,
(errcode(ERRCODE_NOT_NULL_VIOLATION),
errmsg("null value in column \"%s\" violates not-null constraint",
NameStr(orig_tupdesc->attrs[attrChk - 1]->attname)),
NameStr(orig_tupdesc->attrs[attrChk - 1]->attname)),
val_desc ? errdetail("Failing row contains %s.", val_desc) : 0,
errtablecol(orig_rel, attrChk)));
}
@ -1900,9 +1900,9 @@ ExecConstraints(ResultRelInfo *resultRelInfo,
64);
ereport(ERROR,
(errcode(ERRCODE_CHECK_VIOLATION),
errmsg("new row for relation \"%s\" violates partition constraint",
RelationGetRelationName(orig_rel)),
val_desc ? errdetail("Failing row contains %s.", val_desc) : 0));
errmsg("new row for relation \"%s\" violates partition constraint",
RelationGetRelationName(orig_rel)),
val_desc ? errdetail("Failing row contains %s.", val_desc) : 0));
}
}
@ -3118,7 +3118,7 @@ ExecSetupPartitionTupleRouting(Relation rel,
*partitions = (ResultRelInfo *) palloc(*num_partitions *
sizeof(ResultRelInfo));
*tup_conv_maps = (TupleConversionMap **) palloc0(*num_partitions *
sizeof(TupleConversionMap *));
sizeof(TupleConversionMap *));
/*
* Initialize an empty slot that will be used to manipulate tuples of any
@ -3157,7 +3157,7 @@ ExecSetupPartitionTupleRouting(Relation rel,
InitResultRelInfo(leaf_part_rri,
partrel,
1, /* dummy */
1, /* dummy */
rel,
0);
@ -3190,8 +3190,8 @@ int
ExecFindPartition(ResultRelInfo *resultRelInfo, PartitionDispatch *pd,
TupleTableSlot *slot, EState *estate)
{
int result;
Oid failed_at;
int result;
Oid failed_at;
ExprContext *econtext = GetPerTupleExprContext(estate);
econtext->ecxt_scantuple = slot;
@ -3218,7 +3218,7 @@ ExecFindPartition(ResultRelInfo *resultRelInfo, PartitionDispatch *pd,
(errcode(ERRCODE_CHECK_VIOLATION),
errmsg("no partition of relation \"%s\" found for row",
get_rel_name(failed_at)),
val_desc ? errdetail("Failing row contains %s.", val_desc) : 0));
val_desc ? errdetail("Failing row contains %s.", val_desc) : 0));
}
return result;

View File

@ -263,7 +263,7 @@ ExecInsert(ModifyTableState *mtstate,
Oid newId;
List *recheckIndexes = NIL;
TupleTableSlot *oldslot = slot,
*result = NULL;
*result = NULL;
/*
* get the heap tuple out of the tuple table slot, making sure we have a
@ -279,19 +279,19 @@ ExecInsert(ModifyTableState *mtstate,
/* Determine the partition to heap_insert the tuple into */
if (mtstate->mt_partition_dispatch_info)
{
int leaf_part_index;
int leaf_part_index;
TupleConversionMap *map;
/*
* Away we go ... If we end up not finding a partition after all,
* ExecFindPartition() does not return and errors out instead.
* Otherwise, the returned value is to be used as an index into
* arrays mt_partitions[] and mt_partition_tupconv_maps[] that
* will get us the ResultRelInfo and TupleConversionMap for the
* partition, respectively.
* Otherwise, the returned value is to be used as an index into arrays
* mt_partitions[] and mt_partition_tupconv_maps[] that will get us
* the ResultRelInfo and TupleConversionMap for the partition,
* respectively.
*/
leaf_part_index = ExecFindPartition(resultRelInfo,
mtstate->mt_partition_dispatch_info,
mtstate->mt_partition_dispatch_info,
slot,
estate);
Assert(leaf_part_index >= 0 &&
@ -308,7 +308,7 @@ ExecInsert(ModifyTableState *mtstate,
if (resultRelInfo->ri_FdwRoutine)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot route inserted tuples to a foreign table")));
errmsg("cannot route inserted tuples to a foreign table")));
/* For ExecInsertIndexTuples() to work on the partition's indexes */
estate->es_result_relation_info = resultRelInfo;
@ -320,14 +320,14 @@ ExecInsert(ModifyTableState *mtstate,
map = mtstate->mt_partition_tupconv_maps[leaf_part_index];
if (map)
{
Relation partrel = resultRelInfo->ri_RelationDesc;
Relation partrel = resultRelInfo->ri_RelationDesc;
tuple = do_convert_tuple(tuple, map);
/*
* We must use the partition's tuple descriptor from this
* point on, until we're finished dealing with the partition.
* Use the dedicated slot for that.
* We must use the partition's tuple descriptor from this point
* on, until we're finished dealing with the partition. Use the
* dedicated slot for that.
*/
slot = mtstate->mt_partition_tuple_slot;
Assert(slot != NULL);
@ -1730,12 +1730,12 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
if (operation == CMD_INSERT &&
rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
{
PartitionDispatch *partition_dispatch_info;
ResultRelInfo *partitions;
PartitionDispatch *partition_dispatch_info;
ResultRelInfo *partitions;
TupleConversionMap **partition_tupconv_maps;
TupleTableSlot *partition_tuple_slot;
int num_parted,
num_partitions;
TupleTableSlot *partition_tuple_slot;
int num_parted,
num_partitions;
ExecSetupPartitionTupleRouting(rel,
&partition_dispatch_info,
@ -1784,7 +1784,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
{
TupleTableSlot *slot;
ExprContext *econtext;
List *returningList;
List *returningList;
/*
* Initialize result tuple slot and assign its rowtype using the first
@ -1821,9 +1821,9 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
/*
* Build a projection for each leaf partition rel. Note that we
* didn't build the returningList for each partition within the
* planner, but simple translation of the varattnos for each
* partition will suffice. This only occurs for the INSERT case;
* UPDATE/DELETE are handled above.
* planner, but simple translation of the varattnos for each partition
* will suffice. This only occurs for the INSERT case; UPDATE/DELETE
* are handled above.
*/
resultRelInfo = mtstate->mt_partitions;
returningList = linitial(node->returningLists);
@ -2095,7 +2095,8 @@ ExecEndModifyTable(ModifyTableState *node)
resultRelInfo);
}
/* Close all the partitioned tables, leaf partitions, and their indices
/*
* Close all the partitioned tables, leaf partitions, and their indices
*
* Remember node->mt_partition_dispatch_info[0] corresponds to the root
* partitioned table, which we must not try to close, because it is the