Re: [SQL] Problem with DROP ROLE

2011-10-25 Thread Andreas Kretschmer
You can't do that in THAT way, but you can use dynamic SQL:   test=# select * from drop_role ;    t  foobar (1 row) test=*# do $$ declare r text; begin for r in select t from drop_role loop execute 'drop role ' || quote_ident(r) || ';'; end loop; end; $$language plpgsql;   DO      "Bric

Re: [SQL] Problem with DROP ROLE

2011-10-19 Thread Brice André
Thanks very much. I replaced my statement by the following plpgsql code : statement := 'DROP ROLE "'||(SELECT ...)||'";'; execute(statement); and it works like a charm. Regards, Brice 2011/10/19 Andreas Kretschmer > You can't do that in THAT way, but you can use dynamic SQL: > > test=# select

Re: [SQL] Problem with DROP ROLE

2011-10-19 Thread Guillaume Lelarge
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 tab

[SQL] Problem with DROP ROLE

2011-10-19 Thread Brice André
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 RO