Commit 3e9c477a authored by Chad MILLER's avatar Chad MILLER

Merge from bk tree. Resolved addition of same files in both trees.

parents f6b7e7e4 59a880f9
......@@ -66,7 +66,7 @@ tags:
test-pl test-force-pl test-full-pl test-force-full-pl test-force-pl-mem \
test-unit test-ps test-nr test-pr test-ns test-binlog-statement \
test-ext-funcs test-ext-rpl test-ext-partitions test-ext-jp \
test-ext-stress test-ext test-embedded \
test-ext-stress test-ext test-embedded test-reprepare \
test-fast test-fast-cursor test-fast-view test-fast-prepare \
test-full-qa
......@@ -111,6 +111,11 @@ test-embedded:
echo "no program found for 'embedded' tests - skipped testing" ; \
fi
test-reprepare:
cd mysql-test ; \
@PERL@ ./mysql-test-run.pl $(force) $(mem) --ps-protocol \
--mysqld=--debug=+d,reprepare_each_statement
test: test-unit test-ns test-pr
test-full: test test-nr test-ps
......
......@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
#
# When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version().
AM_INIT_AUTOMAKE(mysql, 5.1.25-rc)
AM_INIT_AUTOMAKE(mysql, 5.1.26-rc)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
......
......@@ -96,6 +96,7 @@ extern const char *client_errors[]; /* Error messages */
#define CR_NOT_IMPLEMENTED 2054
#define CR_SERVER_LOST_EXTENDED 2055
#define CR_STMT_CLOSED 2056
#define CR_ERROR_LAST /*Copy last error nr:*/ 2056
#define CR_NEW_STMT_METADATA 2057
#define CR_ERROR_LAST /*Copy last error nr:*/ 2057
/* Add error numbers before CR_ERROR_LAST and change it accordingly. */
......@@ -570,7 +570,7 @@ typedef unsigned short ushort;
#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1)
#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
#define swap_variables(t, a, b) { register t dummy; dummy= a; a= b; b= dummy; }
#define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; }
#define test(a) ((a) ? 1 : 0)
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
......
......@@ -90,6 +90,9 @@ extern int NEAR my_errno; /* Last error in mysys */
#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */
#define ME_COLOUR2 ((2 << ME_HIGHBYTE))
#define ME_COLOUR3 ((3 << ME_HIGHBYTE))
#define ME_FATALERROR 1024 /* Fatal statement error */
#define ME_NO_WARNING_FOR_ERROR 2048 /* Don't push a warning for error */
#define ME_NO_SP_HANDLER 4096 /* Don't call stored routine error handlers */
/* Bits in last argument to fn_format */
#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */
......
......@@ -184,19 +184,38 @@ enum enum_server_command
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
#define SERVER_QUERY_NO_INDEX_USED 32
/*
/**
The server was able to fulfill the clients request and opened a
read-only non-scrollable cursor for a query. This flag comes
in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands.
*/
#define SERVER_STATUS_CURSOR_EXISTS 64
/*
/**
This flag is sent when a read-only cursor is exhausted, in reply to
COM_STMT_FETCH command.
*/
#define SERVER_STATUS_LAST_ROW_SENT 128
#define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */
#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
/**
Sent to the client if after a prepared statement reprepare
we discovered that the new statement returns a different
number of result set columns.
*/
#define SERVER_STATUS_METADATA_CHANGED 1024
/**
Server status flags that must be cleared when starting
execution of a new SQL statement.
Flags from this set are only added to the
current server status by the execution engine, but
never removed -- the execution engine expects them
to disappear automagically by the next command.
*/
#define SERVER_STATUS_CLEAR_SET (SERVER_QUERY_NO_GOOD_INDEX_USED| \
SERVER_QUERY_NO_INDEX_USED|\
SERVER_MORE_RESULTS_EXISTS|\
SERVER_STATUS_METADATA_CHANGED)
#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /* Timeout on read */
......@@ -205,6 +224,7 @@ enum enum_server_command
#define ONLY_KILL_QUERY 1
struct st_vio; /* Only C */
typedef struct st_vio Vio;
......
......@@ -84,6 +84,7 @@ const char *client_errors[]=
"This feature is not implemented yet",
"Lost connection to MySQL server at '%s', system error: %d",
"Statement closed indirectly because of a preceeding %s() call",
"The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again",
""
};
......@@ -149,6 +150,7 @@ const char *client_errors[]=
"This feature is not implemented yet",
"Lost connection to MySQL server at '%s', system error: %d",
"Statement closed indirectly because of a preceeding %s() call",
"The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again",
""
};
......@@ -212,6 +214,7 @@ const char *client_errors[]=
"This feature is not implemented yet",
"Lost connection to MySQL server at '%s', system error: %d",
"Statement closed indirectly because of a preceeding %s() call",
"The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again",
""
};
#endif
......
......@@ -1706,6 +1706,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *, MYSQL_FIELD *field);
#define RESET_SERVER_SIDE 1
#define RESET_LONG_DATA 2
#define RESET_STORE_RESULT 4
#define RESET_CLEAR_ERROR 8
static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags);
......@@ -2090,7 +2091,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length)
To be removed when all commands will fully support prepared mode.
*/
static unsigned int alloc_stmt_fields(MYSQL_STMT *stmt)
static void alloc_stmt_fields(MYSQL_STMT *stmt)
{
MYSQL_FIELD *fields, *field, *end;
MEM_ROOT *alloc= &stmt->mem_root;
......@@ -2108,7 +2109,10 @@ static unsigned int alloc_stmt_fields(MYSQL_STMT *stmt)
!(stmt->bind= (MYSQL_BIND *) alloc_root(alloc,
sizeof(MYSQL_BIND) *
stmt->field_count)))
return 0;
{
set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate, NULL);
return;
}
for (fields= mysql->fields, end= fields+stmt->field_count,
field= stmt->fields;
......@@ -2127,13 +2131,15 @@ static unsigned int alloc_stmt_fields(MYSQL_STMT *stmt)
field->def = fields->def ? strdup_root(alloc,fields->def): 0;
field->max_length= 0;
}
return stmt->field_count;
}
/*
/**
Update result set columns metadata if it was sent again in
reply to COM_STMT_EXECUTE.
@note If the new field count is different from the original one,
an error is set and no update is performed.
*/
static void update_stmt_fields(MYSQL_STMT *stmt)
......@@ -2143,7 +2149,22 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
MYSQL_FIELD *stmt_field= stmt->fields;
MYSQL_BIND *my_bind= stmt->bind_result_done ? stmt->bind : 0;
DBUG_ASSERT(stmt->field_count == stmt->mysql->field_count);
if (stmt->field_count != stmt->mysql->field_count)
{
/*
The tables used in the statement were altered,
and the query now returns a different number of columns.
There is no way to continue without reallocating the bind
array:
- if the number of columns increased, mysql_stmt_fetch()
will write beyond allocated memory
- if the number of columns decreased, some user-bound
buffers will be left unassigned without user knowing
that.
*/
set_stmt_error(stmt, CR_NEW_STMT_METADATA, unknown_sqlstate, NULL);
return;
}
for (; field < field_end; ++field, ++stmt_field)
{
......@@ -2792,6 +2813,50 @@ my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt,
}
/**
Update statement result set metadata from with the new field
information sent during statement execute.
@pre mysql->field_count is not zero
@retval TRUE if error: out of memory or the new
result set has a different number of columns
@retval FALSE success
*/
static void reinit_result_set_metadata(MYSQL_STMT *stmt)
{
/* Server has sent result set metadata */
if (stmt->field_count == 0)
{
/*
This is 'SHOW'/'EXPLAIN'-like query. Current implementation of
prepared statements can't send result set metadata for these queries
on prepare stage. Read it now.
*/
alloc_stmt_fields(stmt);
}
else
{
/*
Update result set metadata if it for some reason changed between
prepare and execute, i.e.:
- in case of 'SELECT ?' we don't know column type unless data was
supplied to mysql_stmt_execute, so updated column type is sent
now.
- if data dictionary changed between prepare and execute, for
example a table used in the query was altered.
Note, that now (4.1.3) we always send metadata in reply to
COM_STMT_EXECUTE (even if it is not necessary), so either this or
previous branch always works.
TODO: send metadata only when it's really necessary and add a warning
'Metadata changed' when it's sent twice.
*/
update_stmt_fields(stmt);
}
}
/*
Send placeholders data to server (if there are placeholders)
and execute prepared statement.
......@@ -2847,7 +2912,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
DBUG_RETURN(1);
}
if (reset_stmt_handle(stmt, RESET_STORE_RESULT))
if (reset_stmt_handle(stmt, RESET_STORE_RESULT | RESET_CLEAR_ERROR))
DBUG_RETURN(1);
/*
No need to check for stmt->state: if the statement wasn't
......@@ -2855,40 +2920,10 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
*/
if (mysql->methods->stmt_execute(stmt))
DBUG_RETURN(1);
if (mysql->field_count)
{
/* Server has sent result set metadata */
if (stmt->field_count == 0)
{
/*
This is 'SHOW'/'EXPLAIN'-like query. Current implementation of
prepared statements can't send result set metadata for these queries
on prepare stage. Read it now.
*/
alloc_stmt_fields(stmt);
}
else
{
/*
Update result set metadata if it for some reason changed between
prepare and execute, i.e.:
- in case of 'SELECT ?' we don't know column type unless data was
supplied to mysql_stmt_execute, so updated column type is sent
now.
- if data dictionary changed between prepare and execute, for
example a table used in the query was altered.
Note, that now (4.1.3) we always send metadata in reply to
COM_STMT_EXECUTE (even if it is not necessary), so either this or
previous branch always works.
TODO: send metadata only when it's really necessary and add a warning
'Metadata changed' when it's sent twice.
*/
update_stmt_fields(stmt);
}
}
stmt->state= MYSQL_STMT_EXECUTE_DONE;
if (stmt->field_count)
if (mysql->field_count)
{
reinit_result_set_metadata(stmt);
if (stmt->server_status & SERVER_STATUS_CURSOR_EXISTS)
{
mysql->status= MYSQL_STATUS_READY;
......@@ -2903,7 +2938,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
network or b) is more efficient if all (few) result set rows are
precached on client and server's resources are freed.
*/
DBUG_RETURN(mysql_stmt_store_result(stmt));
mysql_stmt_store_result(stmt);
}
else
{
......@@ -2912,7 +2947,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
stmt->read_row_func= stmt_read_row_unbuffered;
}
}
DBUG_RETURN(0);
DBUG_RETURN(test(stmt->last_errno));
}
......@@ -4766,6 +4801,12 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
DBUG_RETURN(1);
}
if (stmt->last_errno)
{
/* An attempt to use an invalid statement handle. */
DBUG_RETURN(1);
}
if (mysql->status == MYSQL_STATUS_READY &&
stmt->server_status & SERVER_STATUS_CURSOR_EXISTS)
{
......@@ -4973,9 +5014,10 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags)
stmt->state= MYSQL_STMT_INIT_DONE;
return 1;
}
stmt_clear_error(stmt);
}
}
if (flags & RESET_CLEAR_ERROR)
stmt_clear_error(stmt);
stmt->state= MYSQL_STMT_PREPARE_DONE;
}
return 0;
......@@ -4986,7 +5028,8 @@ my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt)
DBUG_ENTER("mysql_stmt_free_result");
/* Free the client side and close the server side cursor if there is one */
DBUG_RETURN(reset_stmt_handle(stmt, RESET_LONG_DATA | RESET_STORE_RESULT));
DBUG_RETURN(reset_stmt_handle(stmt, RESET_LONG_DATA | RESET_STORE_RESULT |
RESET_CLEAR_ERROR));
}
/********************************************************************
......@@ -5067,7 +5110,9 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
DBUG_RETURN(1);
}
/* Reset the client and server sides of the prepared statement */
DBUG_RETURN(reset_stmt_handle(stmt, RESET_SERVER_SIDE | RESET_LONG_DATA));
DBUG_RETURN(reset_stmt_handle(stmt,
RESET_SERVER_SIDE | RESET_LONG_DATA |
RESET_CLEAR_ERROR));
}
/*
......
......@@ -285,7 +285,7 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
my_bool res;
int4store(header, stmt->stmt_id);
header[4]= (uchar)stmt->flags;
header[4]= (uchar) stmt->flags;
thd= (THD*)stmt->mysql->thd;
thd->client_param_count= stmt->param_count;
thd->client_params= stmt->params;
......
......@@ -9,7 +9,8 @@ log_file
master.log
'#--------------------FN_DYNVARS_004_02------------------------#'
SET @@global.general_log_file = mytest.log;
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'log'
SET @@global.general_log_file = 12;
ERROR 42000: Incorrect argument type to variable 'general_log_file'
'#----------------------FN_DYNVARS_004_03------------------------#'
SELECT @@global.general_log_file = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
......
......@@ -1218,6 +1218,12 @@ DROP USER mysqltest_1@localhost;
DROP DATABASE db27878;
use test;
DROP TABLE t1;
#
# Bug#33275 Server crash when creating temporary table mysql.user
#
CREATE TEMPORARY TABLE mysql.user (id INT);
FLUSH PRIVILEGES;
DROP TABLE mysql.user;
drop table if exists test;
Warnings:
Note 1051 Unknown table 'test'
......
......@@ -15,9 +15,10 @@ FILE
SET @@global.log_output = NULL;
ERROR 42000: Variable 'log_output' can't be set to the value of 'NULL'
SET @@global.log_output = "";
ERROR 42000: Variable 'log_output' can't be set to the value of ''
SELECT @@global.log_output;
@@global.log_output
FILE
'Bug# 34838: Empty value is allowed where as it is not specified in';
'documentation';
'#--------------------FN_DYNVARS_065_03------------------------#'
......@@ -117,6 +118,7 @@ WHERE VARIABLE_NAME='log_output';
1
'#---------------------FN_DYNVARS_065_07-------------------------#'
SET @@global.log_output = 0;
ERROR 42000: Variable 'log_output' can't be set to the value of '0'
SELECT @@global.log_output;
@@global.log_output
......@@ -156,9 +158,10 @@ SELECT @@global.log_output;
@@global.log_output
NONE
SET @@global.log_output = FALSE;
ERROR 42000: Variable 'log_output' can't be set to the value of '0'
SELECT @@global.log_output;
@@global.log_output
NONE
'#---------------------FN_DYNVARS_065_09----------------------#'
SET log_output = ON;
ERROR HY000: Variable 'log_output' is a GLOBAL variable and should be set with SET GLOBAL
......
......@@ -249,4 +249,25 @@ set global slow_query_log_file= NULL;
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'NULL'
set global general_log_file= @old_general_log_file;
set global slow_query_log_file= @old_slow_query_log_file;
# --
# -- Bug#32748: Inconsistent handling of assignments to
# -- general_log_file/slow_query_log_file.
# --
SET @general_log_file_saved = @@global.general_log_file;
SET @slow_query_log_file_saved = @@global.slow_query_log_file;
SET GLOBAL general_log_file = 'bug32748.query.log';
SET GLOBAL slow_query_log_file = 'bug32748.slow.log';
SHOW VARIABLES LIKE '%log_file';
Variable_name Value
general_log_file bug32748.query.log
slow_query_log_file bug32748.slow.log
SET GLOBAL general_log_file = @general_log_file_saved;
SET GLOBAL slow_query_log_file = @slow_query_log_file_saved;
# -- End of Bug#32748.
End of 5.1 tests
......@@ -2902,4 +2902,22 @@ execute stmt;
ERROR 21000: Subquery returns more than 1 row
deallocate prepare stmt;
drop table t1, t2;
#
# Bug#27430 Crash in subquery code when in PS and table DDL changed
# after PREPARE
#
# This part of the test doesn't work in embedded server, this is
# why it's here. For the main test see ps_ddl*.test
drop table if exists t1;
create table t1 (a int);
prepare stmt from "show events where (1) in (select * from t1)";
execute stmt;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
drop table t1;
create table t1 (x int);
execute stmt;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
drop table t1;
deallocate prepare stmt;
End of 5.1 tests.
......@@ -143,32 +143,32 @@ b char(30)
);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
a b c
9 recreated table 9
a c b
9 9 recreated table
drop table t5 ;
create table t5
(
a int primary key,
b char(30),
c int,
d timestamp default current_timestamp
d timestamp default '2008-02-23 09:23:45'
);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
a b c
9 recreated table 9
a b c d
9 recreated table 9 2008-02-23 09:23:45
drop table t5 ;
create table t5
(
a int primary key,
d timestamp default current_timestamp,
d timestamp default '2008-02-23 09:23:45',
b char(30),
c int
);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
a b c
9 recreated table 9
a d b c
9 2008-02-23 09:23:45 recreated table 9
drop table t5 ;
create table t5
(
......@@ -189,7 +189,8 @@ f3 int
);
insert into t5( f1, f2, f3) values( 9, 'recreated table', 9);
execute stmt2 ;
ERROR 42S22: Unknown column 'test.t5.a' in 'field list'
f1 f2 f3
9 recreated table 9
drop table t5 ;
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
execute stmt1 ;
......
This diff is collapsed.
This diff is collapsed.
......@@ -18,3 +18,4 @@ Variable_name Value
Qcache_queries_in_cache 0
drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00;
SET @@global.query_cache_size=0;
set @@global.table_definition_cache=@save_table_definition_cache;
......@@ -9,7 +9,8 @@ RIGHT(@@global.slow_query_log_file,15)
master-slow.log
'#--------------------FN_DYNVARS_004_02------------------------#'
SET @@global.slow_query_log_file = mytest.log;
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'log'
SET @@global.slow_query_log_file = 12;
ERROR 42000: Incorrect argument type to variable 'slow_query_log_file'
'#----------------------FN_DYNVARS_004_03------------------------#'
SELECT @@global.slow_query_log_file = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
......
SET @start_value = @@global.table_definition_cache;
SELECT @start_value;
@start_value
128
256
'#--------------------FN_DYNVARS_019_01------------------------#'
SET @@global.table_definition_cache = 100;
Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '100'
SET @@global.table_definition_cache = DEFAULT;
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
128
256
'#---------------------FN_DYNVARS_019_02-------------------------#'
SET @@global.table_definition_cache = DEFAULT;
SELECT @@global.table_definition_cache = 128;
@@global.table_definition_cache = 128
1
0
'#--------------------FN_DYNVARS_019_03------------------------#'
SET @@global.table_definition_cache = 1;
Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '1'
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
1
256
SET @@global.table_definition_cache = 2;
Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '2'
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
2
256
SET @@global.table_definition_cache = 524287;
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
......@@ -36,13 +42,13 @@ Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '0'
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
1
256
SET @@global.table_definition_cache = -1024;
Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '0'
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
1
256
SET @@global.table_definition_cache = 524289;
Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '524289'
......@@ -73,17 +79,21 @@ WHERE VARIABLE_NAME='table_definition_cache';
1
'#---------------------FN_DYNVARS_019_07----------------------#'
SET @@global.table_definition_cache = TRUE;
Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '1'
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
1
256
SET @@global.table_definition_cache = FALSE;
Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '0'
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
1
256
'#---------------------FN_DYNVARS_019_08----------------------#'
SET @@global.table_definition_cache = 5;
Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '5'
SELECT @@table_definition_cache = @@global.table_definition_cache;
@@table_definition_cache = @@global.table_definition_cache
1
......@@ -99,4 +109,4 @@ ERROR 42S22: Unknown column 'table_definition_cache' in 'field list'
SET @@global.table_definition_cache = @start_value;
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
128
256
......@@ -820,7 +820,6 @@ call p1();
drop trigger t1_bi;
create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id);
execute stmt1;
ERROR 42S02: Table 'test.t3' doesn't exist
call p1();
ERROR 42S02: Table 'test.t3' doesn't exist
deallocate prepare stmt1;
......
......@@ -1014,3 +1014,13 @@ Variable_name='table_lock_wait_timeout';
Variable_name Value
table_definition_cache #
table_lock_wait_timeout #
# --
# -- Bug#34820: log_output can be set to illegal value.
# --
SET GLOBAL log_output = '';
ERROR 42000: Variable 'log_output' can't be set to the value of ''
SET GLOBAL log_output = 0;
ERROR 42000: Variable 'log_output' can't be set to the value of '0'
# -- End of Bug#34820.
......@@ -10,7 +10,6 @@
#
##############################################################################
federated_transactions : Bug#29523 Transactions do not work
ps_ddl : Bug#12093 2007-12-14 pending WL#4165 / WL#4166
csv_alter_table : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables
user_limits : Bug#23921 random failure of user_limits.test
thread_cache_size_func : Bug#36733 main.thread_cache_size_func fails randomly
......
......@@ -52,8 +52,11 @@ SELECT RIGHT(@@global.general_log_file,10) AS log_file;
# Change the value of general_log_file to a invalid value #
#######################################################################
--Error ER_WRONG_VALUE_FOR_VAR
# Assumed text if no quotes or numbers.
SET @@global.general_log_file = mytest.log;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.general_log_file = 12;
--echo '#----------------------FN_DYNVARS_004_03------------------------#'
##############################################################################
......
......@@ -1266,6 +1266,12 @@ DROP DATABASE db27878;
use test;
DROP TABLE t1;
--echo #
--echo # Bug#33275 Server crash when creating temporary table mysql.user
--echo #
CREATE TEMPORARY TABLE mysql.user (id INT);
FLUSH PRIVILEGES;
DROP TABLE mysql.user;
#
# Bug #33201 Crash occurs when granting update privilege on one column of a view
#
......
......@@ -59,6 +59,7 @@ SELECT @@global.log_output;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.log_output = NULL;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.log_output = "";
SELECT @@global.log_output;
--echo 'Bug# 34838: Empty value is allowed where as it is not specified in';
......@@ -171,6 +172,7 @@ WHERE VARIABLE_NAME='log_output';
###################################################################
# test if variable accepts 0,1,2
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.log_output = 0;
SELECT @@global.log_output;
......@@ -206,6 +208,7 @@ SET @@global.log_output = 8;
SET @@global.log_output = TRUE;
SELECT @@global.log_output;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.log_output = FALSE;
SELECT @@global.log_output;
......
......@@ -231,6 +231,34 @@ set global slow_query_log_file= NULL;
set global general_log_file= @old_general_log_file;
set global slow_query_log_file= @old_slow_query_log_file;
###########################################################################
--echo
--echo # --
--echo # -- Bug#32748: Inconsistent handling of assignments to
--echo # -- general_log_file/slow_query_log_file.
--echo # --
--echo
SET @general_log_file_saved = @@global.general_log_file;
SET @slow_query_log_file_saved = @@global.slow_query_log_file;
--echo
SET GLOBAL general_log_file = 'bug32748.query.log';
SET GLOBAL slow_query_log_file = 'bug32748.slow.log';
--echo
SHOW VARIABLES LIKE '%log_file';
--echo
SET GLOBAL general_log_file = @general_log_file_saved;
SET GLOBAL slow_query_log_file = @slow_query_log_file_saved;
--echo
--echo # -- End of Bug#32748.
###########################################################################
--echo End of 5.1 tests
--enable_ps_protocol
......
......@@ -2979,6 +2979,24 @@ execute stmt;
deallocate prepare stmt;
drop table t1, t2;
--echo #
--echo # Bug#27430 Crash in subquery code when in PS and table DDL changed
--echo # after PREPARE
--echo #
--echo # This part of the test doesn't work in embedded server, this is
--echo # why it's here. For the main test see ps_ddl*.test
--echo
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int);
prepare stmt from "show events where (1) in (select * from t1)";
execute stmt;
drop table t1;
create table t1 (x int);
execute stmt;
drop table t1;
deallocate prepare stmt;
--echo End of 5.1 tests.
......@@ -181,7 +181,7 @@ create table t5
a int primary key,
b char(30),
c int,
d timestamp default current_timestamp
d timestamp default '2008-02-23 09:23:45'
);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
......@@ -191,7 +191,7 @@ drop table t5 ;
create table t5
(
a int primary key,
d timestamp default current_timestamp,
d timestamp default '2008-02-23 09:23:45',
b char(30),
c int
);
......@@ -218,7 +218,6 @@ create table t5
f3 int
);
insert into t5( f1, f2, f3) values( 9, 'recreated table', 9);
--error 1054
execute stmt2 ;
drop table t5 ;
......
This diff is collapsed.
This diff is collapsed.
......@@ -25,6 +25,15 @@ while ($1)
}
--enable_warnings
#
# In order for the test to pass in --ps-protocol, we must
# set table_definition_cache size to at least 258 elements.
# Otherwise table versions are bound to change between
# prepare and execute, and we will get a constant validation
# error. See WL#4165 for details.
#
set @save_table_definition_cache= @@global.table_definition_cache;
set @@global.table_definition_cache=512;
create table t00 (a int) engine=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST;
enable_query_log;
select count(*) from t00;
......@@ -36,5 +45,6 @@ show status like "Qcache_queries_in_cache";
drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00;
SET @@global.query_cache_size=0;
set @@global.table_definition_cache=@save_table_definition_cache;
# End of 4.1 tests
......@@ -52,8 +52,10 @@ SELECT RIGHT(@@global.slow_query_log_file,15);
# Change the value of slow_query_log_file to a invalid value #
#######################################################################
--Error ER_WRONG_VALUE_FOR_VAR
# Assumed text if no quotes or numbers.
SET @@global.slow_query_log_file = mytest.log;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.slow_query_log_file = 12;
--echo '#----------------------FN_DYNVARS_004_03------------------------#'
##############################################################################
......
......@@ -997,11 +997,10 @@ call p1();
# Altering trigger forcing it use different set of tables
drop trigger t1_bi;
create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id);
# Until we implement proper mechanism for invalidation of PS/SP when table
# or SP's are changed these two statements will fail with 'Table ... was
# not locked' error (this mechanism should be based on the new TDC).
--error ER_NO_SUCH_TABLE
execute stmt1;
# Until we implement proper mechanism for invalidation of SP statements
# invoked whenever a table used in SP changes, this statement will fail with
# 'Table ... does not exist' error.
--error ER_NO_SUCH_TABLE
call p1();
deallocate prepare stmt1;
......
......@@ -778,3 +778,20 @@ set global thread_cache_size =@my_thread_cache_size;
--replace_column 2 #
show global variables where Variable_name='table_definition_cache' or
Variable_name='table_lock_wait_timeout';
###########################################################################
--echo
--echo # --
--echo # -- Bug#34820: log_output can be set to illegal value.
--echo # --
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL log_output = '';
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL log_output = 0;
--echo
--echo # -- End of Bug#34820.
......@@ -202,7 +202,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
{
if (mem_root->error_handler)
(*mem_root->error_handler)();
return((void*) 0); /* purecov: inspected */
DBUG_RETURN((void*) 0); /* purecov: inspected */
}
mem_root->block_num++;
next->next= *prev;
......
......@@ -3161,6 +3161,49 @@ void Item_param::print(String *str, enum_query_type query_type)
}
/**
Preserve the original parameter types and values
when re-preparing a prepared statement.
@details Copy parameter type information and conversion
function pointers from a parameter of the old statement
to the corresponding parameter of the new one.
Move parameter values from the old parameters to the new
one. We simply "exchange" the values, which allows
to save on allocation and character set conversion in
case a parameter is a string or a blob/clob.
The old parameter gets the value of this one, which
ensures that all memory of this parameter is freed
correctly.
@param[in] src parameter item of the original
prepared statement
*/
void
Item_param::set_param_type_and_swap_value(Item_param *src)
{
unsigned_flag= src->unsigned_flag;
param_type= src->param_type;
set_param_func= src->set_param_func;
item_type= src->item_type;
item_result_type= src->item_result_type;
collation.set(src->collation);
maybe_null= src->maybe_null;
null_value= src->null_value;
max_length= src->max_length;
decimals= src->decimals;
state= src->state;
value= src->value;
decimal_value.swap(src->decimal_value);
str_value.swap(src->str_value);
str_value_ptr.swap(src->str_value_ptr);
}
/****************************************************************************
Item_copy_string
****************************************************************************/
......
......@@ -1684,6 +1684,7 @@ public:
bool eq(const Item *item, bool binary_cmp) const;
/** Item is a argument to a limit clause. */
bool limit_clause_param;
void set_param_type_and_swap_value(Item_param *from);
};
......
......@@ -114,6 +114,14 @@ public:
bool sign() const { return decimal_t::sign; }
void sign(bool s) { decimal_t::sign= s; }
uint precision() const { return intg + frac; }
/** Swap two my_decimal values */
void swap(my_decimal &rhs)
{
swap_variables(my_decimal, *this, rhs);
/* Swap the buffer pointers back */
swap_variables(decimal_digit_t *, buf, rhs.buf);
}
};
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -634,6 +634,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
my_printf_error(0, "MyISAM table '%s' is in use "
"(most likely by a MERGE table). Try FLUSH TABLES.",
MYF(0), name + dirname_length(name));
my_errno= HA_ERR_TABLE_EXIST;
goto err;
}
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment