Re: Proposal: TRUNCATE TABLE table RESTRICT

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: dhogaza(at)pacifier(dot)com
Cc: t-ishii(at)sra(dot)co(dot)jp, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal: TRUNCATE TABLE table RESTRICT
Date: 2000-06-09 01:07:16
Message-ID: 20000609100716R.t-ishii@sra.co.jp
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.
>
> Shouldn't it always fail if an explicit foreign key reference
> exists to the table, in much the way that delete of a referenced
> row does? If it doesn't now, I think it's a bug.

That would be better. I am just wondering how the checkings hurt the
speed of TRUNCATE (if TRUNCATE is that slow, why we need it:-).

> If the references are implicit (no REFERENCE or FOREIGN KEY given
> to inform the db of the relationship) then a RESTRICT option to
> truncate does seem useful.

Can you tell me what are the implicit references?

BTW, what do you think about DROP TABLE RESTRICT? I think this is a
nice feature and should be added to the TODO list...
--
Tatsuo IShii

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2000-06-09 02:03:11 RE: Sigh, LIKE indexing is *still* broken in foreign locales
Previous Message Peter Eisentraut 2000-06-09 00:57:56 Re: [HACKERS] Sigh, LIKE indexing is *still* broken in foreign locales