Changing user

From: "C G" <csgcsg39(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Changing user
Date: 2003-12-15 17:47:34
Message-ID: LAW12-F93Ks8TAGUjGn00009220@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear All,

I have a simple table
CREATE TABLE table1{
user name,
si numeric
};

Also I have function:
CREATE FUNCTION check1(numeric) RETURN text AS'
DECLARE
SI ALIAS AS $1;
username name;

BEGIN
username:=(SELECT user FROM table1 WHERE si=SI)
SET SESSION AUTHORIZATION username;
RETURN username;
END;
'LANGUAGE 'plpgsql';

However, when I call the function I get the error:
ERROR: syntax error at or near "$1" at character 28
CONTEXT: PL/pgSQL function "check1" line11 at SQL statement

If I comment out the "SET SESSION ..." the function works, i.e. it outputs a
valid username. I create and execute the function as a superuser.

Any suggestions?

Many thanks

Colin

_________________________________________________________________
Hotmail messages direct to your mobile phone http://www.msn.co.uk/msnmobile

Responses

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-12-15 17:48:43 Re: PostgreSQL on Windows Server 2003
Previous Message Arjen van der Meijden 2003-12-15 17:39:39 Re: LIMIT modifier