Re: using 'ALTER ROLE' in a function

From: Douglas McNaught <doug(at)mcnaught(dot)org>
To: Lutz Broedel <lb(at)fggm(dot)uni-hannover(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: using 'ALTER ROLE' in a function
Date: 2007-03-22 15:33:18
Message-ID: 878xdpz41t.fsf@suzuka.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Lutz Broedel <lb(at)fggm(dot)uni-hannover(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andy Dale 2007-03-22 15:45:17 Re: xpath_list() function
Previous Message Tom Lane 2007-03-22 15:31:12 Re: Dealing with table names in functions