X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7F15C475AEC for ; Fri, 14 Feb 2003 12:48:40 -0500 (EST) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id C325E475AD7 for ; Fri, 14 Feb 2003 12:48:39 -0500 (EST) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2840224; Fri, 14 Feb 2003 09:48:52 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Mintoo Lall , pgsql-sql@postgresql.org Subject: Re: Drop temporary table only if it exists Date: Fri, 14 Feb 2003 09:48:15 -0800 User-Agent: KMail/1.4.3 References: <20030214153413.24680.qmail@web14802.mail.yahoo.com> In-Reply-To: <20030214153413.24680.qmail@web14802.mail.yahoo.com> MIME-Version: 1.0 Message-Id: <200302140948.15889.josh@agliodbs.com> Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/338 X-Sequence-Number: 11736 Mintoo, > How do I drop a temporary table ( or for that matter a sequence) only if = it > exists or create them if they donot exist ? I want to do this to avoid a= ny > errors A quick check for existance:=20 SELECT * FROM pg_class WHERE relname =3D 'name_of_temp_table' and relkind = =3D ? You'll want to look in the docs about the PG system tables to see what=20 "relkind" you should test on for each type of object. --=20 Josh Berkus Aglio Database Solutions San Francisco