turns out this has already been discussed at [1] NOT VALID only applies to table_constraint. Amit Langote actually wrote the doc at[1], so I copied some text from there.
in create_table.sgml, i placed right below <term><literal>INITIALLY IMMEDIATE</literal></term> <term><literal>INITIALLY DEFERRED</literal></term> so it looks like this: <varlistentry id="sql-createtable-parms-notvalid"> <term><literal>NOT VALID</literal></term> <listitem> <para> This applies only to <literal>CHECK</literal> and foreign key constraints. Note even if the constraint is marked as <literal>NOT VALID</literal>, it is considered as validated since the newly created table will not contain any data. In other words, specifying <literal>NOT VALID</literal> has no effect. </para> </listitem> </varlistentry> [1] https://www.postgresql.org/message-id/flat/d2b7419f-4a71-cf86-cc99-bfd0f359a1ea%40lab.ntt.co.jp
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 70fa929caa..59357bca41 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -84,7 +84,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI FOREIGN KEY ( <replaceable class="parameter">column_name</replaceable> [, ... ] [, PERIOD <replaceable class="parameter">column_name</replaceable> ] ) REFERENCES <replaceable class="parameter">reftable</replaceable> [ ( <replaceable class="parameter">refcolumn</replaceable> [, ... ] [, PERIOD <replaceable class="parameter">refcolumn</replaceable> ] ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE <replaceable class="parameter">referential_action</replaceable> ] [ ON UPDATE <replaceable class="parameter">referential_action</replaceable> ] } -[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] +[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] [NOT VALID] <phrase>and <replaceable class="parameter">like_option</replaceable> is:</phrase> @@ -1377,6 +1377,18 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM </listitem> </varlistentry> + <varlistentry id="sql-createtable-parms-notvalid"> + <term><literal>NOT VALID</literal></term> + <listitem> + <para> + This applies only to <literal>CHECK</literal> and foreign key constraints. + Note even if the constraint is marked as <literal>NOT VALID</literal>, + it is considered as validated since the newly created table will not + contain any data. In other words, specifying <literal>NOT VALID</literal> has no effect. + </para> + </listitem> + </varlistentry> + <varlistentry id="sql-createtable-method"> <term><literal>USING <replaceable class="parameter">method</replaceable></literal></term> <listitem>