pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Constantin Teodorescu <teo@flex.ro>
To: Ed Loehr <eloehr@austin.rr.com>
Cc: PostgreSQL Interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: [INTERFACES] A question on triggers
Date: Wed, 16 Feb 2000 20:23:30 +0200
Message-ID: <38AAEB22.19CF1C6B@flex.ro> (raw)
References: <38AAAD16.C05F47C3@flex.ro>
	<38AACF15.E7148A20@austin.rr.com>

Ed Loehr wrote:
> 
> Constantin Teodorescu wrote:
> >
> > I have two tables "inputs" and "outputs" and they hold items and
> > quantities that are coming and going from a warehouse.
> >
> > I have defined also another table "stock" that will hold the inventory
> > of that warehouse.
> >
> > I have defined triggers on INSERT, UPDATE and DELETE on "inputs" and
> > "outputs" tables that update acordingly the "stock" table!
> >
> > What's my problem?
> >
> > Is there any chance to restrict the direct updates of any user to the
> > "stock" table?
> > So that the information in the "stock" table should be updated ONLY by
> > those triggers?
> 
> Just for kicks, here's a hack.  Add a column named 'passwd' to the
> stock table (with a bogus default value), then create an UPDATE
> trigger on stock requiring the UPDATE to include a valid 'passwd'
> column value that's only known (hard-coded) to your 'inputs' and
> 'outputs' triggers.  Would that work?

I think it will work! It's really a good idea!

But wouldn't be nice if PostgreSQL could offer a more elegant solution?

Constantin Teodorescu
FLEX Consulting Braila, ROMANIA



view thread (6+ messages)  latest in thread

Message-ID: <38AAEB22.19CF1C6B@flex.ro>
Permalink:  ../38AAEB22.19CF1C6B@flex.ro/
Also on:    postgresql.org/message-id/38AAEB22.19CF1C6B@flex.ro

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: teo@flex.ro, eloehr@austin.rr.com
  Subject: Re: [INTERFACES] A question on triggers
  In-Reply-To: <38AAEB22.19CF1C6B@flex.ro>

* 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