public inbox for [email protected]
help / color / mirror / Atom feedFrom: Amit Langote <[email protected]>
To: Tom Lane <[email protected]>
Cc: Postgres General <[email protected]>
Subject: Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL
Date: Thu, 3 Apr 2014 13:53:43 +0900
Message-ID: <CA+HiwqHvoM4RpYpGQdLXSQziGZhR1KmR9skTr03MMRJFdqXuJg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CA+HiwqE35_+z0_gFw9mp=_0MLgPfb=+QY910LG7C-sBNTvqdgg@mail.gmail.com>
<[email protected]>
<CA+HiwqGzakcVbKbfxv6ThNcAmp_ZgakagKTM1u80PAF2mnNVcQ@mail.gmail.com>
<[email protected]>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-general>
On Thu, Apr 3, 2014 at 1:19 PM, Tom Lane <[email protected]> wrote:
> Amit Langote <[email protected]> writes:
>> On Thu, Apr 3, 2014 at 12:54 PM, Tom Lane <[email protected]> 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
--
Sent via pgsql-general mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Attachments:
[application/octet-stream] alter-table-doc-fix.patch (719B, 2-alter-table-doc-fix.patch)
download | inline diff:
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index 4847d66..de63e9e 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -853,7 +853,9 @@ ALTER TABLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable>
<para>
When a column is added with <literal>ADD COLUMN</literal>, all existing
rows in the table are initialized with the column's default value
- (NULL if no <literal>DEFAULT</> clause is specified).
+ (NULL if no <literal>DEFAULT</> clause is specified). Users are advised
+ not to use explicit <literal>DEFAULT</> clause unless there is a non-null
+ default value to specify.
</para>
<para>
view thread (9+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL
In-Reply-To: <CA+HiwqHvoM4RpYpGQdLXSQziGZhR1KmR9skTr03MMRJFdqXuJg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox