Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 0E6B62E356F for ; Tue, 1 Jan 2008 03:40:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 06017-01 for ; Tue, 1 Jan 2008 03:40:16 -0400 (AST) Received: from server.ak.quickcircuit.co.nz (gateway.quickcircuit.co.nz [210.55.214.217]) by postgresql.org (Postfix) with ESMTP id 038D62E3568 for ; Tue, 1 Jan 2008 03:40:22 -0400 (AST) Received: from server.ak.quickcircuit.co.nz (localhost.localdomain [127.0.0.1]) by server.ak.quickcircuit.co.nz (8.13.4/8.13.4) with ESMTP id m017eEbB026567; Tue, 1 Jan 2008 20:40:14 +1300 Received: (from mb@localhost) by server.ak.quickcircuit.co.nz (8.13.4/8.13.4/Submit) id m017e9oW026566; Tue, 1 Jan 2008 20:40:09 +1300 X-Authentication-Warning: server.ak.quickcircuit.co.nz: mb set sender to pgsql@becroft.co.nz using -f To: Tom Lane Cc: Mario Becroft , pgsql-sql@postgresql.org Subject: Re: Using rules to implement backward-compatible schema changes References: <873atit7od.fsf@server.ak.quickcircuit.co.nz> <13418.1199171358@sss.pgh.pa.us> From: Mario Becroft Date: Tue, 01 Jan 2008 20:40:09 +1300 In-Reply-To: <13418.1199171358@sss.pgh.pa.us> (Tom Lane's message of "Tue\, 01 Jan 2008 02\:09\:18 -0500") Message-ID: <87y7baouxy.fsf@server.ak.quickcircuit.co.nz> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200801/4 X-Sequence-Number: 29858 Tom Lane writes: > Mario Becroft writes: >> The problem is that when inserting to the view, default values do not >> work as expected. > > You need to attach the defaults to the view, viz > > ALTER TABLE a ALTER COLUMN bar SET DEFAULT 5; > > This is considered a feature not a bug, since you might want a > different default for inserts to the view than for inserts > directly to the underlying table. This crossed my mind, but I could not find a way of specifying defaults for a view. I see now that it must be done with ALTER TABLE. Thanks for your help with this problem. -- Mario Becroft (postgres-related mail)