From ffca825ca27cffc70c7eb39385545a76fa0d9e2d Mon Sep 17 00:00:00 2001 From: James Coleman Date: Fri, 24 Sep 2021 09:59:27 -0400 Subject: [PATCH v3 1/2] Document atthasmissing default avoids verification table scan When PG11 added the ability for ALTER TABLE ADD COLUMN to set a constant default value without rewriting the table the doc changes did not note how the new feature interplayed with ADD COLUMN DEFAULT NOT NULL. Since adding a NOT NULL constraint requires a verification table scan to ensure no values are null, users want to know that the combined operation also avoids the table scan. --- doc/src/sgml/ref/alter_table.sgml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index a76e2e7322..1dde16fa39 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -1355,7 +1355,9 @@ WITH ( MODULUS numeric_literal, REM evaluated at the time of the statement and the result stored in the table's metadata. That value will be used for the column for all existing rows. If no DEFAULT is specified, NULL is used. In - neither case is a rewrite of the table required. + neither case is a rewrite of the table required. A NOT NULL + constraint may be added to the new column in the same statement without + requiring scanning the table to verify the constraint. -- 2.17.1