bug

David Orr <dave@daveorr.fsnet.co.uk>

From: David Orr <dave@daveorr.fsnet.co.uk>
To: pgsql-bugs@postgresql.org
Cc: simon.brooke@weft.co.uk
Date: 2000-10-31T16:25:50Z
Lists: pgsql-bugs
Your name		:	Dave Orr
Your email address	:	dave@weft.co.uk


System Configuration
---------------------
  Architecture (example: Intel Pentium)  	:Intel Pentium

  Operating System (example: Linux 2.0.26 ELF) 	:Linux 2-2.14-lmdklinus

  PostgreSQL version (example: PostgreSQL-7.0):   PostgreSQL-7.0.2

  Compiler used (example:  gcc 2.8.0)		:gcc 2.95.2


Please enter a FULL description of your problem:
------------------------------------------------

I create two tables where a field in one is constrained to only contain values
that exist in a field in the other. I create a group and grant all on the 
constrained table to that group. I grant the group select on the constraining
table. I add a user to the group. When the user tries to insert into the 
constrained table, I get permission denied.

I need to grant update on the constraining table in order to insert a record
into the constrained table


Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible: 
----------------------------------------------------------------------
Create a database named test. Run this script into it:

create table by_me(
	needed int primary key
);
insert into by_me values(1);

create table im_constrained(
	field1 int,

	constraint im_constrained_by_me  foreign key ( field1)
 	references by_me
 	match full
 	on delete no action
);

create group test;
grant select,update,delete,insert on im_constrained to group test;
grant select on by_me to group test;

Add a user to group "test"
suid to that user and try to add a record

test=> insert into im_constrained values(1);
ERROR:  by_me: Permission denied. 

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------