Hello, I posted this to the "clean up docs for v12" thread and it was suggested I make a new thread instead, so here it is. Sorry for the extra noise! :-)
I noticed the docs at https://www.postgresql.org/docs/devel/ddl-partitioning.html still say you can't create a foreign key referencing a partitioned table, even though the docs for https://www.postgresql.org/docs/devel/sql-createtable.html have been updated (compared to v11). My understanding is that foreign keys *still* don't work as expected when pointing at traditional INHERITS tables, but they *will* work with declaratively-partitioned tables. In that case I suggest this change: diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index a0a7435a03..3b4f43bbad 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3966,14 +3966,6 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02 - <listitem> - <para> - While primary keys are supported on partitioned tables, foreign - keys referencing partitioned tables are not supported. (Foreign key - references from a partitioned table to some other table are supported.) - </para> - </listitem> - <listitem> <para> <literal>BEFORE ROW</literal> triggers, if necessary, must be defined on individual partitions, not the partitioned table. </para> @@ -4366,6 +4358,14 @@ ALTER TABLE measurement_y2008m02 INHERIT measurement; </para> </listitem> + <listitem> + <para> + While primary keys are supported on inheritance-partitioned tables, foreign + keys referencing these tables are not supported. (Foreign key + references from an inheritance-partitioned table to some other table are supported.) + </para> + </listitem> + <listitem> <para> If you are using manual <command>VACUUM</command> or (I've also attached it as a patch file.) In other words, we should move this caveat from the section on declaratively-partitioned tables to the section on inheritance-partitioned tables. Yours, Paul
inheritance_fk_docs_v0001.patch
Description: Binary data