pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dinesh Parikh <dineshp@newgen.co.in>
To: pgsql-general@postgresql.org
To: pgsql-sql@postgresql.org
Subject: Check Existence of temporary table in a session.
Date: Sat, 27 Oct 2001 17:07:06 +0530
Message-ID: <000001c160f5$a0da2730$f005a8c0@dinesh> (raw)

Hi All,
I have an strange problem . I am building an application with connection pooling. I had write a stored procedure and called from JDBC. In Procedure i am creating a table (temporary). I want to check if this temporary table already exists then do not create otherwise create it. The following query fails.

Select Into DBExistsFlag 1 
Where Exists (Select * from Pg_Tables Where Upper(Trim(TableName)) = Upper(Trim(''FolderTree'')));
 If Not Found Then
      Create Temp Table FolderTree(FolderId Int8,ParentFolderId Int8,
                    FolderTyp Char(1),Leaf Int4,RightFlag Char(1));
 End If;
 If DBExistsFlag = 1 Then
        Delete From FolderTree;
 End If; 


When I saw the table pgadmin_tables there was entry of table name  pg_temp.232667.2 The columns of this table mached with my temporary table.

My question is that if postgres converts table name to this one then how can i find that temporary table already exists so that irritating mesasage should not come.

Any help/suggesion may be benificial for me.

Thanks

Regards
Dinesh Parikh
NSTL New Delhi

Message-ID: <000001c160f5$a0da2730$f005a8c0@dinesh>
Permalink:  ../000001c160f5$a0da2730$f005a8c0@dinesh/
Also on:    postgresql.org/message-id/000001c160f5$a0da2730$f005a8c0@dinesh

 · 

reply

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: dineshp@newgen.co.in, pgsql-general@postgresql.org
  Subject: Re: Check Existence of temporary table in a session.
  In-Reply-To: <000001c160f5$a0da2730$f005a8c0@dinesh>

* 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