Commit a454821d authored by joerg@mysql.com's avatar joerg@mysql.com

Merge jbruehe@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/M50/mysql-5.0
parents 6493af18 d25c2e9d
......@@ -115,8 +115,8 @@ enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
The list of error codes to --error are stored in an internal array of
structs. This struct can hold numeric SQL error codes or SQLSTATE codes
as strings. The element next to the last active element in the list is
set to type ERR_EMPTY. When an SQL statement return an error we use
this list to check if this is an expected error.
set to type ERR_EMPTY. When an SQL statement returns an error, we use
this list to check if this is an expected error.
*/
enum match_err_type
......@@ -345,13 +345,6 @@ const char *command_names[]=
"connection",
"query",
"connect",
/* the difference between sleep and real_sleep is that sleep will use
the delay from command line (--sleep) if there is one.
real_sleep always uses delay from mysqltest's command line argument.
the logic is that sometimes delays are cpu-dependent (and --sleep
can be used to set this delay. real_sleep is used for cpu-independent
delays
*/
"sleep",
"real_sleep",
"inc",
......@@ -1045,8 +1038,8 @@ int do_source(struct st_query *query)
*p++= 0;
query->last_argument= p;
/*
If this file has already been sourced, dont source it again.
It's already available in the q_lines cache
If this file has already been sourced, don't source it again.
It's already available in the q_lines cache.
*/
if (parser.current_line < (parser.read_lines - 1))
return 0;
......@@ -1370,7 +1363,7 @@ int do_modify_var(struct st_query *query, const char *name,
system <command>
Eval the query to expand any $variables in the command.
Execute the command withe the "system" command.
Execute the command with the "system" command.
NOTE
If mysqltest is executed from cygwin shell, the command will be
......@@ -1633,11 +1626,19 @@ int do_disable_rpl_parse(struct st_query *query __attribute__((unused)))
do_sleep()
q called command
real_sleep use the value from opt_sleep as number of seconds to sleep
if real_sleep is false
DESCRIPTION
sleep <seconds>
real_sleep
real_sleep <seconds>
The difference between the sleep and real_sleep commands is that sleep
uses the delay from the --sleep command-line option if there is one.
(If the --sleep option is not given, the sleep command uses the delay
specified by its argument.) The real_sleep command always uses the
delay specified by its argument. The logic is that sometimes delays are
cpu-dependent, and --sleep can be used to set this delay. real_sleep is
used for cpu-independent delays.
*/
int do_sleep(struct st_query *query, my_bool real_sleep)
......@@ -1646,18 +1647,19 @@ int do_sleep(struct st_query *query, my_bool real_sleep)
char *p= query->first_argument;
char *sleep_start, *sleep_end= query->end;
double sleep_val;
char *cmd = (real_sleep ? "real_sleep" : "sleep");
while (my_isspace(charset_info, *p))
p++;
if (!*p)
die("Missing argument to sleep");
die("Missing argument to %s", cmd);
sleep_start= p;
/* Check that arg starts with a digit, not handled by my_strtod */
if (!my_isdigit(charset_info, *sleep_start))
die("Invalid argument to sleep \"%s\"", query->first_argument);
die("Invalid argument to %s \"%s\"", cmd, query->first_argument);
sleep_val= my_strtod(sleep_start, &sleep_end, &error);
if (error)
die("Invalid argument to sleep \"%s\"", query->first_argument);
die("Invalid argument to %s \"%s\"", cmd, query->first_argument);
/* Fixed sleep time selected by --sleep option */
if (opt_sleep && !real_sleep)
......@@ -2099,7 +2101,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user,
/*
Connect to a server and handle connection errors in case when they occur.
Connect to a server and handle connection errors in case they occur.
SYNOPSIS
connect_n_handle_errors()
......@@ -2534,7 +2536,7 @@ my_bool end_of_query(int c)
Normally that means it will read lines until it reaches the
"delimiter" that marks end of query. Default delimiter is ';'
The function should be smart enough not to detect delimiter's
found inside strings sorrounded with '"' and '\'' escaped strings.
found inside strings surrounded with '"' and '\'' escaped strings.
If the first line in a query starts with '#' or '-' this line is treated
as a comment. A comment is always terminated when end of line '\n' is
......@@ -2819,7 +2821,7 @@ static struct my_option my_long_options[] =
{"compress", 'C', "Use the compressed server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statment",
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.",
(gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0,
......@@ -2861,7 +2863,7 @@ static struct my_option my_long_options[] =
{"result-file", 'R', "Read/Store result from/in this file.",
(gptr*) &result_file, (gptr*) &result_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"server-arg", 'A', "Send enbedded server this as a paramenter.",
{"server-arg", 'A', "Send option value to embedded server as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-file", 'F', "Read embedded server arguments from file.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
......@@ -4315,7 +4317,7 @@ void get_query_type(struct st_query* q)
q->type=(enum enum_commands) type; /* Found command */
/*
If queries are disabled, only recognize
--enable-queries and --disable-queries
--enable_parsing and --disable_parsing
*/
if (parsing_disabled && q->type != Q_ENABLE_PARSING &&
q->type != Q_DISABLE_PARSING)
......@@ -4813,8 +4815,8 @@ int main(int argc, char **argv)
/*
my_stat() successful on result file. Check if we have not run a
single query, but we do have a result file that contains data.
Note that we don't care, if my_stat() fails. For example for
non-existing or non-readable file we assume it's fine to have
Note that we don't care, if my_stat() fails. For example, for a
non-existing or non-readable file, we assume it's fine to have
no query output from the test file, e.g. regarded as no error.
*/
die("No queries executed but result file found!");
......
This directory contains a test suite for mysql daemon. To run
This directory contains a test suite for the MySQL daemon. To run
the currently existing test cases, simply execute ./mysql-test-run in
this directory. It will fire up the newly built mysqld and test it.
If you want to run a test with a running MySQL server use the --extern
option to mysql-test-run. Please note that in this mode the test suite
expects user to specify test names to run. Otherwise it falls back to the
normal "non-extern" behaviour. The reason is that some tests
could not run with external server. Here is the sample command
to test "alias" and "analyze" tests on external server:
Note that you do not have to have to do "make install", and you could
actually have a co-existing MySQL installation. The tests will not
conflict with it.
mysql-test-run --extern alias analyze
All tests must pass. If one or more of them fail on your system, please
read the following manual section for instructions on how to report the
problem:
To match your setup you might also need to provide --socket, --user and
other relevant options.
http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html
Note that you do not have to have to do make install, and you could
actually have a co-existing MySQL installation - the tests will not
conflict with it.
If you want to use an already running MySQL server for specific tests,
use the --extern option to mysql-test-run. Please note that in this mode,
the test suite expects you to provide the names of the tests to run.
For example, here is the command to run the "alias" and "analyze" tests
with an external server:
All tests must pass. If one or more of them fail on your system, please
read the following manual section of how to report the problem:
mysql-test-run --extern alias analyze
To match your setup, you might also need to provide --socket, --user, and
other relevant options.
http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html
With no test cases named on the command line, mysql-test-run falls back
to the normal "non-extern" behavior. The reason for this is that some
tests cannot run with an external server.
You can create your own test cases. To create a test case:
You can create your own test cases. To create a test case, create a new
file in the t subdirectory using a text editor. The file should have a .test
extension. For example:
xemacs t/test_case_name.test
in the file, put a set of SQL commands that will create some tables,
load test data, run some queries to manipulate it.
In the file, put a set of SQL statements that create some tables,
load test data, and run some queries to manipulate it.
We would appreciate if the test tables were called t1, t2, t3 ... (to not
We would appreciate it if you name your test tables t1, t2, t3 ... (to not
conflict too much with existing tables).
Your test should begin by dropping the tables you are going to create and
end by dropping them again. This will ensure that one can run the test
over and over again.
end by dropping them again. This ensures that you can run the test over
and over again.
If you are using mysqltest commands (like result file names) in your
test case you should do create the result file as follows:
test case, you should create the result file as follows:
mysql-test-run --record test_case_name
......@@ -47,8 +53,8 @@ You can create your own test cases. To create a test case:
mysqltest --record < t/test_case_name.test
If you only have a simple test cases consistent of SQL commands and comments
you can create the test case one of the following ways:
If you only have a simple test cases consisting of SQL statements and
comments, you can create the test case in one of the following ways:
mysql-test-run --record test_case_name
......@@ -57,11 +63,11 @@ You can create your own test cases. To create a test case:
mysqltest --record --record-file=r/test_case_name.result < t/test_case_name.test
When this is done, take a look at r/test_case_name.result
- If the result is wrong, you have found a bug; In this case you should
- If the result is incorrect, you have found a bug. In this case, you should
edit the test result to the correct results so that we can verify
that the bug is corrected in future releases.
To submit your test case, put your .test file and .result file(s) into
a tar.gz archive, add a README that explains the problem, ftp the
archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail
archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail
to bugs@lists.mysql.com
To be able to see the level of coverage with the current test suite,
do the following:
- make sure gcov is installed
- compile with BUILD/compile-pentium-gcov ( if your machine is not pentium, hack
this script, or just live with the pentium-specific stuff)
- ./mysql-test-run -gcov
- to see the level of coverage for a given source file:
- Make sure gcov is installed
- Compile the MySQL distribution with BUILD/compile-pentium-gcov (if your
machine does not have a pentium CPU, hack this script, or just live with
the pentium-specific stuff)
- In the mysql-test directory, run this command: ./mysql-test-run -gcov
- To see the level of coverage for a given source file:
grep source_file_name /tmp/gcov.out
- to see which lines are not yet covered, look at source_file_name.gcov in the source tree. Then think hard about a test case that will cover those
lines, and write one!
- To see which lines are not yet covered, look at source_file_name.gcov in
the source tree. Then think hard about a test case that will cover those
lines, and write one!
......@@ -901,7 +901,7 @@ show_failed_diff ()
$DIFF -c $result_file $reject_file
echo "-------------------------------------------------------"
echo "Please follow the instructions outlined at"
echo "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html"
echo "http://dev.mysql.com/doc/mysql/en/reporting-mysqltest-bugs.html"
echo "to find the reason to this problem and how to report this."
echo ""
fi
......@@ -997,7 +997,7 @@ report_stats () {
$ECHO "The log files in $MY_LOG_DIR may give you some hint"
$ECHO "of what went wrong."
$ECHO "If you want to report this error, please read first the documentation at"
$ECHO "http://www.mysql.com/doc/en/MySQL_test_suite.html"
$ECHO "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html"
fi
if [ $USE_RUNNING_SERVER -eq 0 ]
......
......@@ -332,3 +332,12 @@ SELECT * FROM t1;
col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 col15 col16 col17 col18 col19 col20 col21 col22 col23 col24 col25 col26 col27 col28 col29 col30 col31 col32 col33 col34 col35 col36 col37 col38 fix1 fix2 fix3 fix4 fix5 fix6 fix7 fix8 fix9 fix10 fix11 fix12 fix13 fix14 fix15 fix16 fix17 fix18 fix19 fix20 fix21 fix22 fix23 fix24 fix25 fix26 fix27 fix28 fix29 fix30
9 99 999 9999 99999 999999 9999999 99999999 999999999 9999999999 99999999999 999999999999 9999999999999 99999999999999 999999999999999 9999999999999999 99999999999999999 999999999999999999 9999999999999999999 99999999999999999999 999999999999999999999 9999999999999999999999 99999999999999999999999 999999999999999999999999 9999999999999999999999999 99999999999999999999999999 999999999999999999999999999 9999999999999999999999999999 99999999999999999999999999999 999999999999999999999999999999 9999999999999999999999999999999 99999999999999999999999999999999 999999999999999999999999999999999 9999999999999999999999999999999999 99999999999999999999999999999999999 999999999999999999999999999999999999 9999999999999999999999999999999999999 99999999999999999999999999999999999999 9999999999999999999999999999999999999.9 999999999999999999999999999999999999.99 99999999999999999999999999999999999.999 9999999999999999999999999999999999.9999 999999999999999999999999999999999.99999 99999999999999999999999999999999.999999 9999999999999999999999999999999.9999999 999999999999999999999999999999.99999999 99999999999999999999999999999.999999999 9999999999999999999999999999.9999999999 999999999999999999999999999.99999999999 99999999999999999999999999.999999999999 9999999999999999999999999.9999999999999 999999999999999999999999.99999999999999 99999999999999999999999.999999999999999 9999999999999999999999.9999999999999999 999999999999999999999.99999999999999999 99999999999999999999.999999999999999999 9999999999999999999.9999999999999999999 999999999999999999.99999999999999999999 99999999999999999.999999999999999999999 9999999999999999.9999999999999999999999 999999999999999.99999999999999999999999 99999999999999.999999999999999999999999 9999999999999.9999999999999999999999999 999999999999.99999999999999999999999999 99999999999.999999999999999999999999999 9999999999.9999999999999999999999999999 999999999.99999999999999999999999999999 99999999.999999999999999999999999999999
DROP TABLE t1;
create table t1 (bigint_col bigint unsigned);
insert into t1 values (17666000000000000000);
select * from t1 where bigint_col=17666000000000000000;
bigint_col
17666000000000000000
select * from t1 where bigint_col='17666000000000000000';
bigint_col
17666000000000000000
drop table t1;
......@@ -677,6 +677,11 @@ select t1.b from v1a;
ERROR 42S22: Unknown column 't1.b' in 'field list'
select * from v1a join v1b on t1.b = t2.b;
ERROR 42S22: Unknown column 't1.b' in 'on clause'
select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user';
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 20 60 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 5 16 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
drop table t1;
drop table t2;
drop table t3;
......
......@@ -297,7 +297,9 @@ here is the sourced script
In loop
here is the sourced script
mysqltest: At line 1: Missing argument to sleep
mysqltest: At line 1: Missing argument to real_sleep
mysqltest: At line 1: Invalid argument to sleep "abc"
mysqltest: At line 1: Invalid argument to real_sleep "abc"
1
2
101
......
......@@ -270,3 +270,12 @@ VALUES (9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
SELECT * FROM t1;
DROP TABLE t1;
#bug #9088 BIGINT WHERE CLAUSE
create table t1 (bigint_col bigint unsigned);
insert into t1 values (17666000000000000000);
select * from t1 where bigint_col=17666000000000000000;
select * from t1 where bigint_col='17666000000000000000';
drop table t1;
......@@ -523,6 +523,12 @@ select t1.b from v1a;
-- error 1054
select * from v1a join v1b on t1.b = t2.b;
#
# Bug #17523 natural join and information_schema
#
select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user';
drop table t1;
drop table t2;
drop table t3;
......
# Embedded server doesn't support external clients
--source include/not_embedded.inc
# Windows does not have SOCKET, but will try to create a PIPE as well as MEMORY
--source include/not_windows.inc
# test for Bug #4998 "--protocol doesn't reject bad values"
......
......@@ -667,10 +667,14 @@ real_sleep 1;
# Missing parameter
--error 1
--exec echo "sleep ;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "real_sleep ;" | $MYSQL_TEST 2>&1
# Illegal parameter
--error 1
--exec echo "sleep abc;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "real_sleep abc;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
# Test inc
......
......@@ -1887,9 +1887,10 @@ class Item_int_with_ref :public Item_int
{
Item *ref;
public:
Item_int_with_ref(longlong i, Item *ref_arg) :Item_int(i), ref(ref_arg)
Item_int_with_ref(longlong i, Item *ref_arg, my_bool unsigned_arg) :
Item_int(i), ref(ref_arg)
{
unsigned_flag= ref_arg->unsigned_flag;
unsigned_flag= unsigned_arg;
}
int save_in_field(Field *field, bool no_conversions)
{
......
......@@ -216,7 +216,8 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
field->table->in_use->variables.sql_mode|= MODE_INVALID_DATES;
if (!(*item)->save_in_field(field, 1) && !((*item)->null_value))
{
Item *tmp=new Item_int_with_ref(field->val_int(), *item);
Item *tmp=new Item_int_with_ref(field->val_int(), *item,
test(field->flags & UNSIGNED_FLAG));
field->table->in_use->variables.sql_mode= orig_sql_mode;
if (tmp)
thd->change_item_tree(item, tmp);
......
......@@ -229,8 +229,12 @@ static int net_data_is_ready(my_socket sd)
struct timeval tv;
int res;
#ifndef __WIN__
/* Windows uses an _array_ of 64 fd's as default, so it's safe */
if (sd >= FD_SETSIZE)
return -1;
#define NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
#endif
FD_ZERO(&sfds);
FD_SET(sd, &sfds);
......@@ -271,7 +275,7 @@ void net_clear(NET *net)
int count, ready;
DBUG_ENTER("net_clear");
#if !defined(EMBEDDED_LIBRARY)
while((ready= net_data_is_ready(net->vio->sd)) != 0)
while((ready= net_data_is_ready(net->vio->sd)) > 0)
{
/* The socket is ready */
if ((count= vio_read(net->vio, (char*) (net->buff),
......@@ -286,15 +290,27 @@ void net_clear(NET *net)
}
else
{
/* No data to read and 'net_data_is_ready' returned "don't know" */
if (ready == -1)
break;
DBUG_PRINT("info",("socket ready but only EOF to read - disconnected"));
net->error= 2;
break;
}
}
#ifdef NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
/* 'net_data_is_ready' returned "don't know" */
if (ready == -1)
{
/* Read unblocking to clear net */
my_bool old_mode;
if (!vio_blocking(net->vio, FALSE, &old_mode))
{
while ((count= vio_read(net->vio, (char*) (net->buff),
(uint32) net->max_packet)) > 0)
DBUG_PRINT("info",("skipped %d bytes from file: %s",
count, vio_description(net->vio)));
vio_blocking(net->vio, TRUE, &old_mode);
}
}
#endif
#endif
net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */
net->write_pos=net->buff;
......
......@@ -2595,8 +2595,15 @@ const char *Natural_join_column::db_name()
if (view_field)
return table_ref->view_db.str;
/*
Test that TABLE_LIST::db is the same as st_table_share::db to
ensure consistency. An exception are I_S schema tables, which
are inconsistent in this respect.
*/
DBUG_ASSERT(!strcmp(table_ref->db,
table_ref->table->s->db));
table_ref->table->s->db) ||
(table_ref->schema_table &&
table_ref->table->s->db[0] == 0));
return table_ref->db;
}
......@@ -2798,7 +2805,15 @@ const char *Field_iterator_table_ref::db_name()
else if (table_ref->is_natural_join)
return natural_join_it.column_ref()->db_name();
DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db));
/*
Test that TABLE_LIST::db is the same as st_table_share::db to
ensure consistency. An exception are I_S schema tables, which
are inconsistent in this respect.
*/
DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db) ||
(table_ref->schema_table &&
table_ref->table->s->db[0] == 0));
return table_ref->db;
}
......
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