mariadb/mysql-test/suite/galera/r/galera_fk_truncate.result
Jan Lindström d3b35598fc MDEV-26053 : TRUNCATE on table with Foreign Key Constraint no longer replicated to other nodes
Problem was that there was extra condition !thd->lex->no_write_to_binlog
before call to begin TOI. It seems that this variable is not initialized.
TRUNCATE does not support [NO_WRITE_TO_BINLOG | LOCAL] keywords, thus
we should not check this condition. All this was hidden in a macro,
so I decided to remove those macros that were used only a few places
with actual function calls.
2021-09-17 07:18:37 +03:00

47 lines
1.2 KiB
Text

connection node_2;
connection node_1;
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());
TRUNCATE TABLE book;
SELECT * FROM author;
id name
1 Abdul Alhazred
SELECT * FROM book;
id title author_id
connection node_2;
SELECT * FROM author;
id name
1 Abdul Alhazred
SELECT * FROM book;
id title author_id
INSERT INTO author (name) VALUES ('Abdul Alhazred');
INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID());
TRUNCATE TABLE book;
SELECT * FROM author;
id name
1 Abdul Alhazred
2 Abdul Alhazred
SELECT * FROM book;
id title author_id
connection node_1;
TRUNCATE TABLE book;
SELECT * FROM author;
id name
1 Abdul Alhazred
2 Abdul Alhazred
SELECT * FROM book;
id title author_id
DROP TABLE book, author;