Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL - Mailing list pgsql-general

From Tom Lane
Subject Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL
Date
Msg-id 3704.1396498776@sss.pgh.pa.us
Whole thread Raw
In response to Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL  (Amit Langote <amitlangote09@gmail.com>)
Responses Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL
Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL
List pgsql-general
Amit Langote <amitlangote09@gmail.com> writes:
> On Thu, Apr 3, 2014 at 12:54 PM, Tom Lane <tgl@sss.pgh.pa.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.

            regards, tom lane


pgsql-general by date:

Previous
From: Amit Langote
Date:
Subject: Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL
Next
From: Amit Langote
Date:
Subject: Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL