From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | sad <sad(at)bankir(dot)ru>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: [BUGS] session variable |
Date: | 2003-09-03 20:42:48 |
Message-ID: | 200309032042.h83KgmJ24665@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-sql |
Peter Eisentraut wrote:
> sad writes:
>
> > The first problem using temp table is:
> >
> > CREATE TABLE locals (name text, value text);
> >
> > CREATE OR REPLACE FUNCTION test_locals_access() RETURNS text AS '
> > DECLARE i text;
> > BEGIN
> > SELECT value INTO i FROM locals WHERE name=''n1''
> > RETURN i;
> > END;
> > ' LANGUAGE 'plpgsql';
> >
> > SELECT test_locals_access() ;
> >
> > column
> > -------------
> > <null>
> >
> > CREATE TEMP TABLE locals (name text, value text);
> > INSERT INTO locals VALUES ('n1','xxx');
> >
> > SELECT test_locals_access() ;
> >
> > column
> > -------------
> > <null> <=== the Function seing global table
>
> This is a problem in plpgsql, not in temporary tables.
Yes, see the FAQ. You have to use EXECUTE for temp table access in
functions.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2003-09-03 22:54:13 | Re: PgSQL74b2: initdb fails (max_connections) |
Previous Message | Tom Lane | 2003-09-03 19:06:23 | Re: 7.3: [BUGS] to_timestamp not stable if date string shorter than |
From | Date | Subject | |
---|---|---|---|
Next Message | Yaroslav Ulyanov | 2003-09-04 07:46:43 | Help me |
Previous Message | Bruce Momjian | 2003-09-03 17:55:03 | Re: session variable |