mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
Merge from upstream 5.0-bugteam.
This commit is contained in:
commit
3d063e0c5b
8 changed files with 81 additions and 40 deletions
|
@ -1998,7 +1998,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
|||
{
|
||||
if (!preserve_comments)
|
||||
{
|
||||
// Skip spaces at the beggining of a statement
|
||||
// Skip spaces at the beginning of a statement
|
||||
if (my_isspace(charset_info,inchar) && (out == line) &&
|
||||
buffer.is_empty())
|
||||
continue;
|
||||
|
@ -2081,37 +2081,6 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
|||
continue;
|
||||
}
|
||||
}
|
||||
else if (!*ml_comment && !*in_string &&
|
||||
(end_of_line - pos) >= 10 &&
|
||||
!my_strnncoll(charset_info, (uchar*) pos, 10,
|
||||
(const uchar*) "delimiter ", 10))
|
||||
{
|
||||
// Flush previously accepted characters
|
||||
if (out != line)
|
||||
{
|
||||
buffer.append(line, (uint32) (out - line));
|
||||
out= line;
|
||||
}
|
||||
|
||||
// Flush possible comments in the buffer
|
||||
if (!buffer.is_empty())
|
||||
{
|
||||
if (com_go(&buffer, 0) > 0) // < 0 is not fatal
|
||||
DBUG_RETURN(1);
|
||||
buffer.length(0);
|
||||
}
|
||||
|
||||
/*
|
||||
Delimiter wants the get rest of the given line as argument to
|
||||
allow one to change ';' to ';;' and back
|
||||
*/
|
||||
buffer.append(pos);
|
||||
if (com_delimiter(&buffer, pos) > 0)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
buffer.length(0);
|
||||
break;
|
||||
}
|
||||
else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter))
|
||||
{
|
||||
// Found a statement. Continue parsing after the delimiter
|
||||
|
@ -2174,8 +2143,24 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
|||
|
||||
// comment to end of line
|
||||
if (preserve_comments)
|
||||
{
|
||||
bool started_with_nothing= !buffer.length();
|
||||
|
||||
buffer.append(pos);
|
||||
|
||||
/*
|
||||
A single-line comment by itself gets sent immediately so that
|
||||
client commands (delimiter, status, etc) will be interpreted on
|
||||
the next line.
|
||||
*/
|
||||
if (started_with_nothing)
|
||||
{
|
||||
if (com_go(&buffer, 0) > 0) // < 0 is not fatal
|
||||
DBUG_RETURN(1);
|
||||
buffer.length(0);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if (!*in_string && inchar == '/' && *(pos+1) == '*' &&
|
||||
|
|
|
@ -176,4 +176,13 @@ IF((ROUND(t1.a,2)=1), 2,
|
|||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((R
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c LONGTEXT);
|
||||
INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890');
|
||||
SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
|
||||
MAX(IF(1, CAST(c AS UNSIGNED), 0))
|
||||
12345678901234567890
|
||||
SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
|
||||
MAX(IFNULL(CAST(c AS UNSIGNED), 0))
|
||||
12345678901234567890
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -180,4 +180,10 @@ ERROR at line 1: DELIMITER cannot contain a backslash character
|
|||
1
|
||||
This is a file starting with UTF8 BOM 0xEFBBBF
|
||||
This is a file starting with UTF8 BOM 0xEFBBBF
|
||||
delimiter
|
||||
1
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -150,4 +150,18 @@ FROM t1;
|
|||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #40761: Assert on sum func on IF(..., CAST(longtext AS UNSIGNED), signed)
|
||||
# (was: LEFT JOIN on inline view crashes server)
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c LONGTEXT);
|
||||
INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890');
|
||||
|
||||
SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
|
||||
SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -290,4 +290,23 @@ EOF
|
|||
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql;
|
||||
|
||||
#
|
||||
# Bug #33812: mysql client incorrectly parsing DELIMITER
|
||||
#
|
||||
# The space and ; after delimiter are important
|
||||
--exec $MYSQL -e "select 1 delimiter ;"
|
||||
|
||||
#
|
||||
# Bug #38158: mysql client regression, can't read dump files
|
||||
#
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/bug38158.sql
|
||||
-- Testing
|
||||
--
|
||||
delimiter ||
|
||||
select 2 ||
|
||||
EOF
|
||||
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1
|
||||
--exec $MYSQL -c < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -351,7 +351,10 @@ public:
|
|||
Item_func_unsigned(Item *a) :Item_func_signed(a) {}
|
||||
const char *func_name() const { return "cast_as_unsigned"; }
|
||||
void fix_length_and_dec()
|
||||
{ max_length=args[0]->max_length; unsigned_flag=1; }
|
||||
{
|
||||
max_length= min(args[0]->max_length, DECIMAL_MAX_PRECISION + 2);
|
||||
unsigned_flag=1;
|
||||
}
|
||||
longlong val_int();
|
||||
void print(String *str);
|
||||
};
|
||||
|
|
13
sql/log.cc
13
sql/log.cc
|
@ -1146,7 +1146,7 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli, bool included)
|
|||
* Need to update the log pos because purge logs has been called
|
||||
* after fetching initially the log pos at the begining of the method.
|
||||
*/
|
||||
if(error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0))
|
||||
if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)))
|
||||
{
|
||||
char buff[22];
|
||||
sql_print_error("next log error: %d offset: %s log: %s included: %d",
|
||||
|
@ -1234,8 +1234,8 @@ int MYSQL_LOG::purge_logs(const char *to_log,
|
|||
*/
|
||||
if (!my_b_inited(&purge_temp))
|
||||
{
|
||||
if (error=open_cached_file(&purge_temp, mysql_tmpdir, TEMP_PREFIX,
|
||||
DISK_BUFFER_SIZE, MYF(MY_WME)))
|
||||
if ((error=open_cached_file(&purge_temp, mysql_tmpdir, TEMP_PREFIX,
|
||||
DISK_BUFFER_SIZE, MYF(MY_WME))))
|
||||
{
|
||||
sql_print_error("MYSQL_LOG::purge_logs failed to open purge_temp");
|
||||
goto err;
|
||||
|
@ -1243,7 +1243,7 @@ int MYSQL_LOG::purge_logs(const char *to_log,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (error=reinit_io_cache(&purge_temp, WRITE_CACHE, 0, 0, 1))
|
||||
if ((error=reinit_io_cache(&purge_temp, WRITE_CACHE, 0, 0, 1)))
|
||||
{
|
||||
sql_print_error("MYSQL_LOG::purge_logs failed to reinit purge_temp "
|
||||
"for write");
|
||||
|
@ -1274,7 +1274,7 @@ int MYSQL_LOG::purge_logs(const char *to_log,
|
|||
}
|
||||
|
||||
/* We know how many files to delete. Update index file. */
|
||||
if (error=update_log_index(&log_info, need_update_threads))
|
||||
if ((error=update_log_index(&log_info, need_update_threads)))
|
||||
{
|
||||
sql_print_error("MSYQL_LOG::purge_logs failed to update the index file");
|
||||
goto err;
|
||||
|
@ -1283,7 +1283,7 @@ int MYSQL_LOG::purge_logs(const char *to_log,
|
|||
DBUG_EXECUTE_IF("crash_after_update_index", abort(););
|
||||
|
||||
/* Switch purge_temp for read. */
|
||||
if (error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0))
|
||||
if ((error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0)))
|
||||
{
|
||||
sql_print_error("MSYQL_LOG::purge_logs failed to reinit purge_temp "
|
||||
"for read");
|
||||
|
@ -1409,6 +1409,7 @@ int MYSQL_LOG::purge_logs(const char *to_log,
|
|||
}
|
||||
|
||||
err:
|
||||
close_cached_file(&purge_temp);
|
||||
if (need_mutex)
|
||||
pthread_mutex_unlock(&LOCK_index);
|
||||
DBUG_RETURN(error);
|
||||
|
|
|
@ -15899,6 +15899,7 @@ static void test_bug28934()
|
|||
}
|
||||
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
/**
|
||||
Bug#37956 memory leak and / or crash with geometry and prepared statements!
|
||||
*/
|
||||
|
@ -15907,7 +15908,7 @@ static void test_bug37956(void)
|
|||
{
|
||||
const char *query="select point(?,?)";
|
||||
MYSQL_STMT *stmt=NULL;
|
||||
unsigned int val=0;
|
||||
ulong val=0;
|
||||
MYSQL_BIND bind_param[2];
|
||||
unsigned char buff[2]= { 134, 211 };
|
||||
DBUG_ENTER("test_bug37956");
|
||||
|
@ -15951,6 +15952,7 @@ static void test_bug37956(void)
|
|||
DIE_UNLESS(0);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Bug#27592 (stack overrun when storing datetime value using prepared statements)
|
||||
|
@ -16648,7 +16650,9 @@ static struct my_tests_st my_tests[]= {
|
|||
{ "test_bug32265", test_bug32265 },
|
||||
{ "test_bug38486", test_bug38486 },
|
||||
{ "test_bug40365", test_bug40365 },
|
||||
#ifdef HAVE_SPATIAL
|
||||
{ "test_bug37956", test_bug37956 },
|
||||
#endif
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue