Re: problem with automatic altering of groups

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "Matthias Nagl" <mnagl(at)web(dot)de>, pgsql-sql(at)postgresql(dot)org
Subject: Re: problem with automatic altering of groups
Date: 2003-08-20 21:32:56
Message-ID: 200308201432.56634.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Matthias,

> I don't understand why this function ist refused by postgresql with an parse
error at the first $1 as ist every
> other method I tryed to get postgres making an "alter group" with a
variable. I'd be very happy if someone
> could help...

You can't substitute variables for object names. If you need to construct
dynamic query strings, use PL/pgSQL and EXECUTE:

sql_qry := ''ALTER GROUP '' || $group || '' ADD USER '' || $user;
EXECUTE sql_query;

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2003-08-20 21:55:17 Re: "SELECT IN" Still Broken in 7.4b
Previous Message George McQuade 2003-08-20 21:28:54 Re: Table conversion query...