pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
答复: [ADMIN] sql to grant privilege on sequence
2+ messages / 2 participants
[nested] [flat]

* 答复: [ADMIN] sql to grant privilege on sequence
@ 2014-07-14 09:31  liuyuanyuan <liuyuanyuangogo@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: liuyuanyuan @ 2014-07-14 09:31 UTC (permalink / raw)
  To: 'Guillaume Lelarge' <guillaume@lelarge.info>; +Cc: pgsql-admin

Thanks Guillaume! Thanks for your reply !

 

Now that, I got the reason.

I knew  GRANT ON TABLE still works for sequence, but I think use GRANT ON SEQUENCE

in pgAdmin3 of newer version maybe much better. Because GRANT ON SEQUENCE is more clear,

and maybe that’s why developers create this syntax especially for sequence.

That’s only a suggestion, looking forward to hearing from you later~~

 

Regards !

Yours,

Jasmine

 

 

发件人: Guillaume Lelarge [mailto:guillaume@lelarge.info] 
发送时间: 2014年7月14日 16:50
收件人: liuyuanyuan
抄送: pgsql-admin@postgresql.org
主题: Re: [ADMIN] sql to grant privilege on sequence

 

Le 14 juil. 2014 08:20, "liuyuanyuan" <liuyuanyuangogo@gmail.com <mailto:liuyuanyuangogo@gmail.com> > a écrit :
>
> Hi, Hackers!
>
> I got a question about sequence SQL of pgadmin3 , such as pgAdmin3 of PostgreSQL9.3.
>
> I found when I GRANT privilege on sequence by pgAdmin3 tool, it’s always show me sql like:
>
> GRANT SELECT, UPDATE ON TABLE sequence_name TO ….
>
> Rather than:
>
> GRANT SELECT, UPDATE ON SEQUENCE sequence_name TO ….
>
>  
>
> For example:
>
> When I use pgAdmin3 TO create a sequence, I input SEQUENCE NAME – seq1 ,and add privilege SELECT to public,
>
> Then the SQL shows: GRANT .. ON TABLE …
>
>  
>
>  
>
> I checked the documentation of PostgreSQL 9.3 (see http://www.postgresql.org/docs/9.3/interactive/sql-grant.html),
>
> Then I know the privileges grant on sequence are only a part of that on table.
>
> Then I want to know, why to use GRANT ON TABLE ? why not to use GRANT ON SEQUENCE ?
>

Because that was the way to do it before 8.2 iirc. And it still works. Nevertheless I'll look into it.

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

*  Re: 答复: [ADMIN] sql to grant privilege on sequence
@ 2014-07-14 21:05  Guillaume Lelarge <guillaume@lelarge.info>
  parent: liuyuanyuan <liuyuanyuangogo@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Guillaume Lelarge @ 2014-07-14 21:05 UTC (permalink / raw)
  To: liuyuanyuan <liuyuanyuangogo@gmail.com>; +Cc: pgsql-admin

2014-07-14 11:31 GMT+02:00 liuyuanyuan <liuyuanyuangogo@gmail.com>:

> Thanks Guillaume! Thanks for your reply !
>
>
>
> Now that, I got the reason.
>
> I knew  GRANT ON TABLE still works for sequence, but I think use GRANT ON
> SEQUENCE
>
> in pgAdmin3 of newer version maybe much better. Because GRANT ON SEQUENCE
> is more clear,
>
> and maybe that’s why developers create this syntax especially for
> sequence.
>
> That’s only a suggestion, looking forward to hearing from you later~~
>
>
Well, we have this weird check in pgSequence.cpp:

      if (!GetConnection()->BackendMinimumVersion(8, 2))¬
         sql += GetGrant(wxT("arwdRxt"), wxT("TABLE ") +
GetQuotedFullIdentifier());¬
      else¬
         sql += GetGrant(wxT("rwU"), wxT("TABLE ") +
GetQuotedFullIdentifier());¬

This code is as old as 2006 (commit id
2ef0bfe6cb8eb9d2cf117ca654bbbe0d17d0a784), where Dave added "Add support
for PostgreSQL 8.2's CONNECT privilege on databases, and USAGE on
sequences".

Pretty sure he meant SEQUENCE instead of TABLE in the else part :)

Fixed.

Thanks for the report.


-- 
Guillaume.
  http://blog.guillaume.lelarge.info
  http://www.dalibo.com

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


end of thread, other threads:[~2014-07-14 21:05 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-07-14 09:31 答复: [ADMIN] sql to grant privilege on sequence liuyuanyuan <liuyuanyuangogo@gmail.com>
2014-07-14 21:05 ` Guillaume Lelarge <guillaume@lelarge.info>

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