Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Do
-
None
Description
- Logically TRUNCATE is same as DELETE but currently ON DELETE actions are not executed.
CREATE TABLE author (
|
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
name VARCHAR(100) NOT NULL
|
) ENGINE = InnoDB;
|
CREATE TABLE book (
|
id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
title VARCHAR(200) NOT NULL,
|
author_id SMALLINT UNSIGNED NOT NULL,
|
CONSTRAINT `fk_book_author`
|
FOREIGN KEY (author_id) REFERENCES author (id)
|
ON DELETE CASCADE
|
ON UPDATE RESTRICT
|
) ENGINE = InnoDB;
|
INSERT INTO author (name) VALUES ('Abdul Alhazred');
|
INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID());
|
SELECT * FROM author;
|
id name
|
1 Abdul Alhazred
|
SELECT * FROM book;
|
id title author_id
|
1 Necronomicon 1
|
TRUNCATE TABLE book;
|
SELECT * FROM author;
|
id name
|
1 Abdul Alhazred
|
SELECT * FROM book;
|
id title author_id
|
Attachments
Issue Links
- relates to
-
MDEV-26053 TRUNCATE on table with Foreign Key Constraint no longer replicated to other nodes
- Closed