Doc: fix the rewrite condition when executing ALTER TABLE ADD COLUMN

Masahiro Ikeda <ikedamsh@oss.nttdata.com>

From: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2024-12-03T08:13:24Z
Lists: pgsql-hackers

Attachments

Hi,

The documentation seems to overlook the rewrite condition
when executing ALTER TABLE ADD COLUMN.

The current document states that a volatile DEFAULT will
trigger a rewrite of the table and its indexes. However, the
table and its indexes will also be rewritten when an IDENTITY
column is added, or when a column with a domain data type that
has constraints is added.

What do you think?

Regards,
-- 
Masahiro Ikeda
NTT DATA CORPORATION

Commits

  1. doc: Improve explanations when a table rewrite is needed

  2. doc: Explain more thoroughly when a table rewrite is needed

  3. Teach ALTER TABLE .. SET DATA TYPE to avoid some table rewrites.