X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 0DF699FB323 for ; Mon, 21 Aug 2006 07:27:46 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 23032-10 for ; Mon, 21 Aug 2006 10:27:37 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id 0B5019FB31F for ; Mon, 21 Aug 2006 07:27:24 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1GF7D0-0003Ox-2g for pgsql-sql@postgresql.org; Mon, 21 Aug 2006 06:40:42 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id DCFEE4172; Mon, 21 Aug 2006 06:27:17 -0400 (EDT) Date: Mon, 21 Aug 2006 06:27:17 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: NULL becomes default Message-ID: <20060821102717.GA7551@phlogiston.dyndns.org> References: <029c01c6c228$8e8e5210$0600a8c0@Wilbur> <44E6C30D.1070608@logix-tt.com> <0cb101c6c444$44867300$0600a8c0@Wilbur> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0cb101c6c444$44867300$0600a8c0@Wilbur> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200608/148 X-Sequence-Number: 26106 On Sun, Aug 20, 2006 at 11:34:48AM +0100, Julian Scarfe wrote: > So thinking about this a little more, it requires me to be able to change a > column value to DEFAULT (unless I implement the default from scratch in the > trigger, but that feels messy). I don't have much experience of triggers: > can I do that? DEFAULT won't work for this case, I don't think; you want to set it to the nextval() of the sequence or whatever it was you were trying to do. But it's not messy: this is precisely the sort of thing BEFORE triggers are good at. A -- Andrew Sullivan | ajs@crankycanuck.ca "The year's penultimate month" is not in truth a good way of saying November. --H.W. Fowler