Thread: Granting Privleges on All Tables in One Comand?

Granting Privleges on All Tables in One Comand?

From
"Adam"
Date:
Is it possible to 'GRANT SELECT ON ALL TABLES TO User' in 1 command ?

I saw the question in 2003 and wonder if it's still true.

Re: Granting Privleges on All Tables in One Comand?

From
Bruce Momjian
Date:
Adam wrote:
> Is it possible to 'GRANT SELECT ON ALL TABLES TO User' in 1 command ?
>
> I saw the question in 2003 and wonder if it's still true.

Still true, but on the TODO list:

        o %Allow GRANT/REVOKE permissions to be applied to all schema objects
          with one command

          The proposed syntax is:
                GRANT SELECT ON ALL TABLES IN public TO phpuser;
                GRANT SELECT ON NEW TABLES IN public TO phpuser;

--
  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, Pennsylvania 19073

Re: Granting Privleges on All Tables in One Comand?

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Adam wrote:
>> Is it possible to 'GRANT SELECT ON ALL TABLES TO User' in 1 command ?
>>
>> I saw the question in 2003 and wonder if it's still true.

> Still true, but on the TODO list:

Also, you can do it today by making a plpgsql function that iterates
through all the tables and does GRANTs.  There are examples in the
mailing list archives.  (The TODO item would probably have been done
by now if it weren't so easy to work around it.)

            regards, tom lane

Re: Granting Privleges on All Tables in One Comand?

From
"Joshua D. Drake"
Date:
Adam wrote:

> Is it possible to 'GRANT SELECT ON ALL TABLES TO User' in 1 command ?


No it is not. But you easily loop it with a one line script :)

>
> I saw the question in 2003 and wonder if it's still true.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org



--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: PLphp, PLperl - http://www.commandprompt.com/


Re: Granting Privleges on All Tables in One Comand?

From
"Larry Rosenman"
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> Adam wrote:
>>> Is it possible to 'GRANT SELECT ON ALL TABLES TO User' in 1 command
>>> ?
>>>
>>> I saw the question in 2003 and wonder if it's still true.
>
>> Still true, but on the TODO list:
>
> Also, you can do it today by making a plpgsql function that iterates
> through all the tables and does GRANTs.  There are examples in the
> mailing list archives.  (The TODO item would probably have been done
> by now if it weren't so easy to work around it.)
>
One example:

http://www.archonet.com/pgdocs/grant-all.html

--
Larry Rosenman
Database Support Engineer

PERVASIVE SOFTWARE. INC.
12365B RIATA TRACE PKWY
3015
AUSTIN TX  78727-6531

Tel: 512.231.6173
Fax: 512.231.6597
Email: Larry.Rosenman@pervasive.com
Web: www.pervasive.com