Received: from www.actarg.com (root@[209.180.91.25]) by hub.org (8.9.3/8.9.3) with ESMTP id LAA30309 for ; Wed, 17 May 2000 11:15:47 -0400 (EDT) (envelope-from kyle@actarg.com) Received: from actarg.com (root@[192.168.2.16]) by www.actarg.com (8.8.7/8.8.7) with ESMTP id IAA23129; Wed, 17 May 2000 08:17:01 -0600 Received: from actarg.com (IDENT:kyle@localhost [127.0.0.1]) by actarg.com (8.9.3/8.9.3) with ESMTP id JAA11735; Wed, 17 May 2000 09:15:46 -0600 Message-ID: <3922B7A2.5BEF5F5E@actarg.com> Date: Wed, 17 May 2000 09:15:46 -0600 From: Kyle Bateman Organization: Action Target Inc X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Brook Milligan CC: pgsql-sql@postgresql.org Subject: Re: question on update/delete rules on views References: <3921E506.82424CAF@actarg.com> <200005171352.HAA19867@biology.nmsu.edu> Content-Type: multipart/mixed; boundary="------------A56E96F8EBB5280491C46641" X-Archive-Number: 200005/27 This is a multi-part message in MIME format. --------------A56E96F8EBB5280491C46641 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Brook Milligan wrote: > create rule view_a_r_update as on update to view_a > do instead > update a set two = new.two; > > The problem is that your INSTEAD UPDATE rule is not constrained in any > way; it DOES hit every row. Instead, do something like: > > create rule view_a_r_update as on update to view_a > do instead > update a set two = new.two > where id = old.id; > > where id is a primary key in your table. > Thanks for the help. The problem with your suggestion is the view has to anticipate which column(s) the calling query wants to look at. What if the calling query has not specified the primary key in its where clause? In our real case, the table has many columns. There are a variety of queries that act on the table based on a variety of conditions in a variety of columns. I'd like to avoid having to have a separate rule or view for every possible where combination. Maybe that is not possible, but the manual seems to say it should work, so that's why I'm asking the question. --------------A56E96F8EBB5280491C46641 Content-Type: text/x-vcard; charset=us-ascii; name="kyle.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Kyle Bateman Content-Disposition: attachment; filename="kyle.vcf" begin:vcard n:Bateman;Kyle tel;fax:801-377-8096 tel;work:801-377-8033x101 x-mozilla-html:FALSE url:www.actiontarget.com org:Action Target Inc adr:;;PO Box 636;Provo;UT;84603;US version:2.1 email;internet:kyle@actiontarget.com title:President x-mozilla-cpt:;-15520 fn:Kyle Bateman end:vcard --------------A56E96F8EBB5280491C46641--