Skip to content

Commit

Permalink
Merge 10.4 into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Oct 13, 2021
2 parents cda072b + a736a31 commit 99bb3fb
Show file tree
Hide file tree
Showing 70 changed files with 1,084 additions and 328 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -378,6 +378,7 @@ x86/
build/
bld/
[Bb]in/
/cmake-build-debug/
[Oo]bj/

# Roslyn cache directories
Expand Down Expand Up @@ -560,7 +561,7 @@ compile_commands.json
.vscode/

# Clion && other JetBrains ides
.idea
/.idea/

.cache/clangd

Expand Down
24 changes: 17 additions & 7 deletions client/mysql.cc
Expand Up @@ -1672,11 +1672,14 @@ static struct my_option my_long_options[] =
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binary-mode", 0,
"By default, ASCII '\\0' is disallowed and '\\r\\n' is translated to '\\n'. "
"This switch turns off both features, and also turns off parsing of all client"
"commands except \\C and DELIMITER, in non-interactive mode (for input "
"piped to mysql or loaded using the 'source' command). This is necessary "
"when processing output from mysqlbinlog that may contain blobs.",
"Binary mode allows certain character sequences to be processed as data "
"that would otherwise be treated with a special meaning by the parser. "
"Specifically, this switch turns off parsing of all client commands except "
"\\C and DELIMITER in non-interactive mode (i.e., when binary mode is "
"combined with either 1) piped input, 2) the --batch mysql option, or 3) "
"the 'source' command). Also, in binary mode, occurrences of '\\r\\n' and "
"ASCII '\\0' are preserved within strings, whereas by default, '\\r\\n' is "
"translated to '\\n' and '\\0' is disallowed in user input.",
&opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"connect-expired-password", 0,
"Notify the server that this client is prepared to handle expired "
Expand Down Expand Up @@ -2321,8 +2324,15 @@ static bool add_line(String &buffer, char *line, size_t line_length,
{
// Found possbile one character command like \c

if (!(inchar = (uchar) *++pos))
break; // readline adds one '\'
/*
The null-terminating character (ASCII '\0') marks the end of user
input. Then, by default, upon encountering a '\0' while parsing, it
should stop. However, some data naturally contains binary zeros
(e.g., zipped files). Real_binary_mode signals the parser to expect
'\0' within the data and not to end parsing if found.
*/
if (!(inchar = (uchar) *++pos) && (!real_binary_mode || !*in_string))
break; // readline adds one '\'
if (*in_string || inchar == 'N') // \N is short for NULL
{ // Don't allow commands in string
*out++='\\';
Expand Down
3 changes: 2 additions & 1 deletion include/ft_global.h
Expand Up @@ -90,7 +90,8 @@ void ft_free_stopwords(void);

FT_INFO *ft_init_search(uint,void *, uint, uchar *, size_t,
CHARSET_INFO *, uchar *);
my_bool ft_boolean_check_syntax_string(const uchar *);
my_bool ft_boolean_check_syntax_string(const uchar *, size_t length,
CHARSET_INFO *cs);

/* Internal symbols for fulltext between maria and MyISAM */

Expand Down
3 changes: 3 additions & 0 deletions include/my_context.h
Expand Up @@ -52,6 +52,9 @@ struct my_context {


#ifdef MY_CONTEXT_USE_UCONTEXT
#if defined(__APPLE__) && !defined(_XOPEN_SOURCE)
#define _XOPEN_SOURCE
#endif
#include <ucontext.h>

struct my_context {
Expand Down
2 changes: 1 addition & 1 deletion include/my_global.h
@@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB Corporation.
Copyright (c) 2009, 2021, 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
Expand Down
6 changes: 3 additions & 3 deletions include/mysql_com.h
Expand Up @@ -197,13 +197,13 @@ enum enum_indicator_type
#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3U << FIELD_FLAGS_COLUMN_FORMAT)
#define FIELD_IS_DROPPED (1U << 26) /* Intern: Field is being dropped */

#define VERS_SYS_START_FLAG (1 << 27) /* autogenerated column declared with
#define VERS_ROW_START (1 << 27) /* autogenerated column declared with
`generated always as row start`
(see II.a SQL Standard) */
#define VERS_SYS_END_FLAG (1 << 28) /* autogenerated column declared with
#define VERS_ROW_END (1 << 28) /* autogenerated column declared with
`generated always as row end`
(see II.a SQL Standard).*/
#define VERS_SYSTEM_FIELD (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG)
#define VERS_SYSTEM_FIELD (VERS_ROW_START | VERS_ROW_END)
#define VERS_UPDATE_UNVERSIONED_FLAG (1 << 29) /* column that doesn't support
system versioning when table
itself supports it*/
Expand Down
9 changes: 8 additions & 1 deletion man/mysql.1
Expand Up @@ -206,7 +206,14 @@ option\&.
.\" binary-mode option: mysql
\fB\-\-binary\-mode\fR
.sp
By default, ASCII '\e0' is disallowed and '\er\en' is translated to '\en'\&. This switch turns off both features, and also turns off parsing of all client commands except \eC and DELIMITER, in non-interactive mode (for input piped to mysql or loaded using the 'source' command)\&. This is necessary when processing output from mysqlbinlog that may contain blobs\&.
Binary mode allows certain character sequences to be processed as data that
would otherwise be treated with a special meaning by the parser\&.
Specifically, this switch turns off parsing of all client commands except \eC
and DELIMITER in non-interactive mode (i\&.e\&., when binary mode is combined
with either 1) piped input, 2) the --batch mysql option, or 3) the 'source'
command)\&. Also, in binary mode, occurrences of '\er\en' and ASCII '\e0' are
preserved within strings, whereas by default, '\er\en' is translated to '\en'
and '\e0' is disallowed in user input\&.
.RE
.sp
.RS 4
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/main/ctype_utf16_def.result
Expand Up @@ -8,3 +8,8 @@ character_set_server utf16
SHOW VARIABLES LIKE 'ft_stopword_file';
Variable_name Value
ft_stopword_file (built-in)
#
# MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
#
SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;
7 changes: 7 additions & 0 deletions mysql-test/main/ctype_utf16_def.test
Expand Up @@ -7,3 +7,10 @@ call mtr.add_suppression("'utf16' can not be used as client character set");
SHOW VARIABLES LIKE 'collation_server';
SHOW VARIABLES LIKE 'character_set_server';
SHOW VARIABLES LIKE 'ft_stopword_file';

--echo #
--echo # MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
--echo #

SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;
1 change: 1 addition & 0 deletions mysql-test/main/ctype_utf32_def.opt
@@ -0,0 +1 @@
--character-set-server=utf32,latin1 --collation-server=utf32_general_ci
6 changes: 6 additions & 0 deletions mysql-test/main/ctype_utf32_def.result
@@ -0,0 +1,6 @@
call mtr.add_suppression("'utf32' can not be used as client character set");
#
# MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
#
SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;
9 changes: 9 additions & 0 deletions mysql-test/main/ctype_utf32_def.test
@@ -0,0 +1,9 @@
--source include/have_utf32.inc
call mtr.add_suppression("'utf32' can not be used as client character set");

--echo #
--echo # MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
--echo #

SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
SET GLOBAL ft_boolean_syntax=DEFAULT;
9 changes: 9 additions & 0 deletions mysql-test/main/default.result
Expand Up @@ -3387,6 +3387,14 @@ CREATE OR REPLACE TABLE t1(i int);
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
ERROR 42S22: Unknown column 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in 'DEFAULT'
DROP TABLE t1;
#
# MDEV-18278 Misleading error message in error log upon failed table creation
#
create table t1 (a int as (a));
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`
# end of 10.2 test
#
# MDEV-22703 DEFAULT() on a BLOB column can overwrite the default
Expand All @@ -3403,3 +3411,4 @@ length(DEFAULT(h))
25
INSERT INTO t1 () VALUES ();
drop table t1;
# end of 10.3 test
9 changes: 9 additions & 0 deletions mysql-test/main/default.test
Expand Up @@ -2109,6 +2109,13 @@ CREATE OR REPLACE TABLE t1(i int);
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
DROP TABLE t1;

--echo #
--echo # MDEV-18278 Misleading error message in error log upon failed table creation
--echo #
--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
create table t1 (a int as (a));
show warnings;

--echo # end of 10.2 test

--echo #
Expand All @@ -2126,3 +2133,5 @@ SELECT DEFAULT(h) FROM t1;
SELECT length(DEFAULT(h)) FROM t1;
INSERT INTO t1 () VALUES ();
drop table t1;

--echo # end of 10.3 test
1 change: 1 addition & 0 deletions mysql-test/main/delayed_blob.opt
@@ -0,0 +1 @@
--init_connect="set @a='something unique to have MTR start a dedicated mariadbd for this test and shutdown it after the test'"
17 changes: 17 additions & 0 deletions mysql-test/main/delayed_blob.result
@@ -0,0 +1,17 @@
#
# MDEV-25925 Warning: Memory not freed: 32 on INSERT DELAYED
#
SET sql_mode='TRADITIONAL';
CREATE TABLE t1 (c BLOB) ENGINE=MyISAM;
INSERT DELAYED INTO t1 VALUES (''||'');
ERROR 22007: Truncated incorrect DOUBLE value: ''
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# MDEV-24467 Memory not freed after failed INSERT DELAYED
#
CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
ALTER TABLE t1 ADD b BLOB DEFAULT 'x';
INSERT DELAYED INTO t1 (a) VALUES ('foo');
ERROR 22001: Data too long for column 'a' at row 1
DROP TABLE t1;
21 changes: 21 additions & 0 deletions mysql-test/main/delayed_blob.test
@@ -0,0 +1,21 @@
--echo #
--echo # MDEV-25925 Warning: Memory not freed: 32 on INSERT DELAYED
--echo #

SET sql_mode='TRADITIONAL';
CREATE TABLE t1 (c BLOB) ENGINE=MyISAM;
--error ER_TRUNCATED_WRONG_VALUE
INSERT DELAYED INTO t1 VALUES (''||'');
DROP TABLE t1;
SET sql_mode=DEFAULT;


--echo #
--echo # MDEV-24467 Memory not freed after failed INSERT DELAYED
--echo #

CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
ALTER TABLE t1 ADD b BLOB DEFAULT 'x';
--error ER_DATA_TOO_LONG
INSERT DELAYED INTO t1 (a) VALUES ('foo');
DROP TABLE t1;
12 changes: 12 additions & 0 deletions mysql-test/main/func_str.result
Expand Up @@ -5019,6 +5019,18 @@ DROP TABLE t1;
# End of 10.1 tests
#
#
# Start of 10.2 tests
#
#
# MDEV-24742 Server crashes in Charset::numchars / String::numchars
#
SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');
NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux')
NULL
#
# End of 10.2 tests
#
#
# Start of 10.3 tests
#
#
Expand Down
16 changes: 16 additions & 0 deletions mysql-test/main/func_str.test
Expand Up @@ -1990,6 +1990,22 @@ DROP TABLE t1;
--echo #


--echo #
--echo # Start of 10.2 tests
--echo #

--echo #
--echo # MDEV-24742 Server crashes in Charset::numchars / String::numchars
--echo #

SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');


--echo #
--echo # End of 10.2 tests
--echo #


--echo #
--echo # Start of 10.3 tests
--echo #
Expand Down
17 changes: 16 additions & 1 deletion mysql-test/main/invisible_field.result
Expand Up @@ -538,7 +538,7 @@ a b
insert into t2 values(1);
select a,b from t2;
a b
NULL 1
12 1
drop table t1,t2;
create table t1 (a int invisible, b int, c int);
create table t2 (a int, b int, d int);
Expand Down Expand Up @@ -627,3 +627,18 @@ drop table t1;
create table t1 (a int, b int invisible);
insert delayed into t1 values (1);
drop table t1;
#
# MDEV-25891 Computed default for INVISIBLE column is ignored in INSERT
#
create table t1(
a int,
x int default (a),
y int default (a) invisible,
z int default (33) invisible);
insert into t1 values (1, default);
insert into t1 (a) values (2);
select a, x, y, z from t1;
a x y z
1 1 1 33
2 2 2 33
drop table t1;
13 changes: 13 additions & 0 deletions mysql-test/main/invisible_field.test
Expand Up @@ -279,3 +279,16 @@ create table t1 (a int, b int invisible);
insert delayed into t1 values (1);
# cleanup
drop table t1;

--echo #
--echo # MDEV-25891 Computed default for INVISIBLE column is ignored in INSERT
--echo #
create table t1(
a int,
x int default (a),
y int default (a) invisible,
z int default (33) invisible);
insert into t1 values (1, default);
insert into t1 (a) values (2);
select a, x, y, z from t1;
drop table t1;
10 changes: 10 additions & 0 deletions mysql-test/main/multi_update.result
Expand Up @@ -1151,3 +1151,13 @@ b
1
3
drop tables t1, t2;
#
# MDEV-22464 Server crash on UPDATE with nested subquery
#
create table t1 (a int) ;
insert into t1 (a) values (1),(2),(3) ;
select a from t1 where a= (select 2 from t1 having (a = 3));
ERROR 21000: Subquery returns more than 1 row
update t1 set a= (select 2 from t1 having (a = 3));
ERROR 21000: Subquery returns more than 1 row
drop tables t1;
11 changes: 11 additions & 0 deletions mysql-test/main/multi_update.test
Expand Up @@ -1087,3 +1087,14 @@ update t1 left join t2 on a = b set b= 3 order by b;
select * from t2;

drop tables t1, t2;

--echo #
--echo # MDEV-22464 Server crash on UPDATE with nested subquery
--echo #
create table t1 (a int) ;
insert into t1 (a) values (1),(2),(3) ;
--error ER_SUBQUERY_NO_1_ROW
select a from t1 where a= (select 2 from t1 having (a = 3));
--error ER_SUBQUERY_NO_1_ROW
update t1 set a= (select 2 from t1 having (a = 3));
drop tables t1;

0 comments on commit 99bb3fb

Please sign in to comment.