Re: Doc: fix the rewrite condition when executing ALTER TABLE ADD COLUMN
Robert Treat <rob@xzilla.net>
From: Robert Treat <rob@xzilla.net>
To: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-01-02T16:25:28Z
Lists: pgsql-hackers
Attachments
- v2-0001-Doc-fix-the-rewrite-condition-when-executing-ALTE.patch (application/octet-stream) patch v2-0001
On Tue, Dec 3, 2024 at 3:13 AM Masahiro Ikeda <ikedamsh@oss.nttdata.com> wrote: > > 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? > We still see a number of people asking (or confused) about table rewrites when adding columns, so I think the initial tip should remain, though I think it can be cleaned up a little. In the second section (alter_table.sgml) I liked the idea of adding these additional examples, though I tweaked the wording a bit to (hopefully) make it a little easier to read. Modified patch attached. Robert Treat https://xzilla.net
Commits
-
doc: Improve explanations when a table rewrite is needed
- 06c4f3ae804e 18.0 landed
-
doc: Explain more thoroughly when a table rewrite is needed
- 11bd8318602f 18.0 landed
-
Teach ALTER TABLE .. SET DATA TYPE to avoid some table rewrites.
- d31e2a495b6f 9.1.0 cited