pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Granting any privilege for a specific set of tables in postgres in a single shot!..
2+ messages / 2 participants
[nested] [flat]
* Re: Granting any privilege for a specific set of tables in postgres in a single shot!..
@ 2018-07-25 13:32 pavan95 <pavan.postgresdba@gmail.com>
2018-07-25 13:41 ` Re: Granting any privilege for a specific set of tables in postgres in a single shot!.. Scott Ribe <scott_ribe@elevated-dev.com>
0 siblings, 1 reply; 2+ messages in thread
From: pavan95 @ 2018-07-25 13:32 UTC (permalink / raw)
To: pgsql-admin
Hi all,
Hope my mail finds you in good time. I have a question in regards to
"Grant" command.
How can I grant a particular privilege to a specific set of objects(tables)
in a single shot ?
FYI, please consider the following scenario. I have a database "abc" with
users as "u1","u2","u3","u4". And there are 1500 tables in my database.
Now my requirement is to grant select on 800 tables(specific set of tables)
which suits my requirement. I know that I can use the below statement 800
times.
grant select on table1 to u1;
grant select on table2 to u1;
.
.
.
.
.
.
grant select on table800 to u1;
My question is can't I do it in a single shot? Can I fit some select query
which passes the table name as a parameter in the middle of the grant
statement?
Please advice.
Thanks in Advance.
Regards,
Pavan
--
Sent from: http://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Granting any privilege for a specific set of tables in postgres in a single shot!..
2018-07-25 13:32 Re: Granting any privilege for a specific set of tables in postgres in a single shot!.. pavan95 <pavan.postgresdba@gmail.com>
@ 2018-07-25 13:41 ` Scott Ribe <scott_ribe@elevated-dev.com>
0 siblings, 0 replies; 2+ messages in thread
From: Scott Ribe @ 2018-07-25 13:41 UTC (permalink / raw)
To: pavan95 <pavan.postgresdba@gmail.com>; +Cc: pgsql-admin
3 suggestions
- use roles so you don't have to grant to so many individual users
- use schemas so you don't have to grant to individual tables
- select 'grant select on ' || ? || ' to ' || ?, into a script which you then execute
--
Scott Ribe
scott_ribe@elevated-dev.com
https://www.linkedin.com/in/scottribe/
> On Jul 25, 2018, at 7:32 AM, pavan95 <pavan.postgresdba@gmail.com> wrote:
>
> Hi all,
>
> Hope my mail finds you in good time. I have a question in regards to
> "Grant" command.
>
> How can I grant a particular privilege to a specific set of objects(tables)
> in a single shot ?
>
> FYI, please consider the following scenario. I have a database "abc" with
> users as "u1","u2","u3","u4". And there are 1500 tables in my database.
>
> Now my requirement is to grant select on 800 tables(specific set of tables)
> which suits my requirement. I know that I can use the below statement 800
> times.
>
> grant select on table1 to u1;
> grant select on table2 to u1;
> .
> .
> .
> .
> .
> .
> grant select on table800 to u1;
>
> My question is can't I do it in a single shot? Can I fit some select query
> which passes the table name as a parameter in the middle of the grant
> statement?
>
> Please advice.
>
> Thanks in Advance.
>
> Regards,
> Pavan
>
>
>
>
>
> --
> Sent from: http://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-07-25 13:41 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 13:32 Re: Granting any privilege for a specific set of tables in postgres in a single shot!.. pavan95 <pavan.postgresdba@gmail.com>
2018-07-25 13:41 ` Scott Ribe <scott_ribe@elevated-dev.com>
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