1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Merge branch '10.2' into 10.3

This commit is contained in:
Sergei Golubchik
2022-04-21 10:04:04 +02:00
27 changed files with 438 additions and 54 deletions

View File

@@ -78,7 +78,10 @@ sub _gdb {
my ($tmp, $tmp_name) = tempfile();
print $tmp
"bt\n",
"thread apply all bt\n",
"set print sevenbit on\n",
"set print static-members off\n",
"set print frame-arguments all\n",
"thread apply all bt full\n",
"quit\n";
close $tmp or die "Error closing $tmp_name: $!";

View File

@@ -235,3 +235,63 @@ a b
insert t1 (b) values (1);
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
#
# MDEV-25638 Assertion `!result' failed in convert_const_to_int
#
create table t1 (v1 bigint check (v1 not in ('x' , 'x111'))) ;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x111'
select * from t1;
v1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x111'
select v1 from t1;
v1
select * from t1;
v1
prepare stmt from "select * from t1";
execute stmt;
v1
execute stmt;
v1
flush tables;
select * from t1;
v1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x111'
select * from t1;
v1
deallocate prepare stmt;
drop table t1;
#
# MDEV-26061 MariaDB server crash at Field::set_default
#
create table t1 (v2 date check (v1 like default (v1)), v1 date default (from_days ('x')));
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'x'
insert ignore into t1 values ( 'x' , 'x' ) ;
Warnings:
Warning 1265 Data truncated for column 'v2' at row 1
Warning 1265 Data truncated for column 'v1' at row 1
Warning 1292 Truncated incorrect INTEGER value: 'x'
drop table t1;
#
# End of 10.2 tests
#
#
# MDEV-26061 MariaDB server crash at Field::set_default
#
create table t1 (d timestamp check (default (d) is true)) as select 1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() CHECK (default(`d`) is true),
`1` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
#
# End of 10.3 tests
#

View File

@@ -176,3 +176,46 @@ select * from t1 where a is null;
--error ER_CONSTRAINT_FAILED
insert t1 (b) values (1);
drop table t1;
--echo #
--echo # MDEV-25638 Assertion `!result' failed in convert_const_to_int
--echo #
--enable_prepare_warnings
create table t1 (v1 bigint check (v1 not in ('x' , 'x111'))) ;
select * from t1;
select v1 from t1;
select * from t1;
prepare stmt from "select * from t1";
execute stmt;
execute stmt;
flush tables;
select * from t1;
select * from t1;
deallocate prepare stmt;
drop table t1;
--disable_prepare_warnings
--echo #
--echo # MDEV-26061 MariaDB server crash at Field::set_default
--echo #
create table t1 (v2 date check (v1 like default (v1)), v1 date default (from_days ('x')));
insert ignore into t1 values ( 'x' , 'x' ) ;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #
--echo #
--echo # MDEV-26061 MariaDB server crash at Field::set_default
--echo #
create table t1 (d timestamp check (default (d) is true)) as select 1;
show create table t1;
drop table t1;
--echo #
--echo # End of 10.3 tests
--echo #

View File

@@ -3397,6 +3397,15 @@ ERROR 01000: Expression for field `a` is referring to uninitialized field `a`
show warnings;
Level Code Message
Error 4029 Expression for field `a` is referring to uninitialized field `a`
#
# MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
#
CREATE TABLE t1 (pk varchar(36) DEFAULT uuid());
INSERT INTO t1 VALUES (),();
SELECT 1 FROM t1 GROUP BY DEFAULT(pk);
1
1
DROP TABLE t1;
# end of 10.2 test
#
# MDEV-22703 DEFAULT() on a BLOB column can overwrite the default

View File

@@ -2116,6 +2116,15 @@ DROP TABLE t1;
create table t1 (a int as (a));
show warnings;
--echo #
--echo # MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
--echo #
CREATE TABLE t1 (pk varchar(36) DEFAULT uuid());
INSERT INTO t1 VALUES (),();
SELECT 1 FROM t1 GROUP BY DEFAULT(pk);
DROP TABLE t1;
--echo # end of 10.2 test
--echo #

View File

@@ -0,0 +1,18 @@
#
# MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
#
CREATE TABLE v0 (
v2 DATE DEFAULT ( v1 MOD 68321183.000000 ) ,
v1 DATETIME NULL ) engine=innodb;
SHOW DATABASES LIKE 'x';
Database (x)
SELECT DISTINCT v2 , v1 , DEFAULT ( v2 ) FROM v0;
v2 v1 DEFAULT ( v2 )
DROP TABLE v0;
CREATE TABLE t1 (v1 DATE, v2 DATE DEFAULT(v1)) engine=innodb;
SELECT DISTINCT DEFAULT(v2) FROM t1 ;
DEFAULT(v2)
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@@ -0,0 +1,22 @@
--source include/have_innodb.inc
--echo #
--echo # MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
--echo #
CREATE TABLE v0 (
v2 DATE DEFAULT ( v1 MOD 68321183.000000 ) ,
v1 DATETIME NULL ) engine=innodb;
SHOW DATABASES LIKE 'x';
SELECT DISTINCT v2 , v1 , DEFAULT ( v2 ) FROM v0;
DROP TABLE v0;
CREATE TABLE t1 (v1 DATE, v2 DATE DEFAULT(v1)) engine=innodb;
SELECT DISTINCT DEFAULT(v2) FROM t1 ;
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@@ -159,5 +159,48 @@ a
10
DROP TABLE t1;
#
# MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view
#
create table t1 (a datetime default current_timestamp);
insert into t1 () values (),();
create algorithm=temptable view v1 as select * from t1;
create algorithm=merge view v2 as select * from t1;
select default(a) = now() from v1;
default(a) = now()
NULL
NULL
select default(a) = now() from v2;
default(a) = now()
1
1
select table_name,is_updatable from information_schema.views;
table_name is_updatable
v1 NO
v2 YES
drop view v1, v2;
drop table t1;
create table t1 (v1 timestamp) select 'x';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`x` varchar(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select default(v1) from (select v1 from t1) dt;
default(v1)
2001-01-01 10:20:30
select default(v1) from (select v1 from t1 group by v1) dt;
default(v1)
0000-00-00 00:00:00
drop table t1;
create table t1 (a text default '');
create algorithm=temptable view v1 as select * from t1;
insert into t1 values ('a');
select default(a) from v1;
default(a)
NULL
drop view v1;
drop table t1;
#
# End of 10.2 tests
#

View File

@@ -139,6 +139,33 @@ FROM t1;
SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END IS FALSE;
DROP TABLE t1;
--echo #
--echo # MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view
--echo #
create table t1 (a datetime default current_timestamp);
insert into t1 () values (),();
create algorithm=temptable view v1 as select * from t1;
create algorithm=merge view v2 as select * from t1;
select default(a) = now() from v1;
select default(a) = now() from v2;
--sorted_result
select table_name,is_updatable from information_schema.views;
drop view v1, v2;
drop table t1;
create table t1 (v1 timestamp) select 'x';
show create table t1;
select default(v1) from (select v1 from t1) dt;
select default(v1) from (select v1 from t1 group by v1) dt;
drop table t1;
create table t1 (a text default '');
create algorithm=temptable view v1 as select * from t1;
insert into t1 values ('a');
select default(a) from v1;
drop view v1;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@@ -357,4 +357,13 @@ select * from mysql.plugin WHERE name='unexisting_plugin';
name dl
UNINSTALL PLUGIN unexisting_plugin;
ERROR 42000: PLUGIN unexisting_plugin does not exist
#
# MDEV-26323 use-after-poison issue of MariaDB server
#
INSTALL PLUGIN DEALLOCATE SONAME '';
ERROR HY000: Can't open shared library '.so'
INSTALL PLUGIN DEALLOCATE SONAME 'x';
ERROR HY000: Can't open shared library 'x.so'
INSTALL PLUGIN DEALLOCATE SONAME 'xx';
ERROR HY000: Can't open shared library 'xx.so'
# End of 10.2 tests

View File

@@ -296,4 +296,21 @@ select * from mysql.plugin WHERE name='unexisting_plugin';
--error ER_SP_DOES_NOT_EXIST
UNINSTALL PLUGIN unexisting_plugin;
--echo #
--echo # MDEV-26323 use-after-poison issue of MariaDB server
--echo #
--replace_regex /library '.*[\\/].(dll|so)' [(].*[)]/library '.so'/
--error ER_CANT_OPEN_LIBRARY
INSTALL PLUGIN DEALLOCATE SONAME '';
--replace_regex /library '.*[\\/]x.(dll|so)' [(].*[)]/library 'x.so'/
--error ER_CANT_OPEN_LIBRARY
INSTALL PLUGIN DEALLOCATE SONAME 'x';
--replace_regex /library '.*[\\/]xx.(dll|so)' [(].*[)]/library 'xx.so'/
--error ER_CANT_OPEN_LIBRARY
INSTALL PLUGIN DEALLOCATE SONAME 'xx';
--echo # End of 10.2 tests

View File

@@ -137,6 +137,33 @@ SELECT unique_constraint_name FROM information_schema.referential_constraints
WHERE table_name = 't2';
unique_constraint_name
PRIMARY
#
# MDEV-28317 Assertion failure on rollback of FOREIGN KEY operation
#
SET foreign_key_checks=0;
CREATE TABLE parent(a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE child(a INT,FOREIGN KEY(a) REFERENCES parent(a) ON DELETE CASCADE)
ENGINE=InnoDB;
INSERT INTO child VALUES(1);
ALTER TABLE child DROP INDEX a;
connect incomplete, localhost, root,,;
BEGIN;
DELETE FROM child;
connection default;
INSERT INTO parent SET a=0;
FLUSH TABLES;
disconnect incomplete;
INSERT INTO child SET a=0;
INSERT INTO child SET a=1;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE)
DELETE FROM parent;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE)
ALTER TABLE child ADD INDEX(a);
DELETE FROM parent;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE)
ALTER TABLE child FORCE;
DELETE FROM parent;
DROP TABLE child,parent;
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
SELECT unique_constraint_name FROM information_schema.referential_constraints

View File

@@ -102,7 +102,41 @@ INSERT INTO t2 VALUES (1);
SELECT unique_constraint_name FROM information_schema.referential_constraints
WHERE table_name = 't2';
--echo #
--echo # MDEV-28317 Assertion failure on rollback of FOREIGN KEY operation
--echo #
SET foreign_key_checks=0;
CREATE TABLE parent(a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE child(a INT,FOREIGN KEY(a) REFERENCES parent(a) ON DELETE CASCADE)
ENGINE=InnoDB;
INSERT INTO child VALUES(1);
ALTER TABLE child DROP INDEX a;
connect(incomplete, localhost, root,,);
BEGIN;
DELETE FROM child;
connection default;
INSERT INTO parent SET a=0;
FLUSH TABLES;
--let $shutdown_timeout=0
--source include/restart_mysqld.inc
--let $shutdown_timeout=
disconnect incomplete;
INSERT INTO child SET a=0;
--error ER_NO_REFERENCED_ROW_2
INSERT INTO child SET a=1;
--error ER_ROW_IS_REFERENCED_2
DELETE FROM parent;
ALTER TABLE child ADD INDEX(a);
--error ER_ROW_IS_REFERENCED_2
DELETE FROM parent;
ALTER TABLE child FORCE;
DELETE FROM parent;
DROP TABLE child,parent;
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;

View File

@@ -227,7 +227,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) DEFAULT NULL,
`b` bigint(20) GENERATED ALWAYS AS (`a` > '2') VIRTUAL
`b` bigint(20) GENERATED ALWAYS AS (`a` > 2) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 (a) values (1),(3);
select * from t1;
@@ -511,5 +511,25 @@ a b
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# CONTEXT_ANALYSIS_ONLY_VCOL_EXPR
#
create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci,
v1 char(1) character set ucs2 collate ucs2_test_ci as (c1),
v2 int as (c1 = 'b'),
v3 int as (v1 = 'b'));
insert into t1 (c1) values ('a');
select * from t1 where v1 = 'b';
c1 v1 v2 v3
a a 1 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` char(1) CHARACTER SET ucs2 COLLATE ucs2_test_ci DEFAULT NULL,
`v1` char(1) CHARACTER SET ucs2 GENERATED ALWAYS AS (`c1`) VIRTUAL,
`v2` int(11) GENERATED ALWAYS AS (`c1` = 'b') VIRTUAL,
`v3` int(11) GENERATED ALWAYS AS (`v1` = 'b') VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
#
# End of 10.2 tests
#

View File

@@ -183,8 +183,17 @@ select a from t1 order by 'x' = b;
a
drop table t1;
create table t1 (a int , b date as (1 in ('x' ,(database ()) ))) ;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'test'
select b from t1;
b
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'test'
select a from t1 order by 'x' = b;
a
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'test'
drop table t1;

View File

@@ -1,3 +1,6 @@
#
# MDEV-9690 concurrent queries with virtual columns crash in temporal code
#
create table t1 (a datetime,
# get_datetime_value
b int as (a > 1), # Arg_comparator
@@ -59,6 +62,9 @@ a b
Warnings:
Warning 1292 Incorrect datetime value: '1'
drop table t1;
#
# MDEV-13435 Crash when selecting virtual columns generated using JSON functions
#
create table t1 (
id int not null ,
js varchar(1000) not null,
@@ -68,3 +74,16 @@ select * from t1;
id js t
0 {"default" : {"start": "00:00:00", "end":"23:59:50"}} NULL
drop table t1;
#
# MDEV-26281 ASAN use-after-poison when complex conversion is involved in blob
#
create table t1 (v2 blob as ('a' is null), a1 int, a char(1) as (cast(a1 in (0,current_user() is null) as char(16777216) )));
insert ignore into t1 values ('x','x',v2) ;
Warnings:
Warning 1906 The value specified for generated column 'v2' in table 't1' has been ignored
Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`a1` at row 1
Warning 1906 The value specified for generated column 'a' in table 't1' has been ignored
drop table t1;
#
# End of 10.2 tests
#

View File

@@ -0,0 +1 @@
--character-sets-dir=$MYSQL_TEST_DIR/std_data/ldml/

View File

@@ -488,6 +488,21 @@ SELECT * FROM t1;
DROP TABLE t1;
SET sql_mode=DEFAULT;
--echo #
--echo # CONTEXT_ANALYSIS_ONLY_VCOL_EXPR
--echo #
--source include/have_ucs2.inc
create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci,
v1 char(1) character set ucs2 collate ucs2_test_ci as (c1),
v2 int as (c1 = 'b'),
v3 int as (v1 = 'b'));
insert into t1 (c1) values ('a');
select * from t1 where v1 = 'b';
show create table t1;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@@ -3,9 +3,9 @@
# not in the TABLE::expr_arena.
#
#
# MDEV-9690 concurrent queries with virtual columns crash in temporal code
#
--echo #
--echo # MDEV-9690 concurrent queries with virtual columns crash in temporal code
--echo #
create table t1 (a datetime,
# get_datetime_value
b int as (a > 1), # Arg_comparator
@@ -40,9 +40,9 @@ connection default;
select * from t1;
drop table t1;
#
# MDEV-13435 Crash when selecting virtual columns generated using JSON functions
#
--echo #
--echo # MDEV-13435 Crash when selecting virtual columns generated using JSON functions
--echo #
create table t1 (
id int not null ,
js varchar(1000) not null,
@@ -50,3 +50,14 @@ create table t1 (
insert into t1(id,js) values (0, '{"default" : {"start": "00:00:00", "end":"23:59:50"}}');
select * from t1;
drop table t1;
--echo #
--echo # MDEV-26281 ASAN use-after-poison when complex conversion is involved in blob
--echo #
create table t1 (v2 blob as ('a' is null), a1 int, a char(1) as (cast(a1 in (0,current_user() is null) as char(16777216) )));
insert ignore into t1 values ('x','x',v2) ;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@@ -1045,8 +1045,7 @@ bool Item_field::check_field_expression_processor(void *arg)
(!field->vcol_info && !org_field->vcol_info)) &&
field->field_index >= org_field->field_index))
{
my_error(ER_EXPRESSION_REFERS_TO_UNINIT_FIELD,
MYF(0),
my_error(ER_EXPRESSION_REFERS_TO_UNINIT_FIELD, MYF(0),
org_field->field_name.str, field->field_name.str);
return 1;
}
@@ -9444,6 +9443,12 @@ bool Item_default_value::eq(const Item *item, bool binary_cmp) const
}
bool Item_default_value::check_field_expression_processor(void *)
{
field->default_value= ((Item_field *)(arg->real_item()))->field->default_value;
return 0;
}
bool Item_default_value::fix_fields(THD *thd, Item **items)
{
Item *real_arg;
@@ -9485,7 +9490,6 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
}
if (!(def_field= (Field*) thd->alloc(field_arg->field->size_of())))
goto error;
cached_field= def_field;
memcpy((void *)def_field, (void *)field_arg->field,
field_arg->field->size_of());
def_field->reset_fields();
@@ -9514,8 +9518,7 @@ error:
void Item_default_value::cleanup()
{
delete cached_field; // Free cached blob data
cached_field= 0;
delete field; // Free cached blob data
Item_field::cleanup();
}

View File

@@ -5889,12 +5889,11 @@ class Item_default_value : public Item_field
void calculate();
public:
Item *arg;
Field *cached_field;
Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a,
bool vcol_assignment_arg)
:Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
&null_clex_str), vcol_assignment_ok(vcol_assignment_arg),
arg(a), cached_field(NULL) {}
arg(a) {}
enum Type type() const { return DEFAULT_VALUE_ITEM; }
bool eq(const Item *item, bool binary_cmp) const;
bool fix_fields(THD *, Item **);
@@ -5925,16 +5924,16 @@ public:
return false;
}
table_map used_tables() const;
virtual void update_used_tables()
void update_used_tables()
{
if (field && field->default_value)
field->default_value->expr->update_used_tables();
}
bool vcol_assignment_allowed_value() const { return vcol_assignment_ok; }
Field *get_tmp_table_field() { return 0; }
Item *get_tmp_table_item(THD *thd) { return this; }
Item_field *field_for_view_update() { return 0; }
bool update_vcol_processor(void *arg) { return 0; }
bool check_field_expression_processor(void *arg);
bool check_func_default_processor(void *arg) { return true; }
bool walk(Item_processor processor, bool walk_subquery, void *args)
@@ -6301,10 +6300,18 @@ public:
}
return mark_unsupported_function("cache", arg, VCOL_IMPOSSIBLE);
}
bool fix_fields(THD *thd, Item **ref)
{
fixed= 1;
if (example && !example->fixed)
return example->fix_fields(thd, ref);
return 0;
}
void cleanup()
{
clear();
Item_basic_constant::cleanup();
fixed= 0;
}
/**
Check if saved item has a non-NULL value.

View File

@@ -1005,7 +1005,7 @@ public:
/* We build without RTTI, so dynamic_cast can't be used. */
enum Type
{
STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE, TABLE_ARENA
STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE
};
Query_arena(MEM_ROOT *mem_root_arg, enum enum_state state_arg) :
@@ -3946,8 +3946,7 @@ public:
bool is_item_tree_change_register_required()
{
return !stmt_arena->is_conventional()
|| stmt_arena->type() == Query_arena::TABLE_ARENA;
return !stmt_arena->is_conventional();
}
void change_item_tree(Item **place, Item *new_value)

View File

@@ -205,7 +205,6 @@ init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex)
return TRUE;
context->resolve_in_table_list_only(table_list);
lex->use_only_table_context= TRUE;
lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VCOL_EXPR;
select_lex->cur_pos_in_select_list= UNDEF_POS;
table->map= 1; //To ensure correct calculation of const item
table_list->table= table;

View File

@@ -354,7 +354,8 @@ bool check_valid_path(const char *path, size_t len)
static void fix_dl_name(MEM_ROOT *root, LEX_CSTRING *dl)
{
const size_t so_ext_len= sizeof(SO_EXT) - 1;
if (my_strcasecmp(&my_charset_latin1, dl->str + dl->length - so_ext_len,
if (dl->length < so_ext_len ||
my_strcasecmp(&my_charset_latin1, dl->str + dl->length - so_ext_len,
SO_EXT))
{
char *s= (char*)alloc_root(root, dl->length + so_ext_len + 1);

View File

@@ -17144,7 +17144,8 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field,
table->s->db_create_options|= HA_OPTION_PACK_RECORD;
else if (org_field->type() == FIELD_TYPE_DOUBLE)
((Field_double *) new_field)->not_fixed= TRUE;
new_field->vcol_info= 0;
new_field->vcol_info= new_field->default_value=
new_field->check_constraint= 0;
new_field->cond_selectivity= 1.0;
new_field->next_equal_field= NULL;
new_field->option_list= NULL;

View File

@@ -49,17 +49,6 @@
#define MYSQL57_GENERATED_FIELD 128
#define MYSQL57_GCOL_HEADER_SIZE 4
class Table_arena: public Query_arena
{
public:
Table_arena(MEM_ROOT *mem_root, enum enum_state state_arg) :
Query_arena(mem_root, state_arg){}
virtual Type type() const
{
return TABLE_ARENA;
}
};
static Virtual_column_info * unpack_vcol_info_from_frm(THD *,
TABLE *, String *, Virtual_column_info **, bool *);
@@ -1064,8 +1053,8 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
We need to use CONVENTIONAL_EXECUTION here to ensure that
any new items created by fix_fields() are not reverted.
*/
table->expr_arena= new (alloc_root(mem_root, sizeof(Table_arena)))
Table_arena(mem_root,
table->expr_arena= new (alloc_root(mem_root, sizeof(Query_arena)))
Query_arena(mem_root,
Query_arena::STMT_CONVENTIONAL_EXECUTION);
if (!table->expr_arena)
DBUG_RETURN(1);
@@ -3015,8 +3004,7 @@ class Vcol_expr_context
bool inited;
THD *thd;
TABLE *table;
LEX *old_lex;
LEX lex;
Query_arena backup_arena;
table_map old_map;
Security_context *save_security_ctx;
sql_mode_t save_sql_mode;
@@ -3026,7 +3014,6 @@ public:
inited(false),
thd(_thd),
table(_table),
old_lex(thd->lex),
old_map(table->map),
save_security_ctx(thd->security_ctx),
save_sql_mode(thd->variables.sql_mode) {}
@@ -3038,18 +3025,6 @@ public:
bool Vcol_expr_context::init()
{
/*
As this is vcol expression we must narrow down name resolution to
single table.
*/
if (init_lex_with_single_table(thd, table, &lex))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
table->map= old_map;
return true;
}
lex.sql_command= old_lex->sql_command;
thd->variables.sql_mode= 0;
TABLE_LIST const *tl= table->pos_in_table_list;
@@ -3058,6 +3033,8 @@ bool Vcol_expr_context::init()
if (table->pos_in_table_list->security_ctx)
thd->security_ctx= tl->security_ctx;
thd->set_n_backup_active_arena(table->expr_arena, &backup_arena);
inited= true;
return false;
}
@@ -3066,9 +3043,9 @@ Vcol_expr_context::~Vcol_expr_context()
{
if (!inited)
return;
end_lex_with_single_table(thd, table, old_lex);
table->map= old_map;
thd->security_ctx= save_security_ctx;
thd->restore_active_arena(table->expr_arena, &backup_arena);
thd->variables.sql_mode= save_sql_mode;
}
@@ -3339,6 +3316,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
outparam->s= share;
outparam->db_stat= db_stat;
outparam->write_row_record= NULL;
outparam->status= STATUS_NO_RECORD;
if (share->incompatible_version &&
!(ha_open_flags & (HA_OPEN_FOR_ALTER | HA_OPEN_FOR_REPAIR)))

View File

@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2019, MariaDB Corporation.
Copyright (c) 2013, 2022, MariaDB Corporation.
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
@@ -72,7 +72,7 @@ enum dict_err_ignore_t {
DICT_ERR_IGNORE_INDEX_ROOT = 2, /*!< ignore error if index root
page is FIL_NULL or incorrect value */
DICT_ERR_IGNORE_CORRUPT = 4, /*!< skip corrupted indexes */
DICT_ERR_IGNORE_RECOVER_LOCK = 8,
DICT_ERR_IGNORE_RECOVER_LOCK = 8 | DICT_ERR_IGNORE_FK_NOKEY,
/*!< Used when recovering table locks
for resurrected transactions.
Silently load a missing