Fwd: [GENERAL] Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: pgsql-docs(at)postgresql(dot)org
Subject: Fwd: [GENERAL] Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL
Date: 2014-04-03 05:02:41
Message-ID: CA+HiwqHyY6fKuGjHTtF_HesnbJs=muu9chmNqzoa3MLaRv_KbQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-general

---------- Forwarded message ----------
From: Amit Langote <amitlangote09(at)gmail(dot)com>
Date: Thu, Apr 3, 2014 at 1:53 PM
Subject: Re: [GENERAL] Table Rewrite During ALTER TABLE ... ADD COLUMN
... DEFAULT NULL
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>

On Thu, Apr 3, 2014 at 1:19 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Amit Langote <amitlangote09(at)gmail(dot)com> writes:
>> On Thu, Apr 3, 2014 at 12:54 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Some experimentation suggests that we are smart about "DEFAULT NULL"
>>> unless the column type requires a length-coercion cast, in which
>>> case the default expression involves a function call, and that doesn't
>>> get elided.
>
>> Is there a warning about such behavior in the manual?
>> Is it useful to include it somewhere (not sure where though)?
>
> We could just rephrase the ALTER TABLE docs to say that the table
> rewrite is avoided if you omit the DEFAULT clause, rather than
> saying that a null default works.
>

How does the attached sound?
Wonder if a rewrite-warning is necessary?

--
Amit

Attachment Content-Type Size
alter-table-doc-fix.patch application/octet-stream 719 bytes

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2014-04-03 16:46:24 Re: Fwd: [GENERAL] Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL
Previous Message Amit Langote 2014-04-03 04:53:43 Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL

Browse pgsql-general by date

  From Date Subject
Next Message peter.schumm 2014-04-03 06:58:40 Re: Unattended Installation
Previous Message Amit Langote 2014-04-03 04:53:43 Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL