pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guillaume Lelarge <guillaume@lelarge.info>
To: Brice André <brice@famille-andre.be>
Cc: pgsql-sql@postgresql.org
Subject: Re: Problem with DROP ROLE
Date: Wed, 19 Oct 2011 13:59:00 +0200
Message-ID: <1319025541.2112.1.camel@localhost.localdomain> (raw)
In-Reply-To: <CAOBG12mCa-07QW==228ieiosV_TKWK8wAowAhW+kXSkyVkfY9Q@mail.gmail.com>
References: <CAOBG12mCa-07QW==228ieiosV_TKWK8wAowAhW+kXSkyVkfY9Q@mail.gmail.com>

On Wed, 2011-10-19 at 12:11 +0200, Brice André wrote:
> Hello everyone,
> 
> I would want to implement an SQL query where I would be able to suppress all
> information from a registered user. I am currenlty able to suppress
> everything except the user role. The name of the role is present in a table
> and so, I would want to perform something like this :
> DROP ROLE (SELECT ...)
> but this is not considered as valid, as DROP ROLE is expecting a name and
> not a text field. So, I tried the following, but with no success :
> DROP ROLE CAST((SELECT...) AS name)
> 
> So, does someone knows how to handle this problem ?
> 

You can't do it with only one query. You need to use two queries: the
SELECT, and then the DROP.


-- 
Guillaume
  http://blog.guillaume.lelarge.info
  http://www.dalibo.com




view thread (4+ messages)  latest in thread

Message-ID: <1319025541.2112.1.camel@localhost.localdomain>
Permalink:  ../1319025541.2112.1.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1319025541.2112.1.camel@localhost.localdomain

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: guillaume@lelarge.info, brice@famille-andre.be
  Subject: Re: Problem with DROP ROLE
  In-Reply-To: <1319025541.2112.1.camel@localhost.localdomain>

* 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