Changing user - Mailing list pgsql-general

From C G
Subject Changing user
Date
Msg-id LAW12-F93Ks8TAGUjGn00009220@hotmail.com
Whole thread Raw
Responses Re: Changing user
List 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


pgsql-general by date:

Previous
From: Arjen van der Meijden
Date:
Subject: Re: LIMIT modifier
Next
From: "James Moe"
Date:
Subject: Re: Any commercial shopping cart packages using postgresql?