From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL |
Date: | 2014-04-03 04:12:18 |
Message-ID: | CA+HiwqGzakcVbKbfxv6ThNcAmp_ZgakagKTM1u80PAF2mnNVcQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs pgsql-general |
On Thu, Apr 3, 2014 at 12:54 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Amit Langote <amitlangote09(at)gmail(dot)com> writes:
>> When I do the following:
>
>> ALTER TABLE table ADD COLUMN numeric(x) DEFAULT NULL;
>
>> The table is rewritten whereas notes section on the manual page for
>> ALTER TABLE says otherwise (which holds true for most of the cases
>> though).
>
> Try it without the explicit DEFAULT clause.
>
Thanks, that does the trick.
> 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)?
--
Amit
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-04-03 04:19:36 | Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL |
Previous Message | nuko yokohama | 2014-04-03 03:58:37 | interval data type storage size |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-04-03 04:19:36 | Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL |
Previous Message | Tom Lane | 2014-04-03 03:54:32 | Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL |