Re: Drop temporary table only if it exists - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Drop temporary table only if it exists
Date
Msg-id 200302140948.15889.josh@agliodbs.com
Whole thread Raw
In response to Drop temporary table only if it exists  (Mintoo Lall <tlqmail@yahoo.com>)
Responses Re: Drop temporary table only if it exists
Re: Drop temporary table only if it exists
List pgsql-sql
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 any
> errors

A quick check for existance:
SELECT * FROM pg_class WHERE relname = 'name_of_temp_table' and relkind = ?

You'll want to look in the docs about the PG system tables to see what
"relkind" you should test on for each type of object.

--
Josh Berkus
Aglio Database Solutions
San Francisco


pgsql-sql by date:

Previous
From: Jeff Boes
Date:
Subject: Timezone conversion
Next
From: Stephan Szabo
Date:
Subject: Re: Timezone conversion