mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
MDEV-21792 Server aborts upon attempt to create foreign key on spatial field
- mbmaxlen is always 0 for binary field. Ignore the assert of checking field->prefix_len % field->col->mbmaxlen == 0.
This commit is contained in:
@@ -522,3 +522,7 @@ test.t1 check status OK
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
|
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
|
||||||
# End of 10.2 tests
|
# End of 10.2 tests
|
||||||
|
CREATE TABLE t1 (a GEOMETRY, INDEX(a(8)),
|
||||||
|
FOREIGN KEY (a) REFERENCES x (xx)) ENGINE=InnoDB;
|
||||||
|
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
|
# End of 10.4 tests
|
||||||
|
@@ -498,4 +498,12 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
|
|||||||
|
|
||||||
--echo # End of 10.2 tests
|
--echo # End of 10.2 tests
|
||||||
|
|
||||||
|
# MDEV-21792 Server aborts upon attempt to create foreign key on spatial field
|
||||||
|
# Fail to create foreign key for spatial fields
|
||||||
|
--error ER_CANT_CREATE_TABLE
|
||||||
|
CREATE TABLE t1 (a GEOMETRY, INDEX(a(8)),
|
||||||
|
FOREIGN KEY (a) REFERENCES x (xx)) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- echo # End of 10.4 tests
|
||||||
|
|
||||||
--source include/wait_until_count_sessions.inc
|
--source include/wait_until_count_sessions.inc
|
||||||
|
@@ -1839,7 +1839,8 @@ dict_index_add_to_cache(
|
|||||||
> field->col->max_prefix) {
|
> field->col->max_prefix) {
|
||||||
/* Set the max_prefix value based on the
|
/* Set the max_prefix value based on the
|
||||||
prefix_len. */
|
prefix_len. */
|
||||||
ut_ad(field->prefix_len % field->col->mbmaxlen == 0);
|
ut_ad(field->col->is_binary()
|
||||||
|
|| field->prefix_len % field->col->mbmaxlen == 0);
|
||||||
field->col->max_prefix = field->prefix_len;
|
field->col->max_prefix = field->prefix_len;
|
||||||
}
|
}
|
||||||
ut_ad(field->col->ord_part == 1);
|
ut_ad(field->col->ord_part == 1);
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2012, Facebook Inc.
|
Copyright (c) 2012, Facebook Inc.
|
||||||
Copyright (c) 2013, 2019, MariaDB Corporation.
|
Copyright (c) 2013, 2020, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU General Public License as published by the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
@@ -733,6 +733,9 @@ public:
|
|||||||
| CHAR_COLL_MASK << 16
|
| CHAR_COLL_MASK << 16
|
||||||
| DATA_LONG_TRUE_VARCHAR));
|
| DATA_LONG_TRUE_VARCHAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return whether the column values are comparable by memcmp() */
|
||||||
|
inline bool is_binary() const { return prtype & DATA_BINARY_TYPE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Index information put in a list of virtual column structure. Index
|
/** Index information put in a list of virtual column structure. Index
|
||||||
|
Reference in New Issue
Block a user