mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
5.2 merge
This commit is contained in:
@@ -265,3 +265,10 @@ SELECT '1' IN ('1', INET_NTOA(0));
|
|||||||
'1' IN ('1', INET_NTOA(0))
|
'1' IN ('1', INET_NTOA(0))
|
||||||
1
|
1
|
||||||
End of tests
|
End of tests
|
||||||
|
SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
|
||||||
|
ERROR HY000: Incorrect arguments to NAME_CONST
|
||||||
|
SELECT NAME_CONST('a', -(1 AND 2)) AND 1;
|
||||||
|
ERROR HY000: Incorrect arguments to NAME_CONST
|
||||||
|
SELECT NAME_CONST('a', -(1)) OR 1;
|
||||||
|
NAME_CONST('a', -(1)) OR 1
|
||||||
|
1
|
||||||
|
@@ -300,3 +300,13 @@ SELECT '1' IN ('1', INET_NTOA(0));
|
|||||||
|
|
||||||
|
|
||||||
--echo End of tests
|
--echo End of tests
|
||||||
|
|
||||||
|
#
|
||||||
|
# MDEV-5655 Server crashes on NAME_CONST containing AND/OR expressions
|
||||||
|
#
|
||||||
|
--error ER_WRONG_ARGUMENTS
|
||||||
|
SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
|
||||||
|
--error ER_WRONG_ARGUMENTS
|
||||||
|
SELECT NAME_CONST('a', -(1 AND 2)) AND 1;
|
||||||
|
SELECT NAME_CONST('a', -(1)) OR 1;
|
||||||
|
|
||||||
|
31
sql/item.cc
31
sql/item.cc
@@ -1599,17 +1599,28 @@ bool Item_name_const::is_null()
|
|||||||
Item_name_const::Item_name_const(Item *name_arg, Item *val):
|
Item_name_const::Item_name_const(Item *name_arg, Item *val):
|
||||||
value_item(val), name_item(name_arg)
|
value_item(val), name_item(name_arg)
|
||||||
{
|
{
|
||||||
if (!(valid_args= name_item->basic_const_item() &&
|
|
||||||
(value_item->basic_const_item() ||
|
|
||||||
((value_item->type() == FUNC_ITEM) &&
|
|
||||||
((((Item_func *) value_item)->functype() ==
|
|
||||||
Item_func::COLLATE_FUNC) ||
|
|
||||||
((((Item_func *) value_item)->functype() ==
|
|
||||||
Item_func::NEG_FUNC) &&
|
|
||||||
(((Item_func *) value_item)->key_item()->type() !=
|
|
||||||
FUNC_ITEM)))))))
|
|
||||||
my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
|
|
||||||
Item::maybe_null= TRUE;
|
Item::maybe_null= TRUE;
|
||||||
|
valid_args= true;
|
||||||
|
if (!name_item->basic_const_item())
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
if (value_item->basic_const_item())
|
||||||
|
return; // ok
|
||||||
|
|
||||||
|
if (value_item->type() == FUNC_ITEM)
|
||||||
|
{
|
||||||
|
Item_func *value_func= (Item_func *) value_item;
|
||||||
|
if (value_func->functype() != Item_func::COLLATE_FUNC &&
|
||||||
|
value_func->functype() != Item_func::NEG_FUNC)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
if (value_func->key_item()->basic_const_item())
|
||||||
|
return; // ok
|
||||||
|
}
|
||||||
|
|
||||||
|
err:
|
||||||
|
valid_args= false;
|
||||||
|
my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -69,7 +69,6 @@ static bool no_threads_end(THD *thd, bool put_in_cache)
|
|||||||
void one_thread_scheduler(scheduler_functions *func)
|
void one_thread_scheduler(scheduler_functions *func)
|
||||||
{
|
{
|
||||||
func->max_threads= 1;
|
func->max_threads= 1;
|
||||||
max_connections= 1;
|
|
||||||
func->max_connections= &max_connections;
|
func->max_connections= &max_connections;
|
||||||
func->connection_count= &connection_count;
|
func->connection_count= &connection_count;
|
||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
@@ -1079,7 +1079,6 @@ row_insert_for_mysql(
|
|||||||
ins_node_t* node = prebuilt->ins_node;
|
ins_node_t* node = prebuilt->ins_node;
|
||||||
|
|
||||||
ut_ad(trx);
|
ut_ad(trx);
|
||||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
|
||||||
|
|
||||||
if (prebuilt->table->ibd_file_missing) {
|
if (prebuilt->table->ibd_file_missing) {
|
||||||
ut_print_timestamp(stderr);
|
ut_print_timestamp(stderr);
|
||||||
@@ -1313,7 +1312,6 @@ row_update_for_mysql(
|
|||||||
trx_t* trx = prebuilt->trx;
|
trx_t* trx = prebuilt->trx;
|
||||||
|
|
||||||
ut_ad(prebuilt && trx);
|
ut_ad(prebuilt && trx);
|
||||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
|
||||||
UT_NOT_USED(mysql_rec);
|
UT_NOT_USED(mysql_rec);
|
||||||
|
|
||||||
if (prebuilt->table->ibd_file_missing) {
|
if (prebuilt->table->ibd_file_missing) {
|
||||||
@@ -1483,7 +1481,6 @@ row_unlock_for_mysql(
|
|||||||
trx_t* trx = prebuilt->trx;
|
trx_t* trx = prebuilt->trx;
|
||||||
|
|
||||||
ut_ad(prebuilt && trx);
|
ut_ad(prebuilt && trx);
|
||||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
|
||||||
|
|
||||||
if (UNIV_UNLIKELY
|
if (UNIV_UNLIKELY
|
||||||
(!srv_locks_unsafe_for_binlog
|
(!srv_locks_unsafe_for_binlog
|
||||||
@@ -2724,7 +2721,6 @@ row_truncate_table_for_mysql(
|
|||||||
redo log records on the truncated tablespace, we will assign
|
redo log records on the truncated tablespace, we will assign
|
||||||
a new tablespace identifier to the truncated tablespace. */
|
a new tablespace identifier to the truncated tablespace. */
|
||||||
|
|
||||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
|
||||||
ut_ad(table);
|
ut_ad(table);
|
||||||
|
|
||||||
if (srv_created_new_raw) {
|
if (srv_created_new_raw) {
|
||||||
|
@@ -3434,7 +3434,6 @@ row_search_for_mysql(
|
|||||||
rec_offs_init(offsets_);
|
rec_offs_init(offsets_);
|
||||||
|
|
||||||
ut_ad(index && pcur && search_tuple);
|
ut_ad(index && pcur && search_tuple);
|
||||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
|
||||||
|
|
||||||
if (UNIV_UNLIKELY(prebuilt->table->ibd_file_missing)) {
|
if (UNIV_UNLIKELY(prebuilt->table->ibd_file_missing)) {
|
||||||
ut_print_timestamp(stderr);
|
ut_print_timestamp(stderr);
|
||||||
|
@@ -1084,7 +1084,6 @@ row_insert_for_mysql(
|
|||||||
ins_node_t* node = prebuilt->ins_node;
|
ins_node_t* node = prebuilt->ins_node;
|
||||||
|
|
||||||
ut_ad(trx);
|
ut_ad(trx);
|
||||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
|
||||||
|
|
||||||
if (prebuilt->table->ibd_file_missing) {
|
if (prebuilt->table->ibd_file_missing) {
|
||||||
ut_print_timestamp(stderr);
|
ut_print_timestamp(stderr);
|
||||||
@@ -1326,7 +1325,6 @@ row_update_for_mysql(
|
|||||||
trx_t* trx = prebuilt->trx;
|
trx_t* trx = prebuilt->trx;
|
||||||
|
|
||||||
ut_ad(prebuilt && trx);
|
ut_ad(prebuilt && trx);
|
||||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
|
||||||
UT_NOT_USED(mysql_rec);
|
UT_NOT_USED(mysql_rec);
|
||||||
|
|
||||||
if (prebuilt->table->ibd_file_missing) {
|
if (prebuilt->table->ibd_file_missing) {
|
||||||
@@ -1497,7 +1495,6 @@ row_unlock_for_mysql(
|
|||||||
trx_t* trx = prebuilt->trx;
|
trx_t* trx = prebuilt->trx;
|
||||||
|
|
||||||
ut_ad(prebuilt && trx);
|
ut_ad(prebuilt && trx);
|
||||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
|
||||||
|
|
||||||
if (UNIV_UNLIKELY
|
if (UNIV_UNLIKELY
|
||||||
(!srv_locks_unsafe_for_binlog
|
(!srv_locks_unsafe_for_binlog
|
||||||
@@ -2830,7 +2827,6 @@ row_truncate_table_for_mysql(
|
|||||||
redo log records on the truncated tablespace, we will assign
|
redo log records on the truncated tablespace, we will assign
|
||||||
a new tablespace identifier to the truncated tablespace. */
|
a new tablespace identifier to the truncated tablespace. */
|
||||||
|
|
||||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
|
||||||
ut_ad(table);
|
ut_ad(table);
|
||||||
|
|
||||||
if (srv_created_new_raw) {
|
if (srv_created_new_raw) {
|
||||||
|
@@ -3553,7 +3553,6 @@ row_search_for_mysql(
|
|||||||
rec_offs_init(offsets_);
|
rec_offs_init(offsets_);
|
||||||
|
|
||||||
ut_ad(index && pcur && search_tuple);
|
ut_ad(index && pcur && search_tuple);
|
||||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
|
||||||
|
|
||||||
if (UNIV_UNLIKELY(prebuilt->table->ibd_file_missing)) {
|
if (UNIV_UNLIKELY(prebuilt->table->ibd_file_missing)) {
|
||||||
ut_print_timestamp(stderr);
|
ut_print_timestamp(stderr);
|
||||||
|
Reference in New Issue
Block a user