pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: stan <stanb@panix.com>
To: Vik Fearing <vik@postgresfriends.org>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Calling a function from a rule?
Date: Wed, 4 Mar 2020 09:19:24 -0500
Message-ID: <20200304141924.GA5127@panix.com> (raw)
In-Reply-To: <0a22aafe-9a3a-78b5-84e3-88c98512cba9@postgresfriends.org>
References: <20200304130506.GA10957@panix.com>
	<0a22aafe-9a3a-78b5-84e3-88c98512cba9@postgresfriends.org>

On Wed, Mar 04, 2020 at 03:04:34PM +0100, Vik Fearing wrote:
> On 04/03/2020 14:05, stan wrote:
> > I am missing something about how to properly create a rule.
> 
> What you are missing is that you should not ever use RULEs.
> 
> > Thanks to the helpful folks on this list, I am looking a creating some
> > update able views. So, looks like I need to create a rule and a function
> > for this.
> 
> Use an INSTEAD OF trigger on the view unless it's a simple view in which
> case it "just works".

OK, I certainly believe you have more knowledge than I do here Just let me
make certain what I am trying to do fits that model.

I am trying to create an "update-able view" on a view that dereferences a
number of keys to foreign tables to make the view more "human friendly". so
it is going to need to look up those keys before allowing the insert into
the base table(s).

Can you please explain the difference between triggers and rules? 

I have some experience with using triggers in other situations, but the
documentation for update-able views seemed to point me to rules.

Tanks.

-- 
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
						-- Benjamin Franklin





view thread (4+ messages)

Message-ID: <20200304141924.GA5127@panix.com>
Permalink:  ../20200304141924.GA5127@panix.com/
Also on:    postgresql.org/message-id/20200304141924.GA5127@panix.com

 · 

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-general@postgresql.org
  Cc: stanb@panix.com, vik@postgresfriends.org
  Subject: Re: Calling a function from a rule?
  In-Reply-To: <20200304141924.GA5127@panix.com>
  References: <20200304130506.GA10957@panix.com> <0a22aafe-9a3a-78b5-84e3-88c98512cba9@postgresfriends.org> <20200304141924.GA5127@panix.com>

* 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