Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] A question on triggers

From: Constantin Teodorescu <teo(at)flex(dot)ro>
To: Ed Loehr <eloehr(at)austin(dot)rr(dot)com>
Cc: PostgreSQL Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: [INTERFACES] A question on triggers
Date: 2000-02-16 18:23:30
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
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

In response to


pgsql-interfaces by date

Next:From: Wojtek SobczukDate: 2000-02-16 18:28:18
Subject: ecpg
Previous:From: Ed LoehrDate: 2000-02-16 16:23:49
Subject: Re: [INTERFACES] A question on triggers

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group