Re: using 'ALTER ROLE' in a function - Mailing list pgsql-general

From Douglas McNaught
Subject Re: using 'ALTER ROLE' in a function
Date
Msg-id 878xdpz41t.fsf@suzuka.mcnaught.org
Whole thread Raw
In response to using 'ALTER ROLE' in a function  (Lutz Broedel <lb@fggm.uni-hannover.de>)
List pgsql-general
Lutz Broedel <lb@fggm.uni-hannover.de> writes:

> ERROR:  Error »syntax error« at »$1« at character 13
> QUERY:  ALTER ROLE  $1  WITH ENCRYPTED PASSWORD  $2
>
> I have tried this in several ways and it seems, ALTER ROLE just does
> not accept a parameter instead of name. Does anybody have a solution
> for this?

You probably need to build the query dynamically and use EXECUTE.

-Doug

pgsql-general by date:

Previous
From: William Garrison
Date:
Subject: Re: Bug in CREATE/DROP TABLESPACE command
Next
From: "Andy Dale"
Date:
Subject: Re: xpath_list() function