grant select,update - bug or feature?

Поиск
Список
Период
Сортировка
Искать

grant select,update - bug or feature?

От:
Eugene Karpachov <jk@steel.orel.ru>
Дата:
Excuse me for my bad English.

Let us create test database as superuser:

create table master ( i integer primary key, a text);
	-- I want to protect this table from updating by 'dbuser'
	
create table slave ( j integer references master, b text);
	-- I want to enable updating this table by 'dbuser' 
	
grant select on master to dbuser;
grant select,update on slave to dbuser;

-- populating tables with sample values:
insert into master (i,a) values (1,'one');
insert into master (i,a) values (2,'two');
insert into slave (j,b) values (1,'ONE');

By now, all is ok.


Then, running psql as 'dbuser':

jk=> update slave set b='four';
ERROR:  master: Permission denied.

Why dbuser need 'update' permissions on 'master' table? I only want to
update 'slave' table.

If superuser grants update on master to dbuser, all works.

-- 
jk

Re: grant select,update - bug or feature?

От:
Eugene Karpachov <jk@steel.orel.ru>
Дата:
Mon, May 29, 2000 at 08:51:10PM -0700, Stephan Szabo write:
> This is a known issue in the 7.0 foreign key implementation.  The short

Thank you, now it's clear for me.

> It's something that will get fixed, it's just a question of how and when.
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It's just what I want to know :)
  
> > create table master ( i integer primary key, a text);
> > -- I want to protect this table from updating by 'dbuser'

By the way, how can I make such a protection? Are triggers the only way?

> > create table slave ( j integer references master, b text);
> > -- I want to enable updating this table by 'dbuser' 
> > 
> > grant select on master to dbuser;
> > grant select,update on slave to dbuser;

-- 
jk
FAQ