Re: GRANT a varias tablas al mismo tiempo

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: jsgarcia(at)seguridad(dot)unam(dot)mx
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: GRANT a varias tablas al mismo tiempo
Date: 2009-12-01 21:37:48
Message-ID: 20091201213748.GG5013@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda pgsql-es-fomento

jsgarcia(at)seguridad(dot)unam(dot)mx escribió:
> Hola muchachos, espero que todos estén muy bien.
>
> Como esto de estar dando privilegios tabla por tabla resulta muy
> tedioso cuando se necesita hacer un ALL PRIVILEGES sobre todas las
> tablas de nuestra base, se me ha ocurrido hacer una query así:
>
> GRANT ALL PRIVILEGES ON (SELECT viewname FROM pg_views WHERE
> schemaname='public'
> UNION
> SELECT tablename FROM pg_tables WHERE schemaname='public'
> UNION
> SELECT relname FROM pg_statio_all_sequences WHERE
> schemaname='public') TO prueba_permisos;

Puedes construir una funcion en plpgsql que haga esto usando EXECUTE.

--
Alvaro Herrera Vendo parcela en Valdivia:
http://valdivia.vivastreet.cl/loteos-lotes+valdivia/parcela-en-cabo-blanco--valdivia/19288372
"How strange it is to find the words "Perl" and "saner" in such close
proximity, with no apparent sense of irony. I doubt that Larry himself
could have managed it." (ncm, http://lwn.net/Articles/174769/)

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Fernando Hevia 2009-12-01 21:40:34 RE: Tunning PGSQL
Previous Message Alvaro Herrera 2009-12-01 21:32:54 Re: [Spam] Consulta vacuum analyze

Browse pgsql-es-fomento by date

  From Date Subject
Next Message jsgarcia 2009-12-01 23:54:49 GRANT a varias tablas al mismo tiempo (Solucionado)
Previous Message jsgarcia 2009-12-01 21:10:23 GRANT a varias tablas al mismo tiempo (Solucionado)