X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 127FA30EC18 for ; Fri, 13 Jun 2003 16:31:37 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 67702-06 for ; Fri, 13 Jun 2003 13:31:26 -0300 (ADT) Received: from europa.janwieck.net (h00045a2e4e7c.ne.client2.attbi.com [24.131.181.55]) by svr1.postgresql.org (Postfix) with ESMTP id 309E430EC45 for ; Fri, 13 Jun 2003 13:31:26 -0300 (ADT) Received: from Yahoo.com (ismtp.afilias.com [216.217.55.254]) (authenticated) by europa.janwieck.net (8.11.6/8.11.6) with ESMTP id h5DGVBc31967; Fri, 13 Jun 2003 12:31:11 -0400 Message-ID: <3EE9FC23.8020206@Yahoo.com> Date: Fri, 13 Jun 2003 12:30:27 -0400 From: Jan Wieck Organization: Unorganized User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: weigelt@metux.de, PGSQL-SQL Subject: Re: question on rules References: <20030613012611.GA25276@metux.de> <22503.1055469445@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200306/126 X-Sequence-Number: 13884 Tom Lane wrote: > weigelt@metux.de writes: >> i'd like to write an rule which fills out some empty attrs on >> insert (w/ data from other given attrs). > > You'd be better off doing this with a BEFORE INSERT trigger. The only way to do it with rules would be to create a view over the basetable, create an insert rule over the view and then have the application doing the insert into the view instead. So "better" could be considered an understatement :-) Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #