Re: Postgres Partitions Limitations (5.11.2.3)
Laurenz Albe <laurenz.albe@cybertec.at>
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: navbarry@gmail.com, pgsql-docs@lists.postgresql.org
Date: 2023-01-09T15:40:10Z
Lists: pgsql-hackers, pgsql-docs
Attachments
- 0001-Fix-omission-in-partitioning-limitation-documentatio.patch (text/x-patch) patch 0001
On Fri, 2023-01-06 at 08:28 +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/15/ddl-partitioning.html > Description: > > Link: > https://www.postgresql.org/docs/current/ddl-partitioning.html#DDL-PARTITIONING-DECLARATIVE > > "Using ONLY to add or drop a constraint on only the partitioned table is > supported as long as there are no partitions. Once partitions exist, using > ONLY will result in an error. Instead, constraints on the partitions > themselves can be added and (if they are not present in the parent table) > dropped." This seems in contradiction to the example involving adding a > unique constraint while minimizing locking at the bottom of "5.11.2.2. > Partition Maintenance", which seems to run fine on my local Pg instance: > > " > This technique can be used with UNIQUE and PRIMARY KEY constraints too; the > indexes are created implicitly when the constraint is created. Example: > > ```ALTER TABLE ONLY measurement ADD UNIQUE (city_id, logdate); > > ALTER TABLE measurement_y2006m02 ADD UNIQUE (city_id, logdate); > ALTER INDEX measurement_city_id_logdate_key > ATTACH PARTITION measurement_y2006m02_city_id_logdate_key; > ... > ``` > " > > I might be misinterpreting something. Sorry if that's the case! No, that is actually an omission in the documentation. The attached patch tries to improve that. Yours, Laurenz Albe
Commits
-
Fix omission in partitioning limitation documentation
- 18d51c0bb190 12.18 landed
- 9a94e9ae7ea2 13.14 landed
- 5b0287adcab3 14.11 landed
- bcaf41c608b1 15.6 landed
- af36f1993da1 16.2 landed
- ba2d2784f3f8 17.0 landed