pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthias Nagl <mnagl@web.de>
To: pgsql-sql@postgresql.org
Subject: problem with automatic altering of groups
Date: Wed, 20 Aug 2003 23:18:02 +0200
Message-ID: <200308202118.h7KLI2Q08941@mailgate5.cinetic.de> (raw)

"Matthias Nagl" <mnagl@web.de> schrieb am 20.08.03 23:09:03: 
Hello,  
  
is ist possible to write a function that alters the group of a given user like the following should do in my  
opinion (I'd like to use it in a rule):  
  
CREATE FUNCTION set_group (text, integer) RETURNS text AS '  
	ALTER GROUP userlevel1 DROP USER $1; ALTER GROUP userlevel2 DROP USER $1; ALTER GROUP  
userlevel3 DROP USER $1;  
	ALTER GROUP userlevel4 DROP USER $1; ALTER GROUP userlevel5 DROP USER $1;  
	CASE $2  
		WHEN 5 THEN  
			(ALTER GROUP userlevel5 ADD USER $1)  
		WHEN 4 THEN  
			(ALTER GROUP userlevel5 ADD USER $1; ALTER GROUP userlevel4 ADD USER $1;)  
		[...]  
	END;  
	SELECT '';  
' LANGUAGE 'SQL';  
  
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...  
  
yours  
  
Matthias Nagl  
 
__________________________________________________________________________
Die sicherste Form der Kommunikation: E-Mails verschluesseln, Spam-Filter,
Adressverifizierung, digitale Unterschrift: http://freemail.web.de




view thread (3+ messages)  latest in thread

Message-ID: <200308202118.h7KLI2Q08941@mailgate5.cinetic.de>
Permalink:  ../200308202118.h7KLI2Q08941@mailgate5.cinetic.de/
Also on:    postgresql.org/message-id/200308202118.h7KLI2Q08941@mailgate5.cinetic.de

 · 

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: mnagl@web.de
  Subject: Re: problem with automatic altering of groups
  In-Reply-To: <200308202118.h7KLI2Q08941@mailgate5.cinetic.de>

* 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