pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Grant SELECT on all tables of a database
3+ messages / 2 participants
[nested] [flat]

* Grant SELECT on all tables of a database
@ 2007-05-29 17:21 Marsha Ramsey <msramsey22@yahoo.com>
  2007-05-29 19:51 ` Re: Grant SELECT on all tables of a database Oliver Elphick <olly@lfix.co.uk>
  0 siblings, 1 reply; 3+ messages in thread

From: Marsha Ramsey @ 2007-05-29 17:21 UTC (permalink / raw)
  To: pgsql-admin

Hello all,

How do I GRANT SELECT to all my tables at once?  I have over 1026 tables in this database...

Thanks...Marsha

 
---------------------------------
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.

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

* Re: Grant SELECT on all tables of a database
  2007-05-29 17:21 Grant SELECT on all tables of a database Marsha Ramsey <msramsey22@yahoo.com>
@ 2007-05-29 19:51 ` Oliver Elphick <olly@lfix.co.uk>
  2007-05-29 20:03   ` Re: Grant SELECT on all tables of a database Marsha Ramsey <msramsey22@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Oliver Elphick @ 2007-05-29 19:51 UTC (permalink / raw)
  To: pgsql-admin

On Tue, 2007-05-29 at 10:21 -0700, Marsha Ramsey wrote:
> Hello all,
> 
> How do I GRANT SELECT to all my tables at once?  I have over 1026
> tables in this database...

I don't think there is any direct SQL command to do it. But try this:

psql -d your_database
        \t
        \a
        \o /tmp/sqlscript
        SELECT 'GRANT SELECT ON '  || schemaname || '.' || tablename ||
        ' TO PUBLIC ;'
          FROM pg_tables
          WHERE tableowner = CURRENT_USER;
        \o
        \i /tmp/sqlscript
        
-- 
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
   Do you want to know God?   http://www.lfix.co.uk/knowing_god.html




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

* Re: Grant SELECT on all tables of a database
  2007-05-29 17:21 Grant SELECT on all tables of a database Marsha Ramsey <msramsey22@yahoo.com>
  2007-05-29 19:51 ` Re: Grant SELECT on all tables of a database Oliver Elphick <olly@lfix.co.uk>
@ 2007-05-29 20:03   ` Marsha Ramsey <msramsey22@yahoo.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Marsha Ramsey @ 2007-05-29 20:03 UTC (permalink / raw)
  To: Oliver Elphick <olly@lfix.co.uk>; pgsql-admin

This does the JOB...thank you very much!!!! 

Oliver Elphick <olly@lfix.co.uk> wrote: On Tue, 2007-05-29 at 10:21 -0700, Marsha Ramsey wrote:
> Hello all,
> 
> How do I GRANT SELECT to all my tables at once?  I have over 1026
> tables in this database...

I don't think there is any direct SQL command to do it. But try this:

psql -d your_database
        \t
        \a
        \o /tmp/sqlscript
        SELECT 'GRANT SELECT ON '  || schemaname || '.' || tablename ||
        ' TO PUBLIC ;'
          FROM pg_tables
          WHERE tableowner = CURRENT_USER;
        \o
        \i /tmp/sqlscript
        
-- 
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
   Do you want to know God?   http://www.lfix.co.uk/knowing_god.html


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


       
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.

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


end of thread, other threads:[~2007-05-29 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-05-29 17:21 Grant SELECT on all tables of a database Marsha Ramsey <msramsey22@yahoo.com>
2007-05-29 19:51 ` Oliver Elphick <olly@lfix.co.uk>
2007-05-29 20:03   ` Marsha Ramsey <msramsey22@yahoo.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