commit 723fa7df82f39aed5d58e5e52ba80caa8cb13515 Author: Justin Pryzby Date: Mon Jul 18 09:24:55 2022 -0500 doc: mention CREATE+ATTACH PARTITION as an alternative to CREATE TABLE..PARTITION OF In v12, 898e5e329 (Allow ATTACH PARTITION with only ShareUpdateExclusiveLock) allows attaching a partition with a weaker lock than in CREATE..PARTITION OF, but it does that silently. On the one hand, things that are automatically better, without having to enable the option are the best kind of feature. OTOH, I doubt many people know to do that, because the docs don't say so, because it was implemented as an transparent improvement. This patch adds a bit of documentations to make that more visible. See also: 898e5e3290a72d288923260143930fb32036c00c Should backpatch to v12 diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 360284e37d6..66138b9299d 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -4092,7 +4092,9 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02 The ATTACH PARTITION command requires taking a - SHARE UPDATE EXCLUSIVE lock on the partitioned table. + SHARE UPDATE EXCLUSIVE lock on the partitioned table, + as opposed to the Access Exclusive lock which is + required by CREATE TABLE .. PARTITION OF. diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index c14b2010d81..54dbfa72e4c 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -619,6 +619,16 @@ WITH ( MODULUS numeric_literal, REM with DROP TABLE requires taking an ACCESS EXCLUSIVE lock on the parent table. + + + Note that creating a partition using PARTITION OF + requires taking an ACCESS EXCLUSIVE lock on the parent + table. It may be preferable to first create a separate table and then + attach it, which does not require as strong a lock. + See ATTACH PARTITION + for more information. + +