pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Foreign keys and access privileges
3+ messages / 2 participants
[nested] [flat]

* Foreign keys and access privileges
@ 2000-05-18 10:57  mkresse@slyde.in-berlin.de
  0 siblings, 2 replies; 3+ messages in thread

From: mkresse@slyde.in-berlin.de @ 2000-05-18 10:57 UTC (permalink / raw)
  To: pgsql-sql

Hi there,

Before upgrading to postgres 7.0 RC1, I was using a database like 
the following, which worked just fine for me, except for the missing 
referential integrity.

create table users(id INTEGER PRIMARY KEY, name VARCHAR);
create view curuser as select * from users where name = 
USER::varchar;
grant all on curuser to public;
create table choice(userid INTEGER REFERENCES users, data 
INTEGER);
grant all on choice to public;

Now, with Postgres 7.0 RC1, when some user (not the owner of the 
db, of course) tries to update, change or insert anything into 
choice, he gets an error message that says 'Permission denied' for 
table users. 
Is there a way to implement something like this, wthout a 'grant all 
on users to public'?
Is it possible at all to let people change tables, that reference 
other, non accessable tables?

Quick help would be greatly appreciated.
Thanks a lot,
 Martin




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Foreign keys and access privileges
@ 2000-05-18 14:54  Tom Lane <tgl@sss.pgh.pa.us>
  parent: mkresse@slyde.in-berlin.de
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2000-05-18 14:54 UTC (permalink / raw)
  To: mkresse@slyde.in-berlin.de; +Cc: pgsql-sql

mkresse@slyde.in-berlin.de writes:
> Now, with Postgres 7.0 RC1, when some user (not the owner of the 
> db, of course) tries to update, change or insert anything into 
> choice, he gets an error message that says 'Permission denied' for 
> table users. 

IIRC this is a known bug in RC1 (permissions not handled correctly
for foreign key references).  Have you tried it in 7.0 final?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Foreign keys and access privileges
@ 2000-05-18 22:19  mkresse@slyde.in-berlin.de
  parent: mkresse@slyde.in-berlin.de
  1 sibling, 0 replies; 3+ messages in thread

From: mkresse@slyde.in-berlin.de @ 2000-05-18 22:19 UTC (permalink / raw)
  To: pgsql-sql

> mkresse@slyde.in-berlin.de writes:
> > Now, with Postgres 7.0 RC1, when some user (not the owner of the 
> > db, of course) tries to update, change or insert anything into 
> > choice, he gets an error message that says 'Permission denied' for 
> > table users. 
> 
> IIRC this is a known bug in RC1 (permissions not handled correctly
> for foreign key references).  Have you tried it in 7.0 final?

Yes, it's still there (in 7.0). Try the following two tables:

create table a(x integer primary key);
create table b(y integer references a);
grant all on b to public;

When someone else than the owner tries an insert into b, he gets 
a 'Permission denied'. For the operation to be successful, he needs 
to have select and update privileges on a.

Ciao,
 Martin



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2000-05-18 22:19 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-05-18 10:57 Foreign keys and access privileges mkresse@slyde.in-berlin.de
2000-05-18 14:54 ` Tom Lane <tgl@sss.pgh.pa.us>
2000-05-18 22:19 ` mkresse@slyde.in-berlin.de

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox