Re: A conditional DROP TABLE function

Поиск
Список
Период
Сортировка
От Tino Wildenhain
Тема Re: A conditional DROP TABLE function
Дата
Msg-id 3F89785D.7050807@wildenhain.de
обсуждение исходный текст
Ответ на A conditional DROP TABLE function  (David Link <dvlink@yahoo.com>)
Ответы Re: A conditional DROP TABLE function
Список pgsql-general
Hi David,

David Link wrote:
> Hi All,
>
> Here's a Conditional drop_table func for those interested.  There was a
> thread on this a long time back.
>
> We do this all the time :
>
>   DELETE TABLE sales;
>   CREATE TABLE sales (...);
>
Hm. "all the time" enables all the warning lights -
what are you doing to have to delete and create
the tables every time?

> But nobody likes
>
>   ERROR:  table "sales" does not exist
>
> which we see all the time in the logs.  I want to show the logs to none
> db folk -- so we can't have those error messages in it.

grep -v "ERROR" should do it.

>
> (There must be some explaination why postgresql (and Oracle as well) do
> not have CREATE OR REPLACE TABLE as it does for VIEWs, and FUNCTIONs.
> Anybody know?)

Nobody needs this?
There is:

1) delete from table;
2) truncate table;

to remove all the data

3) alter table ...

to change tables layout.

HTH
Tino Wildenhain


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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Redhat RPMs (Was: Debian experimental packages
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Temporary tables and miscellaneous schemas