Re: Correction to previous post - Permission on views - Mailing list pgsql-bugs

From Donald Fraser
Subject Re: Correction to previous post - Permission on views
Date
Msg-id 006c01c4287d$0e122630$1664a8c0@DEMOLITION
Whole thread Raw
Responses Re: Correction to previous post - Permission on views  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
This is a correction to the previously posted bug - please ignore the previ=
ous posted bug as this is the corrected version:

PostgreSQL 7.4.2 on i386-redhat-linux-gnu, compiled by GCC 2.96

I have a simple VIEW such as the following:

CREATE OR REPLACE VIEW vu_tbl_useracc AS=20
 SELECT ua.id_user, ua.id_cmpy, ua.id_contrib, ua.dt_edited, ua.id_editedby
 FROM tbl_useracc ua;

GRANT SELECT, INSERT ON TABLE vu_tbl_useracc TO GROUP grp_cisx_admin;

CREATE OR REPLACE RULE rul_i02 AS=20
    ON INSERT TO vu_tbl_useracc DO INSTEAD=20=20
    INSERT INTO tbl_useracc (id_user, id_cmpy, id_contrib)  VALUES (new.id_=
user, new.id_cmpy, new.id_contrib);


If I attempt to INSERT into the view all works as expected.

Now when I add the following rule:

CREATE OR REPLACE RULE rul_i01 AS
    ON INSERT TO vu_tbl_useracc
   WHERE new.id_contrib =3D 1 DO  SELECT raise_exception('Cannot insert Com=
panies to access for CISX Users'::text) AS error;


Now whenever I attempt to INSERT into the view I get the following error.
ERROR: permission denied for relation vu_tbl_useracc

The error goes away if I grant both INSERT and UPDATE permissions to the ab=
ove group.

I didn't have this problem on version 7.3.4 which is what I have upgraded f=
rom.

Regards
Donald Fraser

pgsql-bugs by date:

Previous
From: "Donald Fraser"
Date:
Subject: Re: Correction to previous post - Permission on views
Next
From: Tom Lane
Date:
Subject: Re: Correction to previous post - Permission on views