Re: Proposal: TRUNCATE TABLE table RESTRICT

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal: TRUNCATE TABLE table RESTRICT
Date: 2000-10-03 03:21:28
Message-ID: 200010030321.XAA04612@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Can someone comment on this?

> It seems the truncate command deletes all rows from a table even it is
> referenced by another tables. TRUNCATE is not in the standard any way,
> so I would not claim this is a bug. However, sometimes it would be
> helpful for a user to let him notice that the table about to be
> truncated is referenced by some tables. So I would propose to add
> "RESTRICT" option to the command. I mean if RESTRICT is specified,
> TRUNCATE will fail if the table is referenced.
>
> BTW, the keyword "RESTRICT" is inspired by the fact that DROP TABLE
> has the same option according to the standard. If a table is
> referenced by some tables and the drop table command has the RESTRICT
> option, it would fail. This seems to be a nice feature too.
>
> Comments?
> --
> Tatsuo Ishii
>

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-10-03 03:21:50 Re: Bit strings
Previous Message Alfred Perlstein 2000-10-02 22:17:12 more crashes