Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8F1574763B8 for ; Mon, 11 Nov 2002 15:11:56 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id E2B59476393 for ; Mon, 11 Nov 2002 15:11:45 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 1821415; Mon, 11 Nov 2002 12:14:58 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Luis Sousa , pgsql-sql Subject: Re: Permission on insert rules Date: Mon, 11 Nov 2002 12:12:59 -0800 X-Mailer: KMail [version 1.4] References: <3DCBF47B.7080809@ualg.pt> In-Reply-To: <3DCBF47B.7080809@ualg.pt> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200211111212.59912.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/171 X-Sequence-Number: 10313 Luis, > Just a question. > I'm writing some rules to insert/update some data in my database, and I= =20 > gave all the privileges on that view to the user, and only select on the= =20 > tables. > When that user inserts data using the view, I thought that was user=20 > postgres that will do the rest ! But I got permission denied on those=20 > tables. > The idea was to create a layer, with the views, giving to that user=20 > permission on views to insert and update, and not to tables. > Is this possible ? I just checked this. It works fine in 7.2.3. I think that you are missing a step. If you want to have an updatable view= ,=20 then you need to define a Rule for updating it, such as: kitchen=3D# create rule update_password as on update to user_password kitchen-# do instead update "user" set "password" =3D NEW."password" kitchen-# where user_id =3D OLD.user_id; See the online docs, under Server Programming, for how to use the RULES=20 system. --=20 -Josh Berkus Aglio Database Solutions San Francisco