pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brook Milligan <brook@biology.nmsu.edu>
To: kyle@actarg.com
Cc: pgsql-sql@postgresql.org
Subject: Re: question on update/delete rules on views
Date: Wed, 17 May 2000 07:52:02 -0600 (MDT)
Message-ID: <200005171352.HAA19867@biology.nmsu.edu> (raw)
In-Reply-To: <3921E506.82424CAF@actarg.com>
References: <3921E506.82424CAF@actarg.com>

   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




view thread (8+ messages)  latest in thread

Message-ID: <200005171352.HAA19867@biology.nmsu.edu>
Permalink:  ../200005171352.HAA19867@biology.nmsu.edu/
Also on:    postgresql.org/message-id/200005171352.HAA19867@biology.nmsu.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: brook@biology.nmsu.edu, kyle@actarg.com
  Subject: Re: question on update/delete rules on views
  In-Reply-To: <200005171352.HAA19867@biology.nmsu.edu>
  References: <3921E506.82424CAF@actarg.com> <200005171352.HAA19867@biology.nmsu.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox