diff options
Diffstat (limited to 'doc/src/sgml/ref')
-rw-r--r-- | doc/src/sgml/ref/alter_table.sgml | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index afe213910c7..69f3355eded 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -1184,26 +1184,26 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM </para> <para> - When a column is added with <literal>ADD COLUMN</literal>, all existing - rows in the table are initialized with the column's default value - (NULL if no <literal>DEFAULT</literal> clause is specified). - If there is no <literal>DEFAULT</literal> clause, this is merely a metadata - change and does not require any immediate update of the table's data; - the added NULL values are supplied on readout, instead. + When a column is added with <literal>ADD COLUMN</literal> and a + non-volatile <literal>DEFAULT</literal> is specified, the default is + 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 <literal>DEFAULT</literal> is specified, NULL is used. In + neither case is a rewrite of the table required. </para> <para> - Adding a column with a <literal>DEFAULT</literal> clause or changing the type of - an existing column will require the entire table and its indexes to be - rewritten. As an exception when changing the type of an existing column, - if the <literal>USING</literal> clause does not change the column - contents and the old type is either binary coercible to the new type or - an unconstrained domain over the new type, a table rewrite is not needed; - but any indexes on the affected columns must still be rebuilt. Adding or - removing a system <literal>oid</literal> column also requires rewriting the entire - table. Table and/or index rebuilds may take a significant amount of time - for a large table; and will temporarily require as much as double the disk - space. + Adding a column with a volatile <literal>DEFAULT</literal> or + changing the type of an existing column will require the entire table and + its indexes to be rewritten. As an exception, when changing the type of an + existing column, if the <literal>USING</literal> clause does not change + the column contents and the old type is either binary coercible to the new + type or an unconstrained domain over the new type, a table rewrite is not + needed; but any indexes on the affected columns must still be rebuilt. + Adding or removing a system <literal>oid</literal> column also requires + rewriting the entire table. Table and/or index rebuilds may take a + significant amount of time for a large table; and will temporarily require + as much as double the disk space. </para> <para> |