Skip site navigation (1) Skip section navigation (2)

Temporary Table Problem

From: "Dinesh Parikh" <dineshp(at)newgen(dot)co(dot)in>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Temporary Table Problem
Date: 2001-09-28 10:46:09
Message-ID: 003601c1480a$c8b2abf0$f005a8c0@dinesh (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-novice
Dear all,
I have a strange problem.Document says that one can create a temporary table in a session. I had created a temporary table in languge plpgsql.(Actually in a procedure). After completing my task I droped a table within a seesion(In same Function). Now problem arises. When I again calles that stored procedure (Function) then it says relation does not exist . What may be the cause of that problem. It is urgent. I need ed thi function as internal function so it called again and again.

I had attached Code as well as error.

I am Using RedHat 7.1, Postgresql 7.1.2

Thanks
Dinesh Parikh
NSTL, New Delhi
 

Function code.
Drop Function TestTempTable()
Create Function TestTempTable()
Returns Int4 As '
Declare
    DBFirst    Int4;
    DBRec      Record;
Begin
    Create Temporary Table Dual(FirstCol Int4);
    Insert Into Dual Values(12);     
    Insert Into Dual Values(13);     
    Insert Into Dual Values(14);     
    For DBRec In
        Select FirstCol From Dual
    Loop
        Raise Notice ''Column Value = %'',DBRec.FirstCol;
    End Loop;
    Drop Table Dual;
    Return 0;
End;
'language 'plpgsql';

Error Appeared. 

When First time run

Jurassik=# select TestTempTable();
NOTICE:  Column Value = 12
NOTICE:  Column Value = 13
NOTICE:  Column Value = 14
 testtemptable
---------------
             0
(1 row)

When Second time run

Jurassik=# select TestTempTable();
ERROR:  Relation 161414 does not exist


Responses

pgsql-novice by date

Next:From: Dinesh ParikhDate: 2001-09-28 10:47:47
Subject: Dynamic Query problem
Previous:From: richard leotardDate: 2001-09-28 10:18:49
Subject: functionss

pgsql-general by date

Next:From: Dinesh ParikhDate: 2001-09-28 10:47:47
Subject: Dynamic Query problem
Previous:From: Bence SzaboDate: 2001-09-28 10:28:44
Subject: TEST DATA GENERATION

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group