Hi!
Additional changes (in attached patch):
a. Added using pull_varattnos to check whether a CHECK constraint
contains a reference to the tableoid column (only such CHECKs are
recalculated).
b. Added test for recomputation of stored generated columns.
1.
>We can perform a preliminary check to determine whether dropping a
>partition is allowed, and raise an error if it's not. To do it, I
>invented a new function, performDeletionCheck to verify whether an
>object can be safely dropped.
Applied. I moved calls performDeletionCheck a bit earlier, right after
detachPartitionTable. Is it ok?
2.
>check_partitions_for_split does not exist in v43-0001.
Fixed.
>+ RenameRelationInternal(RelationGetRelid(sameNamePartition),
>+ tmpRelName, false, false);
>the third argument, is_internal should set to true?
Ok.
>a partitioned table can not have NO INHERIT check constraint,
>you may see StoreRelCheck.
>we can add an Assert: Assert(!ccnoinherit);
Ok.
>+ nnconstraints =
>+ RelationGetNotNullConstraints(RelationGetRelid(modelRel),
>+ false, true);
>as mentioned in above, partitioned table cannot have NO INHERIT
>constraint, maybe we should set RelationGetNotNullConstraints last
>argument to false
Ok.
>The attached patch is a rewrite for
>calculate_partition_bound_for_merge and callees.
>please let me know whether this improves code readability
I think these changes can be taken partially.
MERGE PARTITIONS and SPLIT PARTITION commands use the same function
check_two_partitions_bounds_range. For MERGE PARTITIONS we can pass
Oids instead of RangeVars (first_name/second_name arguments).
But for SPLIT PARTITION we cannot do this, because at this stage the
new partitions have not yet been created (there are only their names).
Different realizations of check_two_partitions_bounds_range functions
for MERGE PARTITIONS and SPLIT PARTITION are not very good. I think it's
better not change the check_two_partitions_bounds_range function.
3.
>v43-0001 doesn't have the SPLIT PARTITION feature.
>maybe we need to remove the argument (bool defaultPart)
>from check_two_partitions_bounds_range, aslo remove the comments.
>then we can add it on 0002 SPLIT PARTITION patch.
Changed.
4. I don't know English very well, so it's difficult for me to correct
the documentation. Thank you very much for the corrections!
>would be better mentioning that the parent table and to be merged
>partition will all take <literal>ACCESS EXCLUSIVE</literal> lock.
Ok, updated.
Other email notes fixed in patch
>v44-0001-documentation-refactoring-based-on-v44.no-cfbot
Patch applied.
--
With best regards,
Dmitry Koval
Postgres Professional: http://postgrespro.com