pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ljb <ljb220@mindspring.com>
To: pgsql-admin@postgresql.org
Subject: Re: REVOKE from all tables ...
Date: Thu, 11 Aug 2005 01:36:23 +0000 (UTC)
Message-ID: <ddea2m$1jhv$1@news.hub.org> (raw)
References: <20050809004545.S958@hub.org>
	<42F834F6.2090908@commandprompt.com>
	<20050809021939.J1002@ganymede.hub.org>

scrappy@postgresql.org wrote:
> On Mon, 8 Aug 2005, Joshua D. Drake wrote:
>
>> Marc G. Fournier wrote:
>>
>>> 
>>> Is there a way of REVOKEing privileges on all tables in a database?  I've 
>>> checked the REVOKE man page, and there doesn't appear to be, but I figured 
>>> I'd double check to make sure ...
>>
>> No. This has actually been a requested feature on the grant side as well... 
>> Nothing a simple for loop can't do with perl though.
>
> Ya, that is what I did, it just seemed that there should be a much 
> simplier way of doing it :(  Ah well, at least I wasn't re-creating the 
> wheel on this one :)


I like doing things like with just psql as shown below. And, I get to
look at the commands before running them.  For example: something
like this to revoke all for all tables in the public schema:

  -- Turn off headers:
  \t
  -- Use SQL to build SQL:
  SELECT 'REVOKE ALL ON public.' || table_name || ' FROM PUBLIC;'
  FROM information_schema.tables
    WHERE table_type = 'BASE TABLE' AND table_schema='public';
  -- If the output looks good, write it to a file and run it:
  \g out.tmp
  \i out.tmp

It works pretty well on similar tasks, at least until you run into string
quote/escape problems.



view thread (7+ messages)

Message-ID: <ddea2m$1jhv$1@news.hub.org>
Permalink:  ../ddea2m$1jhv$1@news.hub.org/
Also on:    postgresql.org/message-id/ddea2m$1jhv$1@news.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: ljb220@mindspring.com
  Subject: Re: REVOKE from all tables ...
  In-Reply-To: <ddea2m$1jhv$1@news.hub.org>
  References: <20050809004545.S958@hub.org> <42F834F6.2090908@commandprompt.com> <20050809021939.J1002@ganymede.hub.org> <ddea2m$1jhv$1@news.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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