Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9c6135e8
Commit
9c6135e8
authored
Mar 15, 2022
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.3 into 10.4
parents
1c43660a
f217c761
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
8 deletions
+57
-8
mysql-test/lib/mtr_cases.pm
mysql-test/lib/mtr_cases.pm
+1
-1
mysql-test/main/sql_safe_updates.result
mysql-test/main/sql_safe_updates.result
+24
-0
mysql-test/main/sql_safe_updates.test
mysql-test/main/sql_safe_updates.test
+22
-3
mysql-test/suite/innodb/r/undo_truncate.result
mysql-test/suite/innodb/r/undo_truncate.result
+2
-0
mysql-test/suite/innodb/t/undo_truncate.test
mysql-test/suite/innodb/t/undo_truncate.test
+2
-0
sql/sql_delete.cc
sql/sql_delete.cc
+3
-2
sql/sql_update.cc
sql/sql_update.cc
+3
-2
No files found.
mysql-test/lib/mtr_cases.pm
View file @
9c6135e8
...
@@ -1037,7 +1037,7 @@ sub get_tags_from_file($$) {
...
@@ -1037,7 +1037,7 @@ sub get_tags_from_file($$) {
}
}
# Check for a sourced include file.
# Check for a sourced include file.
if
(
$line
=~
/^(--)?[[:space:]]*source[[:space:]]+([^;[:space:]]+)/
)
if
(
$line
=~
/^
[[:space:]]*
(--)?[[:space:]]*source[[:space:]]+([^;[:space:]]+)/
)
{
{
my
$include
=
$2
;
my
$include
=
$2
;
# The rules below must match open_file() function of mysqltest.cc
# The rules below must match open_file() function of mysqltest.cc
...
...
mysql-test/main/sql_safe_updates.result
View file @
9c6135e8
#
# MDEV-14429 sql_safe_updates in my.cnf not work
#
select @@sql_safe_updates;
select @@sql_safe_updates;
@@sql_safe_updates
@@sql_safe_updates
1
1
#
# MDEV-18304 sql_safe_updates does not work with OR clauses
#
create table t1 (a int, b int, primary key (a), key (b));
update t1 set b=2 where a=1 or b=2;
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
explain update t1 set b=2 where a=1 or b=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where
delete from t1 where a=1 or b=2;
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
explain delete from t1 where a=1 or b=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where
insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
update t1 set b=2 where a=1 or b=2;
delete from t1 where a=1 or b=2;
drop table t1;
#
# End of 10.3 tests
#
mysql-test/main/sql_safe_updates.test
View file @
9c6135e8
#
--
echo
#
# MDEV-14429 sql_safe_updates in my.cnf not work
--
echo
# MDEV-14429 sql_safe_updates in my.cnf not work
#
--
echo
#
select
@@
sql_safe_updates
;
select
@@
sql_safe_updates
;
--
echo
#
--
echo
# MDEV-18304 sql_safe_updates does not work with OR clauses
--
echo
#
create
table
t1
(
a
int
,
b
int
,
primary
key
(
a
),
key
(
b
));
--
error
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
update
t1
set
b
=
2
where
a
=
1
or
b
=
2
;
explain
update
t1
set
b
=
2
where
a
=
1
or
b
=
2
;
--
error
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
delete
from
t1
where
a
=
1
or
b
=
2
;
explain
delete
from
t1
where
a
=
1
or
b
=
2
;
insert
into
t1
values
(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
),(
5
,
5
),(
6
,
6
),(
7
,
7
),(
8
,
8
);
update
t1
set
b
=
2
where
a
=
1
or
b
=
2
;
delete
from
t1
where
a
=
1
or
b
=
2
;
drop
table
t1
;
--
echo
#
--
echo
# End of 10.3 tests
--
echo
#
mysql-test/suite/innodb/r/undo_truncate.result
View file @
9c6135e8
...
@@ -28,6 +28,8 @@ connection con2;
...
@@ -28,6 +28,8 @@ connection con2;
commit;
commit;
disconnect con2;
disconnect con2;
connection default;
connection default;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
SET GLOBAL innodb_max_purge_lag_wait=0;
set global innodb_fast_shutdown=0;
set global innodb_fast_shutdown=0;
# restart
# restart
drop table t1, t2;
drop table t1, t2;
mysql-test/suite/innodb/t/undo_truncate.test
View file @
9c6135e8
...
@@ -42,6 +42,8 @@ connection default;
...
@@ -42,6 +42,8 @@ connection default;
let
$trx_before
=
`SHOW ENGINE INNODB STATUS`
;
let
$trx_before
=
`SHOW ENGINE INNODB STATUS`
;
let
$trx_before
=
`select substr('$trx_before',9)+2`
;
let
$trx_before
=
`select substr('$trx_before',9)+2`
;
SET
GLOBAL
innodb_purge_rseg_truncate_frequency
=
1
;
SET
GLOBAL
innodb_max_purge_lag_wait
=
0
;
set
global
innodb_fast_shutdown
=
0
;
set
global
innodb_fast_shutdown
=
0
;
--
source
include
/
restart_mysqld
.
inc
--
source
include
/
restart_mysqld
.
inc
--
replace_regex
/.*
Trx
id
counter
([
0
-
9
]
+
)
.*/
\
1
/
--
replace_regex
/.*
Trx
id
counter
([
0
-
9
]
+
)
.*/
\
1
/
...
...
sql/sql_delete.cc
View file @
9c6135e8
...
@@ -421,7 +421,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
...
@@ -421,7 +421,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
const_cond
=
(
!
conds
||
conds
->
const_item
());
const_cond
=
(
!
conds
||
conds
->
const_item
());
safe_update
=
MY_TEST
(
thd
->
variables
.
option_bits
&
OPTION_SAFE_UPDATES
);
safe_update
=
(
thd
->
variables
.
option_bits
&
OPTION_SAFE_UPDATES
)
&&
!
thd
->
lex
->
describe
;
if
(
safe_update
&&
const_cond
)
if
(
safe_update
&&
const_cond
)
{
{
my_message
(
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
,
my_message
(
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
,
...
@@ -547,7 +548,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
...
@@ -547,7 +548,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
}
}
/* If running in safe sql mode, don't allow updates without keys */
/* If running in safe sql mode, don't allow updates without keys */
if
(
table
->
quick_keys
.
is_clear_all
()
)
if
(
!
select
||
!
select
->
quick
)
{
{
thd
->
set_status_no_index_used
();
thd
->
set_status_no_index_used
();
if
(
safe_update
&&
!
using_limit
)
if
(
safe_update
&&
!
using_limit
)
...
...
sql/sql_update.cc
View file @
9c6135e8
...
@@ -371,7 +371,8 @@ int mysql_update(THD *thd,
...
@@ -371,7 +371,8 @@ int mysql_update(THD *thd,
ha_rows
*
found_return
,
ha_rows
*
updated_return
)
ha_rows
*
found_return
,
ha_rows
*
updated_return
)
{
{
bool
using_limit
=
limit
!=
HA_POS_ERROR
;
bool
using_limit
=
limit
!=
HA_POS_ERROR
;
bool
safe_update
=
thd
->
variables
.
option_bits
&
OPTION_SAFE_UPDATES
;
bool
safe_update
=
(
thd
->
variables
.
option_bits
&
OPTION_SAFE_UPDATES
)
&&
!
thd
->
lex
->
describe
;
bool
used_key_is_modified
=
FALSE
,
transactional_table
;
bool
used_key_is_modified
=
FALSE
,
transactional_table
;
bool
will_batch
=
FALSE
;
bool
will_batch
=
FALSE
;
bool
can_compare_record
;
bool
can_compare_record
;
...
@@ -599,7 +600,7 @@ int mysql_update(THD *thd,
...
@@ -599,7 +600,7 @@ int mysql_update(THD *thd,
}
}
/* If running in safe sql mode, don't allow updates without keys */
/* If running in safe sql mode, don't allow updates without keys */
if
(
table
->
quick_keys
.
is_clear_all
()
)
if
(
!
select
||
!
select
->
quick
)
{
{
thd
->
set_status_no_index_used
();
thd
->
set_status_no_index_used
();
if
(
safe_update
&&
!
using_limit
)
if
(
safe_update
&&
!
using_limit
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment