Improve ALTER TABLE synopsis
authorStephen Frost
Fri, 2 Feb 2018 10:30:04 +0000 (05:30 -0500)
committerStephen Frost
Fri, 2 Feb 2018 10:30:04 +0000 (05:30 -0500)
Add into the ALTER TABLE synopsis the definition of
partition_bound_spec, column_constraint, index_parameters and
exclude_element.

Initial patch by Lætitia Avrot, with further improvements by Amit
Langote and Thomas Munro.

Discussion: https://postgr.es/m/flat/27ec4df3-d1ab-3411-f87f-647f944897e1%40lab.ntt.co.jp

doc/src/sgml/ref/alter_table.sgml

index 286c7a858972e712dd6d15f6fcecf6e186959f9a..2b514b76064eac866b6f20ccb1dc4ac58fda4cc9 100644 (file)
@@ -85,6 +85,27 @@ ALTER TABLE [ IF EXISTS ] name
     OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
     REPLICA IDENTITY { DEFAULT | USING INDEX index_name | FULL | NOTHING }
 
+and partition_bound_spec is:
+
+IN ( { numeric_literal | string_literal | NULL } [, ...] ) |
+FROM ( { numeric_literal | string_literal | MINVALUE | MAXVALUE } [, ...] )
+  TO ( { numeric_literal | string_literal | MINVALUE | MAXVALUE } [, ...] ) |
+WITH ( MODULUS numeric_literal, REMAINDER numeric_literal )
+
+and column_constraint is:
+
+[ CONSTRAINT constraint_name ]
+{ NOT NULL |
+  NULL |
+  CHECK ( expression ) [ NO INHERIT ] |
+  DEFAULT default_expr |
+  GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( sequence_options ) ] |
+  UNIQUE index_parameters |
+  PRIMARY KEY index_parameters |
+  REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
+    [ ON DELETE action ] [ ON UPDATE action ] }
+[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
+
 and table_constraint is:
 
 [ CONSTRAINT constraint_name ]
@@ -101,6 +122,16 @@ ALTER TABLE [ IF EXISTS ] name
     [ CONSTRAINT constraint_name ]
     { UNIQUE | PRIMARY KEY } USING INDEX index_name
     [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
+
+index_parameters in UNIQUEPRIMARY KEY, and EXCLUDE constraints are:
+
+[ WITH ( storage_parameter [= value] [, ... ] ) ]
+[ USING INDEX TABLESPACE tablespace_name ]
+
+exclude_element in an EXCLUDE constraint is:
+
+{ column_name | ( expression ) } [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ]
+