IDENTITY columns are NOT NULL automatically

From: Erwin Brandstetter <brsaweda(at)gmail(dot)com>
To: pgsql-docs(at)postgresql(dot)org
Subject: IDENTITY columns are NOT NULL automatically
Date: 2019-02-05 14:18:51
Message-ID: CAGHENJ6db0U+7LjhWWov96aFW0exkOBRi2roKb06n2UsWM9VhQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

An IDENTITY column is automatically NOT NULL - which is per SQL standard.
I think this should be documented in sql-createtable.html. The same is
currently documented for PRIMARY KEY constraints:

https://www.postgresql.org/docs/devel/sql-createtable.html

> PRIMARY KEY enforces the same data constraints as a combination of UNIQUE
and NOT NULL

I suggest to replace this paragraph:

<< This clause creates the column as an identity column. It will have an
implicit sequence attached to it and the column in new rows will
automatically have values from the sequence assigned to it.

With this:

>> This clause creates the column as an identity column - with an implicit
sequence attached to it that automatically supplies column values for new
rows. A NOT NULL constraint is applied automatically.

Regards
Erwin

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2019-02-05 14:55:32 Re: Release note trimming: another modest proposal
Previous Message Jonathan S. Katz 2019-02-05 14:17:40 Re: Release note trimming: another modest proposal