mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +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:
@ -1780,12 +1780,12 @@ heap_drop_with_catalog(Oid relid)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If the relation is a partition, we must grab exclusive lock on its
|
* If the relation is a partition, we must grab exclusive lock on its
|
||||||
* parent because we need to update its partition descriptor. We must
|
* parent because we need to update its partition descriptor. We must take
|
||||||
* take a table lock strong enough to prevent all queries on the parent
|
* a table lock strong enough to prevent all queries on the parent from
|
||||||
* from proceeding until we commit and send out a shared-cache-inval
|
* proceeding until we commit and send out a shared-cache-inval notice
|
||||||
* notice that will make them update their partition descriptor.
|
* that will make them update their partition descriptor. Sometimes, doing
|
||||||
* Sometimes, doing this is cycles spent uselessly, especially if the
|
* this is cycles spent uselessly, especially if the parent will be
|
||||||
* parent will be dropped as part of the same command anyway.
|
* dropped as part of the same command anyway.
|
||||||
*/
|
*/
|
||||||
if (rel->rd_rel->relispartition)
|
if (rel->rd_rel->relispartition)
|
||||||
{
|
{
|
||||||
@ -3185,8 +3185,8 @@ StorePartitionKey(Relation rel,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Anything mentioned in the expressions. We must ignore the column
|
* Anything mentioned in the expressions. We must ignore the column
|
||||||
* references, which will depend on the table itself; there is no
|
* references, which will depend on the table itself; there is no separate
|
||||||
* separate partition key object.
|
* partition key object.
|
||||||
*/
|
*/
|
||||||
if (partexprs)
|
if (partexprs)
|
||||||
recordDependencyOnSingleRelExpr(&myself,
|
recordDependencyOnSingleRelExpr(&myself,
|
||||||
|
@ -1082,11 +1082,11 @@ RelationGetPartitionDispatchInfo(Relation rel, int lockmode,
|
|||||||
if (parent != NULL)
|
if (parent != NULL)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* For every partitioned table other than root, we must store
|
* For every partitioned table other than root, we must store a
|
||||||
* a tuple table slot initialized with its tuple descriptor and
|
* tuple table slot initialized with its tuple descriptor and a
|
||||||
* a tuple conversion map to convert a tuple from its parent's
|
* tuple conversion map to convert a tuple from its parent's
|
||||||
* rowtype to its own. That is to make sure that we are looking
|
* rowtype to its own. That is to make sure that we are looking at
|
||||||
* at the correct row using the correct tuple descriptor when
|
* the correct row using the correct tuple descriptor when
|
||||||
* computing its partition key for tuple routing.
|
* computing its partition key for tuple routing.
|
||||||
*/
|
*/
|
||||||
pd[i]->tupslot = MakeSingleTupleTableSlot(tupdesc);
|
pd[i]->tupslot = MakeSingleTupleTableSlot(tupdesc);
|
||||||
@ -1574,10 +1574,10 @@ generate_partition_qual(Relation rel)
|
|||||||
result = my_qual;
|
result = my_qual;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Change Vars to have partition's attnos instead of the parent's.
|
* Change Vars to have partition's attnos instead of the parent's. We do
|
||||||
* We do this after we concatenate the parent's quals, because
|
* this after we concatenate the parent's quals, because we want every Var
|
||||||
* we want every Var in it to bear this relation's attnos.
|
* in it to bear this relation's attnos. It's safe to assume varno = 1
|
||||||
* It's safe to assume varno = 1 here.
|
* here.
|
||||||
*/
|
*/
|
||||||
result = map_partition_varattnos(result, 1, rel, parent);
|
result = map_partition_varattnos(result, 1, rel, parent);
|
||||||
|
|
||||||
|
@ -164,8 +164,7 @@ typedef struct CopyStateData
|
|||||||
|
|
||||||
PartitionDispatch *partition_dispatch_info;
|
PartitionDispatch *partition_dispatch_info;
|
||||||
int num_dispatch; /* Number of entries in the above array */
|
int num_dispatch; /* Number of entries in the above array */
|
||||||
int num_partitions; /* Number of members in the following
|
int num_partitions; /* Number of members in the following arrays */
|
||||||
* arrays */
|
|
||||||
ResultRelInfo *partitions; /* Per partition result relation */
|
ResultRelInfo *partitions; /* Per partition result relation */
|
||||||
TupleConversionMap **partition_tupconv_maps;
|
TupleConversionMap **partition_tupconv_maps;
|
||||||
TupleTableSlot *partition_tuple_slot;
|
TupleTableSlot *partition_tuple_slot;
|
||||||
|
@ -285,10 +285,10 @@ ExecInsert(ModifyTableState *mtstate,
|
|||||||
/*
|
/*
|
||||||
* Away we go ... If we end up not finding a partition after all,
|
* Away we go ... If we end up not finding a partition after all,
|
||||||
* ExecFindPartition() does not return and errors out instead.
|
* ExecFindPartition() does not return and errors out instead.
|
||||||
* Otherwise, the returned value is to be used as an index into
|
* Otherwise, the returned value is to be used as an index into arrays
|
||||||
* arrays mt_partitions[] and mt_partition_tupconv_maps[] that
|
* mt_partitions[] and mt_partition_tupconv_maps[] that will get us
|
||||||
* will get us the ResultRelInfo and TupleConversionMap for the
|
* the ResultRelInfo and TupleConversionMap for the partition,
|
||||||
* partition, respectively.
|
* respectively.
|
||||||
*/
|
*/
|
||||||
leaf_part_index = ExecFindPartition(resultRelInfo,
|
leaf_part_index = ExecFindPartition(resultRelInfo,
|
||||||
mtstate->mt_partition_dispatch_info,
|
mtstate->mt_partition_dispatch_info,
|
||||||
@ -325,9 +325,9 @@ ExecInsert(ModifyTableState *mtstate,
|
|||||||
tuple = do_convert_tuple(tuple, map);
|
tuple = do_convert_tuple(tuple, map);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must use the partition's tuple descriptor from this
|
* We must use the partition's tuple descriptor from this point
|
||||||
* point on, until we're finished dealing with the partition.
|
* on, until we're finished dealing with the partition. Use the
|
||||||
* Use the dedicated slot for that.
|
* dedicated slot for that.
|
||||||
*/
|
*/
|
||||||
slot = mtstate->mt_partition_tuple_slot;
|
slot = mtstate->mt_partition_tuple_slot;
|
||||||
Assert(slot != NULL);
|
Assert(slot != NULL);
|
||||||
@ -1821,9 +1821,9 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
|
|||||||
/*
|
/*
|
||||||
* Build a projection for each leaf partition rel. Note that we
|
* Build a projection for each leaf partition rel. Note that we
|
||||||
* didn't build the returningList for each partition within the
|
* didn't build the returningList for each partition within the
|
||||||
* planner, but simple translation of the varattnos for each
|
* planner, but simple translation of the varattnos for each partition
|
||||||
* partition will suffice. This only occurs for the INSERT case;
|
* will suffice. This only occurs for the INSERT case; UPDATE/DELETE
|
||||||
* UPDATE/DELETE are handled above.
|
* are handled above.
|
||||||
*/
|
*/
|
||||||
resultRelInfo = mtstate->mt_partitions;
|
resultRelInfo = mtstate->mt_partitions;
|
||||||
returningList = linitial(node->returningLists);
|
returningList = linitial(node->returningLists);
|
||||||
@ -2095,7 +2095,8 @@ ExecEndModifyTable(ModifyTableState *node)
|
|||||||
resultRelInfo);
|
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
|
* Remember node->mt_partition_dispatch_info[0] corresponds to the root
|
||||||
* partitioned table, which we must not try to close, because it is the
|
* partitioned table, which we must not try to close, because it is the
|
||||||
|
@ -1476,8 +1476,8 @@ pg_get_partkeydef_worker(Oid relid, int prettyFlags)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the expressions, if any. (NOTE: we do not use the relcache
|
* Get the expressions, if any. (NOTE: we do not use the relcache
|
||||||
* versions of the expressions, because we want to display non-const-folded
|
* versions of the expressions, because we want to display
|
||||||
* expressions.)
|
* non-const-folded expressions.)
|
||||||
*/
|
*/
|
||||||
if (!heap_attisnull(tuple, Anum_pg_partitioned_table_partexprs))
|
if (!heap_attisnull(tuple, Anum_pg_partitioned_table_partexprs))
|
||||||
{
|
{
|
||||||
|
@ -749,8 +749,8 @@ typedef struct PartitionBoundSpec
|
|||||||
List *listdatums;
|
List *listdatums;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Range partition lower and upper bounds; each member of the lists
|
* Range partition lower and upper bounds; each member of the lists is a
|
||||||
* is a PartitionRangeDatum (see below).
|
* PartitionRangeDatum (see below).
|
||||||
*/
|
*/
|
||||||
List *lowerdatums;
|
List *lowerdatums;
|
||||||
List *upperdatums;
|
List *upperdatums;
|
||||||
|
Reference in New Issue
Block a user