From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: sad <sad@bankir.ru>
Cc: pgsql-sql@postgresql.org
Subject: Re: [BUGS] session variable
Date: Wed, 3 Sep 2003 16:42:48 -0400 (EDT)
Message-ID: <200309032042.h83KgmJ24665@candle.pha.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.44.0309031940040.1035-100000@peter.localdomain>
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@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: pgman@candle.pha.pa.us, peter_e@gmx.net, sad@bankir.ru
Subject: Re: [BUGS] session variable
In-Reply-To: <200309032042.h83KgmJ24665@candle.pha.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox