Re: Changing user

Lists: Postg스포츠 토토 결과SQL
From: "C G" <csgcsg39(at)hotmail(dot)com>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Changing user
Date: 2003-12-16 10:12:35
Message-ID: Law12-F85UelSWeVyVY00043f44@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Thanks for your help but I still have a small problem. I'm try to do as you
suggested and use prepare/execute but I'm doing something silly.

I'm using:

PREPARE my_prep1(name) AS SET SESSION AUTHORIZATION $1;

and get the error message:
ERROR: syntax error at or near "set" at character 27

I have tried many variations on this theme but have no luck. Suggestions?

Thanks

Colin

>"C G" <csgcsg39(at)hotmail(dot)com> writes:
> > SET SESSION AUTHORIZATION username;
> > ERROR: syntax error at or near "$1" at character 28
>
>You'll need to use EXECUTE to do this. Utility statements in general
>aren't prepared to deal with parameters.
>
> regards, tom lane

_________________________________________________________________
Express yourself with cool emoticons - download MSN Messenger today!
http://www.msn.co.uk/messenger


From: Richard Huxton <dev(at)archonet(dot)com>
To: "C G" <csgcsg39(at)hotmail(dot)com>, tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Changing user
Date: 2003-12-16 10:54:25
Message-ID: 200312161054.25639.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg스포츠 토토 결과SQL

On Tuesday 16 December 2003 10:12, C G wrote:
> Thanks for your help but I still have a small problem. I'm try to do as you
> suggested and use prepare/execute but I'm doing something silly.
>
> I'm using:
>
> PREPARE my_prep1(name) AS SET SESSION AUTHORIZATION $1;
>
> and get the error message:
> ERROR: syntax error at or near "set" at character 27

You want EXECUTE. Something like:

DECLARE
set_qty text;
...
set_qry := ''SET SESSION AUTHORIZATION '' || $1;
EXECUTE set_qry;

--
Richard Huxton
Archonet Ltd