Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C7CE36340EA for ; Sat, 19 Sep 2009 15:45:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 72589-09 for ; Sat, 19 Sep 2009 18:45:11 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id 50494633C76 for ; Sat, 19 Sep 2009 15:45:11 -0300 (ADT) Received: by leary.csoft.net (Postfix, from userid 1112) id 93445A330; Sat, 19 Sep 2009 14:45:09 -0400 (EDT) Date: Sat, 19 Sep 2009 14:45:09 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Tom Lane cc: Dave Cramer , Andre Rothe , pgsql-jdbc@postgresql.org Subject: Re: Wrong column default values In-Reply-To: <5562.1253304906@sss.pgh.pa.us> Message-ID: References: <491f66a50909181307q147e92b4g58a6d5ef47cc0518@mail.gmail.com> <5562.1253304906@sss.pgh.pa.us> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200909/32 X-Sequence-Number: 19979 On Fri, 18 Sep 2009, Tom Lane wrote: > Indeed. In 8.3 it seems that even if you try to set the default that > way, the system will throw away the cast: That's only true without a typmod. Consider: CREATE TEMP TABLE tt (a varchar default null, b varchar(10) default null, c timestamptz default null, d timestamptz(4) default null); \d tt Column | Type | Modifiers --------+-----------------------------+---------------------------------------- a | character varying | b | character varying(10) | default NULL::character varying c | timestamp with time zone | d | timestamp(4) with time zone | default NULL::timestamp with time zone Kris Jurka