mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
mysql_prepare_create_table: Extract a Key initialization part that relates to length calculation and long unique index designation. append_system_key_parts call also moves there. Move this initialization before the duplicate elimination. Extract WITHOUT OVERPLAPS check into a separate function. It had to be moved earlier in the code to preserve the order of the error checks, as in the tests.
54 lines
2.8 KiB
Plaintext
54 lines
2.8 KiB
Plaintext
SET @old_binlog_format= @@global.binlog_format;
|
|
INSTALL PLUGIN example SONAME 'ha_example';
|
|
################################################################################
|
|
# Verifies if ER_BINLOG_STMT_MODE_AND_ROW_ENGINE happens by setting the binlog
|
|
# format to STATEMENT and the transaction isolation level to READ COMMITTED as
|
|
# such changes force Innodb to accept changes in the row format.
|
|
#
|
|
# When CREATE TABLE, ALTER TABLE, CREATE INDEX and CREATE TRIGGER are executed
|
|
# any error should be triggered.
|
|
#
|
|
# In contrast, CREATE TABLE ... SELECT should trigger the following error:
|
|
# ER_BINLOG_STMT_MODE_AND_ROW_ENGINE.
|
|
################################################################################
|
|
SET binlog_format = STATEMENT;
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
|
CREATE TABLE t_row (a VARCHAR(100)) ENGINE = InnoDB;
|
|
ALTER TABLE t_row ADD COLUMN b INT;
|
|
CREATE TRIGGER trig_row BEFORE INSERT ON t_row FOR EACH ROW INSERT INTO t_stmt VALUES (1);
|
|
CREATE INDEX i ON t_row(a);
|
|
CREATE TABLE t_row_new ENGINE = InnoDB SELECT * FROM t_row;
|
|
ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging.
|
|
DROP TABLE t_row;
|
|
|
|
|
|
################################################################################
|
|
# Verifies if ER_BINLOG_ROW_MODE_AND_STMT_ENGINE happens by setting the binlog
|
|
# format to ROW and using a engine, i.e. EXAMPLE, that only supports STATEMENT.
|
|
#
|
|
# When CREATE TABLE, ALTER TABLE, CREATE INDEX and CREATE TRIGGER are executed
|
|
# the error ER_BINLOG_ROW_MODE_AND_STMT_ENGINE is not triggered. Note that other
|
|
# errors are triggered due to restrictions in the engine.
|
|
#
|
|
# In contrast, CREATE TABLE ... SELECT should trigger the following error:
|
|
# ER_BINLOG_ROW_MODE_AND_STMT_ENGINE.
|
|
################################################################################
|
|
SET binlog_format = ROW;
|
|
CREATE TABLE t_stmt (a VARCHAR(100)) ENGINE = EXAMPLE;
|
|
ALTER TABLE t_stmt ADD COLUMN b INT;
|
|
CREATE TRIGGER trig_stmt BEFORE INSERT ON t_stmt FOR EACH ROW INSERT INTO t_stmt VALUES (1);
|
|
CREATE INDEX i ON t_stmt(a);
|
|
ERROR 42000: Specified key was too long; max key length is 0 bytes
|
|
CREATE TABLE t_stmt_new ENGINE = EXAMPLE SELECT * FROM t_stmt;
|
|
ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging
|
|
DROP TABLE t_stmt;
|
|
|
|
|
|
################################################################################
|
|
# CLEAN UP #
|
|
################################################################################
|
|
flush tables;
|
|
UNINSTALL PLUGIN example;
|
|
SET @@global.binlog_format = @old_binlog_format;
|
|
SET @@session.binlog_format = @old_binlog_format;
|