Re: [INTERFACES] A question on triggers - Mailing list pgsql-interfaces

From Ed Loehr
Subject Re: [INTERFACES] A question on triggers
Date
Msg-id 38AACF15.E7148A20@austin.rr.com
Whole thread Raw
In response to A question on triggers  (Constantin Teodorescu <teo@flex.ro>)
List pgsql-interfaces
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?

Cheers,
Ed Loehr


pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: [INTERFACES] invalid lo descriptorc in begin commit fraze
Next
From: Constantin Teodorescu
Date:
Subject: Re: [INTERFACES] A question on triggers