Re: Conditional test

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Conditional test
Дата
Msg-id 200201031704.g03H4cR15169@candle.pha.pa.us
обсуждение исходный текст
Ответ на Conditional test  (rickd@open-works.com (Rick Dayao))
Список pgsql-sql
Rick Dayao wrote:
> I am trying to solve this problem:
> 
> If a table exists, drop the table, otherwise continue processing.
> 
> For example, if table X exists, then drop table X.  How would I do
> this in SQL?  I can query the pg_tables table to see which tables
> exist, but I'm looking for an If-Else construct in SQL.

You can drop the table and ignore the error if returned.  We will have
CREATE OR REPLACE in 7.2, but no conditional DROP.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


В списке pgsql-sql по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Retrieving information from System Tables
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: How to union tables and have a field with UNIQUE constraint?