X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 770CFD1B8F7 for ; Wed, 20 Aug 2003 18:09:18 -0300 (ADT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 05324-04 for ; Wed, 20 Aug 2003 18:09:09 -0300 (ADT) Received: from mailgate5.cinetic.de (mailgate5.cinetic.de [217.72.192.165]) by svr1.postgresql.org (Postfix) with ESMTP id B043BD1B921 for ; Wed, 20 Aug 2003 18:09:06 -0300 (ADT) Received: from web.de (fmomail01.dlan.cinetic.de [172.20.1.45]) by mailgate5.cinetic.de (8.11.6p2/8.11.2/SuSE Linux 8.11.0-0.4) with SMTP id h7KL98Q30820 for pgsql-sql@postgresql.org; Wed, 20 Aug 2003 23:09:08 +0200 Date: Wed, 20 Aug 2003 23:09:08 +0200 Message-Id: <200308202109.h7KL98Q30820@mailgate5.cinetic.de> MIME-Version: 1.0 Organization: http://freemail.web.de/ From: "Matthias Nagl" To: pgsql-sql@postgresql.org Subject: problem with automatic altering of groups Precedence: fm-user Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/251 X-Sequence-Number: 14867 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