X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7DC66D1DCF7 for ; Wed, 1 Oct 2003 04:06:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 32726-01 for ; Wed, 1 Oct 2003 01:05:40 -0300 (ADT) Received: from web14901.mail.yahoo.com (web14901.mail.yahoo.com [216.136.225.53]) by svr1.postgresql.org (Postfix) with SMTP id 7E428D1D597 for ; Wed, 1 Oct 2003 00:17:41 -0300 (ADT) Message-ID: <20031001031740.66479.qmail@web14901.mail.yahoo.com> Received: from [202.9.168.127] by web14901.mail.yahoo.com via HTTP; Tue, 30 Sep 2003 20:17:40 PDT Date: Tue, 30 Sep 2003 20:17:40 -0700 (PDT) From: "George A.J" Subject: Re: Temporary tables To: pgsql-sql@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1620524479-1064978260=:66186" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/2 X-Sequence-Number: 15402 --0-1620524479-1064978260=:66186 Content-Type: text/plain; charset=us-ascii Thanks to all of you for your suggestions. the problem is solved by creating a function istableexist() that returns whether a table exist or not. the function is bellow. CREATE FUNCTION istableexist(varchar) RETURNS bool AS ' DECLARE BEGIN /* check the table exist in database and is visible*/ PERFORM relname,relnamespace FROM pg_class WHERE relkind = ''r'' AND Upper(relname) = Upper($1) AND pg_table_is_visible(oid); IF FOUND THEN RETURN TRUE; ELSE RETURN FALSE; END IF; END;' LANGUAGE 'plpgsql'; thanks again jinujose --------------------------------- Do you Yahoo!? The New Yahoo! Shopping - with improved product search --0-1620524479-1064978260=:66186 Content-Type: text/html; charset=us-ascii

Thanks to all of you for your suggestions. the problem is solved by creating a function

istableexist() that returns whether a table exist or not. the function is bellow.


CREATE FUNCTION istableexist(varchar) RETURNS bool AS '

 DECLARE

 BEGIN

     /* check the table exist in database and is visible*/
     PERFORM relname,relnamespace FROM pg_class
            WHERE relkind = ''r''
                  AND Upper(relname) = Upper($1)
                  AND pg_table_is_visible(oid);

     IF FOUND THEN
        RETURN TRUE;
     ELSE
        RETURN FALSE;
     END IF;
  
 END;'
 LANGUAGE 'plpgsql';

thanks again

jinujose


Do you Yahoo!?
The New Yahoo! Shopping - with improved product search --0-1620524479-1064978260=:66186--