dbTalk Databases Forums  

[BUGS] BUG #1794: inheritance removes permissions from the parent table

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1794: inheritance removes permissions from the parent table in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sean Burlington
 
Posts: n/a

Default [BUGS] BUG #1794: inheritance removes permissions from the parent table - 07-28-2005 , 08:25 AM







The following bug has been logged online:

Bug reference: 1794
Logged by: Sean Burlington
Email address: sean (AT) uncertainty (DOT) org.uk
PostgreSQL version: 7.4
Operating system: Debian GNU/Linux
Description: inheritance removes permissions from the parent table
Details:

Hi,
I'm not sure if this is strictly a bug or just a side effect of
inheritance that could do with being added to the documentation.

If you create a new table that inherits from another table - a user cannot
select from the parent if they cannot select from the child.

To recreate:

as dba
create table a (id int);
grant select on a to auser;
insert into a (id) values (1);

as auser
select * from a;
id
----
1

as dba
create table b (data int) inherits (a);

as auser
select * from a;
ERROR: permission denied for relation b

I didn't expect to need permission for table b in order to select from a...

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply With Quote
  #2  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] BUG #1794: inheritance removes permissions from the parent table - 07-28-2005 , 08:52 AM






On Thu, Jul 28, 2005 at 12:48:35PM +0100, Sean Burlington wrote:
Quote:
Description: inheritance removes permissions from the parent table
I think a more accurate description would be "permissions not
inherited by children," and that isn't necessarily a bug.

Quote:
If you create a new table that inherits from another table - a user cannot
select from the parent if they cannot select from the child.
[snip]

Quote:
select * from a;
ERROR: permission denied for relation b

I didn't expect to need permission for table b in order to select from a...
Records in the child are visible when you select from the parent,
so it follows that you'd need permission on both tables. If you
want only records that are in the parent then use FROM ONLY:

SELECT * FROM ONLY a;

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
  #3  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] BUG #1794: inheritance removes permissions from the parent table - 07-28-2005 , 10:56 PM



On Thu, Jul 28, 2005 at 03:56:14PM +0100, Sean Burlington wrote:
Quote:
Michael Fuhr wrote:
On Thu, Jul 28, 2005 at 12:48:35PM +0100, Sean Burlington wrote:

Description: inheritance removes permissions from the parent table

I think a more accurate description would be "permissions not
inherited by children," and that isn't necessarily a bug.

I agree it may not be a bug - but it's more than the permissions not
being inherited: the parent is affected.
Not really, once you understand what's happening. Unless you use
FROM ONLY, selecting from the parent selects from the parent *and*
its children. The parent itself isn't affected, as queries with
FROM ONLY should demonstrate. I understand what you're saying --
that there's an apparent effect on the parent -- but there really
isn't.

Quote:
It would be handy if this was in the documentation for anyone else who
comes across this issue
Feel free to submit a documentation patch to pgsql-patches :-)

Quote:
Would it be possible to allow the usual select and just return the
records the user has permission for - possibly along with a warning
about the child table?
I think you'd have a hard time selling that to the developers,
because a query that returns successfully but with an incomplete
record set isn't solving any problem. If the problem is inadequate
documentation, then the correct solution is to fix the documentation.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.