Re: question on update/delete rules on views - Mailing list pgsql-sql

From Brook Milligan
Subject Re: question on update/delete rules on views
Date
Msg-id 200005171352.HAA19867@biology.nmsu.edu
Whole thread Raw
In response to question on update/delete rules on views  (Kyle Bateman <kyle@actarg.com>)
List 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



pgsql-sql by date:

Previous
From: Yamini Sharma
Date:
Subject: Storing binary data in a column
Next
From: "Mitch Vincent"
Date:
Subject: Re: lower() for varchar data by creating an index