Thread: Inconsistent syntax in GRANT

Inconsistent syntax in GRANT

From
Josh Berkus
Date:
Folks,

Just got tripped up by this:

GRANT SELECT ON table1 TO someuser;
GRANT SELECT ON table1_id_seq TO someuser;
.... both work

However,
GRANT SELECT ON TABLE table1 TO someuser; 
... works, while ....
GRANT SELECT ON SEQUENCE table1_id_seq TO someuser;
... raises an error.

This is inconsistent.   Do people agree with me that the parser should 
accept "SEQUENCE" there, since the optional object name works for all 
other objects?  Is there some technical reason this is difficult to do?

-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco


Re: Inconsistent syntax in GRANT

From
Euler Taveira de Oliveira
Date:
--- Josh Berkus <josh@agliodbs.com> escreveu:

> However,
> GRANT SELECT ON TABLE table1 TO someuser; 
> ... works, while ....
> GRANT SELECT ON SEQUENCE table1_id_seq TO someuser;
> ... raises an error.
> 
> This is inconsistent.   Do people agree with me that the parser
> should 
> accept "SEQUENCE" there, since the optional object name works for all
> 
> other objects?  Is there some technical reason this is difficult to
> do?
> 
It should but it's not implemented yet. There is no difficulty in doing
it. But I want to propose the following idea: if some object depends on
another object and its type is 'DEPENDENCY_INTERNAL' we could
grant/revoke privileges automagically to it. Or maybe create another
type of dependency to do so.
Comments?


Euler Taveira de Oliveira
euler[at]yahoo_com_br




    
_______________________________________________________ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html 



Re: Inconsistent syntax in GRANT

From
Josh Berkus
Date:
Euler,

> It should but it's not implemented yet. There is no difficulty in doing
> it. But I want to propose the following idea: if some object depends on
> another object and its type is 'DEPENDENCY_INTERNAL' we could
> grant/revoke privileges automagically to it. Or maybe create another
> type of dependency to do so.
> Comments?

I think this would be difficult to work out.  Personally, the only 
clear-cut case I can think of is SERIAL columns; other dependancies would 
require a lot of conditional logic.

-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco


Re: Inconsistent syntax in GRANT

From
Bruce Momjian
Date:
Josh Berkus wrote:
> Euler,
> 
> > It should but it's not implemented yet. There is no difficulty in doing
> > it. But I want to propose the following idea: if some object depends on
> > another object and its type is 'DEPENDENCY_INTERNAL' we could
> > grant/revoke privileges automagically to it. Or maybe create another
> > type of dependency to do so.
> > Comments?
> 
> I think this would be difficult to work out.  Personally, the only 
> clear-cut case I can think of is SERIAL columns; other dependancies would 
> require a lot of conditional logic.

Addded to TODO:
       * Allow SERIAL sequences to inherit permissions from the base table?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073