summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/catalogs.sgml27
-rw-r--r--doc/src/sgml/ref/alter_table.sgml34
2 files changed, 44 insertions, 17 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 95a5b113b98..d6a9d8c5808 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1150,6 +1150,19 @@
</row>
<row>
+ <entry><structfield>atthasmissing</structfield></entry>
+ <entry><type>bool</type></entry>
+ <entry></entry>
+ <entry>
+ This column has a value which is used where the column is entirely
+ missing from the row, as happens when a column is added with a
+ non-volatile <literal>DEFAULT</literal> value after the row is created.
+ The actual value used is stored in the
+ <structfield>attmissingval</structfield> column.
+ </entry>
+ </row>
+
+ <row>
<entry><structfield>attidentity</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
@@ -1229,6 +1242,20 @@
</entry>
</row>
+ <row>
+ <entry><structfield>attmissingval</structfield></entry>
+ <entry><type>anyarray</type></entry>
+ <entry></entry>
+ <entry>
+ This column has a one element array containing the value used when the
+ column is entirely missing from the row, as happens when the column is
+ added with a non-volatile <literal>DEFAULT</literal> value after the
+ row is created. The value is only used when
+ <structfield>atthasmissing</structfield> is true. If there is no value
+ the column is null.
+ </entry>
+ </row>
+
</tbody>
</tgroup>
</table>
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>