X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 34B603A3CEC for ; Mon, 3 Jan 2005 17:35:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51749-09 for ; Mon, 3 Jan 2005 17:35:06 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3DC7B3A3BD6 for ; Mon, 3 Jan 2005 17:32:52 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j03HWIiq024512; Mon, 3 Jan 2005 12:32:18 -0500 (EST) To: Bradley Kieser Cc: PgSQL ADMIN Subject: Re: Rules on a view overwrite default values. Any way to reinstate them? In-reply-to: <41D97A9C.6050401@kieser.net> References: <41D97A9C.6050401@kieser.net> Comments: In-reply-to Bradley Kieser message dated "Mon, 03 Jan 2005 17:02:20 +0000" Date: Mon, 03 Jan 2005 12:32:18 -0500 Message-ID: <24511.1104773538@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/13 X-Sequence-Number: 15872 Bradley Kieser writes: > The problem is that rules on a view mean that the default values for NOT > NULL columns (used extensively) no longer trigger! The way you're supposed to fix this is to attach default values to the view itself. ALTER TABLE myview ALTER COLUMN updated_time SET DEFAULT now(); Now an INSERT on myview will include the correct expression before view expansion happens. I'm not sure how long we've had this, but it's definitely in 7.4. regards, tom lane