Re: bug in PLPGSQL - Mailing list pgsql-hackers

From Kovacs Zoltan
Subject Re: bug in PLPGSQL
Date
Msg-id Pine.LNX.4.21.0105141148540.1153-100000@pc10.radnoti-szeged.sulinet.hu
Whole thread Raw
In response to Re: \c connects as another user instead I want in psql  (Jan Wieck <JanWieck@Yahoo.com>)
Responses Re: Re: bug in PLPGSQL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
There are SELECT INTO statements which work properly. Here is an example
which closes the backend:

CREATE FUNCTION plpgsql_call_handler ( ) RETURNS opaque AS '/usr/local/pgsql-7.1.1/lib/plpgsql.so' LANGUAGE 'C';
CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL';

create table foo(x int4, y int4);

create function bugtest(int4) returns int4 as '
declare   _x int4;   _y int4;
begin   select into _x,_y    x, y from foo where x = $1 limit 1;   return x;
end;
' language 'plpgsql';

select bugtest(5);

If the WHERE clause doesn't contain any input parameters (i.e. $1), I
don't get into any trouble.

Zoltan

--                         Kov\'acs, Zolt\'an                        kovacsz@pc10.radnoti-szeged.sulinet.hu
          http://www.math.u-szeged.hu/~kovzol                        ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz
 



pgsql-hackers by date:

Previous
From: Hiroshi Inoue
Date:
Subject: Re: bug in PLPGSQL
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Updating system catalogs after a tuple deletion