Re: Problem with DROP ROLE

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Brice André <brice(at)famille-andre(dot)be>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Problem with DROP ROLE
Date: 2011-10-19 11:59:00
Message-ID: 1319025541.2112.1.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Brice André 2011-10-19 12:19:56 Re: Problem with DROP ROLE
Previous Message Andreas Kretschmer 2011-10-19 11:32:32 Re: Problem with DROP ROLE