Commit 21465411 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

Merge branch '10.6' into 10.9

parents 998edc37 4bc9d50f
......@@ -78,5 +78,24 @@ drop table if exists t2, t1;
Warnings:
Note 1051 Unknown table 'test.t2'
#
# MDEV-31853 Assertion failure in Column_definition::check_vcol_for_key upon adding FK
#
create table t (a int, b int, c int generated always as (a), key(b), key(c));
alter table t add foreign key (a) references t (b) on update set null, algorithm=nocopy;
ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPY
alter table t add foreign key (a) references t (b);
show create table t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL,
KEY `b` (`b`),
KEY `c` (`c`),
KEY `a` (`a`),
CONSTRAINT `t_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t;
#
# End of 10.5 tests
#
......@@ -73,6 +73,9 @@ t1 CREATE TABLE `t1` (
`a` char(5) DEFAULT NULL,
`v` varchar(5) GENERATED ALWAYS AS (`a`) STORED
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
SELECT * FROM t1;
a v
1 1
......@@ -86,6 +89,9 @@ a v
1 1
2 2
3 3
Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
DROP TABLE t1;
#
# Fixing a Maria-10.2.26 table with a stored VARCHAR column
......@@ -201,6 +207,9 @@ a v
1 1
2 2
3 3
Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
DROP TABLE t1;
#
# Fixing a Maria-10.2.26 table with a virtual VARCHAR column
......
......@@ -100,6 +100,16 @@ create or replace table t2 (id int, id2 int as (id) virtual, check (id2), foreig
drop table if exists t2, t1;
--echo #
--echo # MDEV-31853 Assertion failure in Column_definition::check_vcol_for_key upon adding FK
--echo #
create table t (a int, b int, c int generated always as (a), key(b), key(c));
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t add foreign key (a) references t (b) on update set null, algorithm=nocopy;
alter table t add foreign key (a) references t (b);
show create table t;
drop table t;
--echo #
--echo # End of 10.5 tests
--echo #
......@@ -258,6 +258,13 @@ Alter_info::algorithm(const THD *thd) const
uint Alter_info::check_vcol_field(Item_field *item) const
{
/*
vcol->flags are modified in-place, so we'll need to reset them
if ALTER fails for any reason
*/
if (item->field && !item->field->table->needs_reopen())
item->field->table->mark_table_for_reopen();
if (!item->field &&
((item->db_name.length && !db.streq(item->db_name)) ||
(item->table_name.length && !table_name.streq(item->table_name))))
......
......@@ -4963,6 +4963,17 @@ int ha_mroonga::wrapper_close()
MRN_DBUG_ENTER_METHOD();
MRN_SET_WRAP_SHARE_KEY(share, table->s);
MRN_SET_WRAP_TABLE_KEY(this, table);
#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER
if (alter_key_info_buffer) {
my_free(alter_key_info_buffer);
alter_key_info_buffer = NULL;
}
#else
if (wrap_alter_key_info) {
my_free(wrap_alter_key_info);
wrap_alter_key_info = NULL;
}
#endif
#ifdef MRN_HANDLER_HAVE_HA_CLOSE
error = wrap_handler->ha_close();
#else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment