mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
merge mysql-5.5->mysql-5.5-security
This commit is contained in:
@ -2372,6 +2372,12 @@ case SQLCOM_PREPARE:
|
||||
create_table->table_name))
|
||||
goto end_with_restore_list;
|
||||
#endif
|
||||
/*
|
||||
If no engine type was given, work out the default now
|
||||
rather than at parse-time.
|
||||
*/
|
||||
if (!(create_info.used_fields & HA_CREATE_USED_ENGINE))
|
||||
create_info.db_type= ha_default_handlerton(thd);
|
||||
/*
|
||||
If we are using SET CHARSET without DEFAULT, add an implicit
|
||||
DEFAULT to not confuse old users. (This may change).
|
||||
@ -2405,6 +2411,19 @@ case SQLCOM_PREPARE:
|
||||
{
|
||||
select_result *result;
|
||||
|
||||
/*
|
||||
CREATE TABLE...IGNORE/REPLACE SELECT... can be unsafe, unless
|
||||
ORDER BY PRIMARY KEY clause is used in SELECT statement. We therefore
|
||||
use row based logging if mixed or row based logging is available.
|
||||
TODO: Check if the order of the output of the select statement is
|
||||
deterministic. Waiting for BUG#42415
|
||||
*/
|
||||
if(lex->ignore)
|
||||
lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_CREATE_IGNORE_SELECT);
|
||||
|
||||
if(lex->duplicates == DUP_REPLACE)
|
||||
lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_CREATE_REPLACE_SELECT);
|
||||
|
||||
/*
|
||||
If:
|
||||
a) we inside an SP and there was NAME_CONST substitution,
|
||||
@ -2739,6 +2758,16 @@ end_with_restore_list:
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (update_precheck(thd, all_tables))
|
||||
break;
|
||||
|
||||
/*
|
||||
UPDATE IGNORE can be unsafe. We therefore use row based
|
||||
logging if mixed or row based logging is available.
|
||||
TODO: Check if the order of the output of the select statement is
|
||||
deterministic. Waiting for BUG#42415
|
||||
*/
|
||||
if (lex->ignore)
|
||||
lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_UPDATE_IGNORE);
|
||||
|
||||
DBUG_ASSERT(select_lex->offset_limit == 0);
|
||||
unit->set_limit(select_lex);
|
||||
MYSQL_UPDATE_START(thd->query());
|
||||
@ -2905,6 +2934,23 @@ end_with_restore_list:
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if ((res= insert_precheck(thd, all_tables)))
|
||||
break;
|
||||
/*
|
||||
INSERT...SELECT...ON DUPLICATE KEY UPDATE/REPLACE SELECT/
|
||||
INSERT...IGNORE...SELECT can be unsafe, unless ORDER BY PRIMARY KEY
|
||||
clause is used in SELECT statement. We therefore use row based
|
||||
logging if mixed or row based logging is available.
|
||||
TODO: Check if the order of the output of the select statement is
|
||||
deterministic. Waiting for BUG#42415
|
||||
*/
|
||||
if (lex->sql_command == SQLCOM_INSERT_SELECT &&
|
||||
lex->duplicates == DUP_UPDATE)
|
||||
lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_SELECT_UPDATE);
|
||||
|
||||
if (lex->sql_command == SQLCOM_INSERT_SELECT && lex->ignore)
|
||||
lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_IGNORE_SELECT);
|
||||
|
||||
if (lex->sql_command == SQLCOM_REPLACE_SELECT)
|
||||
lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_REPLACE_SELECT);
|
||||
|
||||
/* Fix lock for first table */
|
||||
if (first_table->lock_type == TL_WRITE_DELAYED)
|
||||
|
Reference in New Issue
Block a user