Re: question on update/delete rules on views

From: Brook Milligan <brook(at)biology(dot)nmsu(dot)edu>
To: kyle(at)actarg(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: question on update/delete rules on views
Date: 2000-05-17 13:52:02
Message-ID: 200005171352.HAA19867@biology.nmsu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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.

Cheers,
Brook

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Mitch Vincent 2000-05-17 14:31:50 Re: lower() for varchar data by creating an index
Previous Message Richard J Kuhns 2000-05-17 13:50:27 Re: Question about databases in alternate locations...