From fee416ae2141019b7370a2ae31fc3d927d639977 Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Date: Tue, 9 Jan 2024 15:42:03 +0530
Subject: [PATCH 03/27] Add Identity Column section under Data Definition
 chapter

This seems to be missing since identity column support was added. Add
the same.

Ashutosh Bapat
---
 doc/src/sgml/ddl.sgml | 56 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index bb6ce9291e..b33c35e141 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -404,6 +404,62 @@ CREATE TABLE people (
   </para>
  </sect1>
 
+ <sect1 id="ddl-identity-columns">
+  <title>Identity Columns</title>
+
+  <indexterm zone="ddl-identity-columns">
+   <primary>identity column</primary>
+  </indexterm>
+
+  <para>
+  An identity column is a special column that is generated automatically. It
+  can be used to generate key values. In <productname>PostgreSQL</productname>
+  each identity column has an associated sequence from which it derives its
+  values. Such a column is implicitly NOT NULL. An identity column, however,
+  does not guarantee uniqueness. Uniqueness must be enforced using a
+  <literal>PRIMARY KEY</literal> or <literal>UNIQUE</literal> constraint or a
+  <literal>UNIQUE</literal> index.
+  </para>
+
+  <para>
+   To create an identity column, use the <literal>GENERATED ...
+   AS IDENTITY</literal> clause in <command>CREATE TABLE</command>, for example:
+<programlisting>
+CREATE TABLE people (
+    id bigint <emphasis>GENERATED ALWAYS AS IDENTITY</emphasis>,
+    ...,
+);
+</programlisting>
+   See <xref linkend="sql-createtable"/> for more details. The data type of an
+   identity column must be one of the data types supported by sequences. See
+   <xref linkend="sql-createsequence"/>. The properties of associated sequence
+   may be specified when creating an identity column (See <xref
+   linkend="sql-createtable"/>) or changed afterwards (See <xref
+   linkend="sql-altertable"/>).
+  </para>
+
+  <para>
+   In <command>INSERT</command> or <command>UPDATE</command> commands, the
+   keyword <literal>DEFAULT</literal> may be used, if necessary, to specify
+   system generated value.
+  </para>
+
+  <para>
+  Identity columns and their properties in a child table are independent of
+  those in its parent tables. A child table does not inherit identity columns
+  or their properties automatically from the parent. During insert or update, a
+  column is treated as an identity column if that column is an identity column
+  in the table named in the query and corresponding identity properties are
+  applied.
+  </para>
+
+  <para>
+  Partitions inherit indentity columns from the partitioned table. They cannot
+  have their own identity columns. The properties of a given identity column
+  are consistent across all the partitions in the partition hierarchy.
+  </para>
+ </sect1>
+
  <sect1 id="ddl-constraints">
   <title>Constraints</title>
 
-- 
2.25.1

