AW: Proposal: TRUNCATE TABLE table RESTRICT

From: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
To: "'Tatsuo Ishii'" <t-ishii(at)sra(dot)co(dot)jp>, "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: AW: Proposal: TRUNCATE TABLE table RESTRICT
Date: 2000-06-08 14:29:24
Message-ID: 219F68D65015D011A8E000006F8590C604AF7DCD@sdexcsrv1.f000.d0188.sd.spardat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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.

Truncate should probably check if all referencing tables are empty
and fail if not. Truncate should imho not lead to a violated constraint
situation.
Strictly speaking the current situation is more or less a bug.

Andreas

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-06-08 14:32:48 Re: Strange message in logs..
Previous Message Tom Lane 2000-06-08 14:20:11 Re: DROP COLUMN status