From 9139aa19423b736470f669e566f8ef6a7f19b801 Mon Sep 17 00:00:00 2001 From: Stephen Frost Date: Tue, 25 Apr 2017 16:57:43 -0400 Subject: Allow ALTER TABLE ONLY on partitioned tables There is no need to forbid ALTER TABLE ONLY on partitioned tables, when no partitions exist yet. This can be handy for users who are building up their partitioned table independently and will create actual partitions later. In addition, this is how pg_dump likes to operate in certain instances. Author: Amit Langote, with some error message word-smithing by me --- doc/src/sgml/ddl.sgml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 340c961b3fe..84c4f209909 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -2944,17 +2944,23 @@ VALUES ('Albany', NULL, NULL, 'NY'); Both CHECK and NOT NULL constraints of a partitioned table are always inherited by all its partitions. CHECK constraints that are marked - NO INHERIT are not allowed. + NO INHERIT are not allowed to be created on + partitioned tables. - The ONLY notation used to exclude child tables - will cause an error for partitioned tables in the case of - schema-modifying commands such as most ALTER TABLE - commands. For example, dropping a column from only the parent does - not make sense for partitioned tables. + Using ONLY to add or drop a constraint on only the + partitioned table is supported when there are no partitions. Once + partitions exist, using ONLY will result in an error + as adding or dropping constraints on only the partitioned table, when + partitions exist, is not supported. Instead, constraints can be added + or dropped, when they are not present in the parent table, directly on + the partitions. As a partitioned table does not have any data + directly, attempts to use TRUNCATE + ONLY on a partitioned table will always return an + error. -- cgit v1.2.3