Skip to content

Commit f76a1df

Browse files
committed
MDEV-21127 Assertion failed in key_text::key_text
Wrong condition for corner values.
1 parent cdc2508 commit f76a1df

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

mysql-test/suite/innodb/r/innodb-fk.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,10 @@ b char(255),
199199
FOREIGN KEY ( a012345678901234567890123456789012345678901, b ) REFERENCES tx (ax, bx)
200200
) ENGINE=InnoDB;
201201
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
202+
CREATE TABLE t1 (
203+
a012345678901234567 int,
204+
b int,
205+
c0123456789012345678 int,
206+
FOREIGN KEY (a012345678901234567,c0123456789012345678,b) REFERENCES tx (x1,x2,x3)
207+
) ENGINE=InnoDB;
208+
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")

mysql-test/suite/innodb/t/innodb-fk.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,11 @@ CREATE TABLE t1 (
236236
b char(255),
237237
FOREIGN KEY ( a012345678901234567890123456789012345678901, b ) REFERENCES tx (ax, bx)
238238
) ENGINE=InnoDB;
239+
240+
--error ER_CANT_CREATE_TABLE
241+
CREATE TABLE t1 (
242+
a012345678901234567 int,
243+
b int,
244+
c0123456789012345678 int,
245+
FOREIGN KEY (a012345678901234567,c0123456789012345678,b) REFERENCES tx (x1,x2,x3)
246+
) ENGINE=InnoDB;

storage/innobase/handler/ha_innodb.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12118,7 +12118,7 @@ class key_text
1211812118
*(ptr++) = ' ';
1211912119
}
1212012120
} else {
12121-
ut_ad((size_t)(ptr - buf) < MAX_TEXT - 4);
12121+
ut_ad((size_t)(ptr - buf) <= MAX_TEXT - 4);
1212212122
memcpy(ptr, "...", 3);
1212312123
ptr += 3;
1212412124
break;

0 commit comments

Comments
 (0)