| From: | Tino Wildenhain <tino(at)wildenhain(dot)de> |
|---|---|
| To: | David Link <dvlink(at)yahoo(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: A conditional DROP TABLE function |
| Date: | 2003-10-12 15:50:53 |
| Message-ID: | 3F89785D.7050807@wildenhain.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2003-10-12 16:51:05 | Re: Temporary tables and miscellaneous schemas |
| Previous Message | Martijn van Oosterhout | 2003-10-12 09:32:06 | Re: Redhat RPMs (Was: Debian experimental packages |