pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Matthias Nagl <mnagl@web.de>
To: pgsql-sql@postgresql.org
Subject: Re: problem with automatic altering of groups
Date: Wed, 20 Aug 2003 14:32:56 -0700
Message-ID: <200308201432.56634.josh@agliodbs.com> (raw)
In-Reply-To: <200308202118.h7KLI2Q08941@mailgate5.cinetic.de>
References: <200308202118.h7KLI2Q08941@mailgate5.cinetic.de>

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




view thread (3+ messages)

Message-ID: <200308201432.56634.josh@agliodbs.com>
Permalink:  ../200308201432.56634.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200308201432.56634.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, mnagl@web.de
  Subject: Re: problem with automatic altering of groups
  In-Reply-To: <200308201432.56634.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox