Re: Updating views - Mailing list pgsql-general

From Rasmus Resen Amossen
Subject Re: Updating views
Date
Msg-id 3B1C16EC.8D9FB57B@rhk.dk
Whole thread Raw
In response to Re: Updating views  (DaVinci <bombadil@wanadoo.es>)
Responses Re: Re: Updating views  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: Re: Updating views  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Re: Updating views  (will trillich <will@serensoft.com>)
List pgsql-general
>  Problem is not 'where'. Views in Postgresql doesn't allows you insert,
>  update or delete unless you define especila rules that explain Postgresql
>  what to do in each case.
>  Look Postgresql programming manual. You can see a few examples of rules in
>  views.

OK, but I can't see how to make a single rule that allows me to update
an arbitray set of attributes from an arbitray where-clause.

Example:
I have a table named 'extable(a,b,c,d)' and a view 'exview(b,c,d)' for
this table. How can I with a single rule allow the following updates:
  update exview set b=10, c=0 where d=11;
  update exview set b=0 where c > d;
  update exview set d=123 where b=c and c=d;

In other words: I want to make the update of 'exview' transparent to
'extable'.

--
Rasmus Resen Amossen | stud.mat.dat at the University of Copenhagen
Jagtvej 120, -244    | http://www.math.ku.dk/muh
2200 Kbh. N          | http://w1.1444.telia.com/~u144400001

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: subselects in check clauses
Next
From: Stephan Szabo
Date:
Subject: Re: Re: Updating views