Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WVZ7u-0004aj-7K for pgsql-general@arkaria.postgresql.org; Thu, 03 Apr 2014 04:19:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WVZ7t-0004Z4-J3 for pgsql-general@arkaria.postgresql.org; Thu, 03 Apr 2014 04:19:41 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WVZ7s-0004Yv-HF for pgsql-general@postgresql.org; Thu, 03 Apr 2014 04:19:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WVZ7q-00020t-0X for pgsql-general@postgresql.org; Thu, 03 Apr 2014 04:19:39 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s334JaYk003705; Thu, 3 Apr 2014 00:19:36 -0400 From: Tom Lane To: Amit Langote cc: Postgres General Subject: Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL In-reply-to: References: <3036.1396497272@sss.pgh.pa.us> Comments: In-reply-to Amit Langote message dated "Thu, 03 Apr 2014 13:12:18 +0900" Date: Thu, 03 Apr 2014 00:19:36 -0400 Message-ID: <3704.1396498776@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Amit Langote writes: > On Thu, Apr 3, 2014 at 12:54 PM, Tom Lane 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 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general