Spracherkennung für: .test vermutete Sprache: SQL {SQL[124] VDM[62] Masm[60]} [Methode: maximale Elemente, drei Dimensionen]
################################################################################
# Regression tests for parse_signedness() in log_event.cc.
#
# The old implementation (upstream) pushed all bits from every byte into a flat
# vector without regard to column type. The new implementation iterates over
# column metadata and only consumes a bit for columns where is_numeric_type()
# returns true, skipping non-numeric columns.
#
# Tests focus on:
# 1. YEAR is treated as a numeric type and always shown UNSIGNED.
# 2. Non-numeric columns interspersed between numeric columns do not consume
# a signedness bit, so the second numeric column reads the correct bit.
# 3. Correct behavior at byte boundaries when non-numeric columns appear
# between the 8th and 9th numeric column.
################################################################################
--source include/have_binlog_format_row.inc
--source include/test_db_charset_latin1.inc
RESET MASTER;
SET @old_metadata= @@GLOBAL.binlog_row_metadata;
SET GLOBAL binlog_row_metadata = FULL;
--let $MYSQLD_DATADIR= `select @@datadir`
--let $binlog_file= $MYSQLD_DATADIR/master-bin.000001
--echo #
--echo # Test 1: Non-numeric column between two numeric columns does not
--echo # consume a signedness bit (signed INT, CHAR, unsigned INT)
--echo #
CREATE TABLE t1(c_signed INT, c_char CHAR(10), c_unsigned INT UNSIGNED);
INSERT INTO t1 VALUES(-1, 'x', 1);
--source suite/binlog/include/print_optional_metadata.inc
DROP TABLE t1;
RESET MASTER;
--echo #
--echo # Test 2: Byte boundary — 8 signed numerics then a non-numeric then an
--echo # unsigned numeric. The non-numeric must not shift the bit
--echo # cursor into the second byte prematurely.
--echo #
CREATE TABLE t1(
c1 TINYINT, c2 TINYINT, c3 TINYINT, c4 TINYINT,
c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT,
c_text TEXT,
c9 TINYINT UNSIGNED);
INSERT INTO t1(c1) VALUES(1);
--source suite/binlog/include/print_optional_metadata.inc
DROP TABLE t1;
RESET MASTER;
--echo #
--echo # Test 3: Multiple non-numeric columns between numeric columns across
--echo # a byte boundary
--echo #
CREATE TABLE t1(
c1 TINYINT UNSIGNED, c2 TINYINT UNSIGNED,
c3 TINYINT UNSIGNED, c4 TINYINT UNSIGNED,
c5 TINYINT UNSIGNED, c6 TINYINT UNSIGNED,
c7 TINYINT UNSIGNED, c8 TINYINT UNSIGNED,
c_blob BLOB, c_varchar VARCHAR(100),
c9 TINYINT, c10 TINYINT UNSIGNED);
INSERT INTO t1(c1) VALUES(1);
--source suite/binlog/include/print_optional_metadata.inc
DROP TABLE t1;
RESET MASTER;
--echo #
--echo # Test 4: YEAR is treated as a numeric type: it always reads as UNSIGNED
--echo # and consumes a signedness bit, so a numeric column following it
--echo # still reads the correct bit (signed INT, YEAR, unsigned INT).
--echo #
CREATE TABLE t1(c_signed INT, c_year YEAR, c_unsigned INT UNSIGNED);
INSERT INTO t1(c_signed) VALUES(-1);
--source suite/binlog/include/print_optional_metadata.inc
DROP TABLE t1;
RESET MASTER;
SET GLOBAL binlog_row_metadata = @old_metadata;
--source include/test_db_charset_restore.inc
[Dauer der Verarbeitung: 0.20 Sekunden, vorverarbeitet 2026-10-08]