From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Amit Langote <amitlangote09(at)gmail(dot)com> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL |
Date: | 2014-04-03 03:54:32 |
Message-ID: | 3036.1396497272@sss.pgh.pa.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs pgsql-general |
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.
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.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | nuko yokohama | 2014-04-03 03:58:37 | interval data type storage size |
Previous Message | Amit Langote | 2014-04-03 03:31:51 | Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2014-04-03 04:12:18 | Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL |
Previous Message | Amit Langote | 2014-04-03 03:31:51 | Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL |