From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Don Baccus <dhogaza(at)pacifier(dot)com> |
Cc: | Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Proposal: TRUNCATE TABLE table RESTRICT |
Date: | 2000-10-09 19:41:10 |
Message-ID: | 200010091941.PAA14727@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> At 09:24 PM 6/8/00 +0900, Tatsuo Ishii wrote:
> >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.
>
> 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.
TODO updated:
* Prevent truncate on table with a referential integrity trigger (RESTRICT)
--
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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2000-10-09 19:47:57 | Re: Syslog and pg_options (for RPMs) |
Previous Message | Lamar Owen | 2000-10-09 19:24:50 | Re: backup and restore |