pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mintoo Lall <tlqmail@yahoo.com>
To: Josh Berkus <josh@agliodbs.com>
To: pgsql-sql@postgresql.org
Subject: Re: Drop temporary table only if it exists
Date: Fri, 14 Feb 2003 10:12:14 -0800 (PST)
Message-ID: <20030214181214.75346.qmail@web14802.mail.yahoo.com> (raw)
In-Reply-To: <200302140948.15889.josh@agliodbs.com>


Thanks
 Josh Berkus <josh@agliodbs.com> wrote: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


---------------------------------
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day

view thread (8+ messages)  latest in thread

Message-ID: <20030214181214.75346.qmail@web14802.mail.yahoo.com>
Permalink:  ../20030214181214.75346.qmail@web14802.mail.yahoo.com/
Also on:    postgresql.org/message-id/20030214181214.75346.qmail@web14802.mail.yahoo.com

 · 

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: tlqmail@yahoo.com, josh@agliodbs.com
  Subject: Re: Drop temporary table only if it exists
  In-Reply-To: <20030214181214.75346.qmail@web14802.mail.yahoo.com>

* 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