pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kyle <kyle@actarg.com>
To: Jan Wieck <janwieck@yahoo.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Rule not invoked in 7.1
Date: Fri, 26 Jan 2001 10:20:22 -0700
Message-ID: <3A71B1D6.BD193BE4@actarg.com> (raw)
References: <200101261652.LAA02743@jupiter.greatbridge.com>

Jan Wieck wrote:

> Tom Lane wrote:
>
> > This might be better done with a trigger than a rule.  For one thing,
> > a trigger can easily raise an exception.  MHO is that rules are good
> > when you need to update multiple rows in other tables when certain
> > things happen.  If you just want to validate or twiddle an individual
> > tuple as it's inserted/updated, a trigger is a good bet.
>
>     But  the  trigger  aproach requires access permissions to the
>     base table in the first place, and exactly that's  what  Kyle
>     want to restrict.

That's right.

>     Kyle, I doubt if you need the condition in the update rule at
>     all.  As far as I understood, your view  restricts  what  the
>     user can see from the base table. This restricted SELECT rule
>     is applied to UPDATE events as well, so the UPDATE can  never
>     affect rows which are invisible through the view.

This hadn't occurred to me but makes sense now that you say it.  Taking that into
consideration will
make my job a bit simpler.

The only complication is
that there are a class of records which the user should be able to view, but not
modify.  For example,
the employee can create and modify working records as long as the only
modification to their status
is to move them on to "open status" (creating an "approved" record would be a bad
idea.)

But the user should be able to view all their records (working, open, approved,
and even paid).

Hence, the restrictions on update are more stringent than those on select.

Attachments:

kyle.vcf (text/x-vcard, 184B) download begin:vcard n:Bateman;Kyle x-mozilla-html:FALSE org:Action Target Inc. adr:;;;;;; version:2.1 email;internet:kyle@actarg.com title:President x-mozilla-cpt:;0 fn:Kyle Bateman end:vcard

view thread (10+ messages)  latest in thread

Message-ID: <3A71B1D6.BD193BE4@actarg.com>
Permalink:  ../3A71B1D6.BD193BE4@actarg.com/
Also on:    postgresql.org/message-id/3A71B1D6.BD193BE4@actarg.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-sql@postgresql.org
  Cc: kyle@actarg.com, janwieck@yahoo.com, tgl@sss.pgh.pa.us
  Subject: Re: Rule not invoked in 7.1
  In-Reply-To: <3A71B1D6.BD193BE4@actarg.com>
  References: <200101261652.LAA02743@jupiter.greatbridge.com> <3A71B1D6.BD193BE4@actarg.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