Received: from flex.flex.ro (IDENT:root@[193.230.255.4]) by hub.org (8.9.3/8.9.3) with ESMTP id NAA99103 for ; Wed, 16 Feb 2000 13:23:14 -0500 (EST) (envelope-from teo@flex.ro) Received: from flex.ro (IDENT:teo@teo.flex.ro [193.230.255.3]) by flex.flex.ro (8.9.3/8.9.3) with ESMTP id VAA29189; Wed, 16 Feb 2000 21:26:56 +0200 Sender: teo@flex.flex.ro Message-ID: <38AAEB22.19CF1C6B@flex.ro> Date: Wed, 16 Feb 2000 20:23:30 +0200 From: Constantin Teodorescu X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.14 i586) X-Accept-Language: en MIME-Version: 1.0 To: Ed Loehr CC: PostgreSQL Interfaces Subject: Re: [INTERFACES] A question on triggers References: <38AAAD16.C05F47C3@flex.ro> <38AACF15.E7148A20@austin.rr.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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