Commit 3eb66207 authored by unknown's avatar unknown

Merge mysql.com:/home/alexi/mysql-5.0

into  mysql.com:/home/alexi/dev/mysql-5.0-1

parents c1f11183 f792dd0c
...@@ -752,6 +752,7 @@ sub mtr_ping_mysqld_server () { ...@@ -752,6 +752,7 @@ sub mtr_ping_mysqld_server () {
# #
############################################################################## ##############################################################################
# FIXME check that the pidfile contains the expected pid!
sub sleep_until_file_created ($$$) { sub sleep_until_file_created ($$$) {
my $pidfile= shift; my $pidfile= shift;
...@@ -762,7 +763,7 @@ sub sleep_until_file_created ($$$) { ...@@ -762,7 +763,7 @@ sub sleep_until_file_created ($$$) {
{ {
if ( -r $pidfile ) if ( -r $pidfile )
{ {
return 1; return $pid;
} }
# Check if it died after the fork() was successful # Check if it died after the fork() was successful
......
...@@ -2739,3 +2739,14 @@ DROP TABLE t1,t2; ...@@ -2739,3 +2739,14 @@ DROP TABLE t1,t2;
select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0; select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
x'10' + 0 X'10' + 0 b'10' + 0 B'10' + 0 x'10' + 0 X'10' + 0 b'10' + 0 B'10' + 0
16 16 2 2 16 16 2 2
CREATE TABLE BUG_12595(a varchar(100));
INSERT INTO BUG_12595 VALUES ('hakan%'), ('hakank'), ("ha%an");
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan*%' ESCAPE '*';
a
hakan%
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan**%' ESCAPE '**';
ERROR HY000: Incorrect arguments to ESCAPE
SELECT * FROM BUG_12595 WHERE a LIKE 'ha%%an' ESCAPE '%';
a
ha%an
DROP TABLE BUG_12595;
...@@ -2350,3 +2350,14 @@ DROP TABLE t1,t2; ...@@ -2350,3 +2350,14 @@ DROP TABLE t1,t2;
# #
select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0; select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
#
# BUG #12595
#
CREATE TABLE BUG_12595(a varchar(100));
INSERT INTO BUG_12595 VALUES ('hakan%'), ('hakank'), ("ha%an");
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan*%' ESCAPE '*';
-- error 1210
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan**%' ESCAPE '**';
SELECT * FROM BUG_12595 WHERE a LIKE 'ha%%an' ESCAPE '%';
DROP TABLE BUG_12595;
...@@ -975,7 +975,9 @@ innobase_query_caching_of_table_permitted( ...@@ -975,7 +975,9 @@ innobase_query_caching_of_table_permitted(
trx = check_trx_exists(thd); trx = check_trx_exists(thd);
if (trx->has_search_latch) { if (trx->has_search_latch) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
sql_print_error("The calling thread is holding the adaptive search, latch though calling innobase_query_caching_of_table_permitted."); sql_print_error("The calling thread is holding the adaptive "
"search, latch though calling "
"innobase_query_caching_of_table_permitted.");
} }
innobase_release_stat_resources(trx); innobase_release_stat_resources(trx);
...@@ -1291,7 +1293,8 @@ innobase_init(void) ...@@ -1291,7 +1293,8 @@ innobase_init(void)
&srv_log_group_home_dirs); &srv_log_group_home_dirs);
if (ret == FALSE || innobase_mirrored_log_groups != 1) { if (ret == FALSE || innobase_mirrored_log_groups != 1) {
sql_print_error("syntax error in innodb_log_group_home_dir, or a wrong number of mirrored log groups"); sql_print_error("syntax error in innodb_log_group_home_dir, or a "
"wrong number of mirrored log groups");
my_free(internal_innobase_data_file_path, my_free(internal_innobase_data_file_path,
MYF(MY_ALLOW_ZERO_PTR)); MYF(MY_ALLOW_ZERO_PTR));
...@@ -1593,7 +1596,8 @@ innobase_commit( ...@@ -1593,7 +1596,8 @@ innobase_commit(
if (trx->active_trans == 0 if (trx->active_trans == 0
&& trx->conc_state != TRX_NOT_STARTED) { && trx->conc_state != TRX_NOT_STARTED) {
sql_print_error("trx->active_trans == 0, but trx->conc_state != TRX_NOT_STARTED"); sql_print_error("trx->active_trans == 0, but trx->conc_state != "
"TRX_NOT_STARTED");
} }
if (all if (all
|| (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) { || (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
...@@ -1870,7 +1874,23 @@ try_again: ...@@ -1870,7 +1874,23 @@ try_again:
if (ret != 0) { if (ret != 0) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
sql_print_error("MySQL synchronous replication was not able to send the binlog to the slave within the timeout %lu. We assume that the slave has become inaccessible, and switch off synchronous replication until the communication to the slave works again. MySQL synchronous replication has sent binlog to the slave up to file %s, position %lu. This transaction needs it to be sent up to file %s, position %lu.", thd->variables.sync_replication_timeout, innobase_repl_file_name, (ulong)innobase_repl_pos, trx->repl_wait_binlog_name, (ulong)trx->repl_wait_binlog_pos); sql_print_error("MySQL synchronous replication was "
"not able to send the binlog to the "
"slave within the timeout %lu. We "
"assume that the slave has become "
"inaccessible, and switch off "
"synchronous replication until the "
"communication to the slave works "
"again. MySQL synchronous replication "
"has sent binlog to the slave up to "
"file %s, position %lu. This "
"transaction needs it to be sent up "
"to file %s, position %lu.",
thd->variables.sync_replication_timeout,
innobase_repl_file_name,
(ulong) innobase_repl_pos,
trx->repl_wait_binlog_name,
(ulong) trx->repl_wait_binlog_pos);
innobase_repl_state = 0; innobase_repl_state = 0;
...@@ -1921,7 +1941,9 @@ innobase_repl_report_sent_binlog( ...@@ -1921,7 +1941,9 @@ innobase_repl_report_sent_binlog(
if (innobase_repl_state == 0) { if (innobase_repl_state == 0) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
sql_print_warning("Switching MySQL synchronous replication on again at binlog file %s, position %lu", log_file_name, (ulong) end_offset); sql_print_warning("Switching MySQL synchronous replication on "
"again at binlog file %s, position %lu",
log_file_name, (ulong) end_offset);
innobase_repl_state = 1; innobase_repl_state = 1;
} }
...@@ -1938,7 +1960,14 @@ innobase_repl_report_sent_binlog( ...@@ -1938,7 +1960,14 @@ innobase_repl_report_sent_binlog(
|| (cmp == 0 && end_offset < innobase_repl_pos)) { || (cmp == 0 && end_offset < innobase_repl_pos)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
sql_print_error("MySQL synchronous replication has sent binlog to the slave up to file %s, position %lu, but now MySQL reports that it sent the binlog only up to file %s, position %lu", innobase_repl_file_name, (ulong)innobase_repl_pos, log_file_name, (ulong) end_offset); sql_print_error("MySQL synchronous replication has "
"sent binlog to the slave up to file "
"%s, position %lu, but now MySQL "
"reports that it sent the binlog only "
"up to file %s, position %lu",
innobase_repl_file_name,
(ulong) innobase_repl_pos,
log_file_name, (ulong) end_offset);
} }
} }
...@@ -2183,7 +2212,8 @@ innobase_close_connection( ...@@ -2183,7 +2212,8 @@ innobase_close_connection(
if (trx->active_trans == 0 if (trx->active_trans == 0
&& trx->conc_state != TRX_NOT_STARTED) { && trx->conc_state != TRX_NOT_STARTED) {
sql_print_error("trx->active_trans == 0, but trx->conc_state != TRX_NOT_STARTED"); sql_print_error("trx->active_trans == 0, but trx->conc_state != "
"TRX_NOT_STARTED");
} }
...@@ -2344,14 +2374,16 @@ ha_innobase::open( ...@@ -2344,14 +2374,16 @@ ha_innobase::open(
norm_name, NULL); norm_name, NULL);
if (NULL == ib_table) { if (NULL == ib_table) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB error:\n" sql_print_error("Cannot find table %s from the internal data "
"Cannot find table %s from the internal data dictionary\n" "dictionary\nof InnoDB though the .frm file "
"of InnoDB though the .frm file for the table exists. Maybe you\n" "for the table exists. Maybe you\nhave "
"have deleted and recreated InnoDB data files but have forgotten\n" "deleted and recreated InnoDB data files but "
"to delete the corresponding .frm files of InnoDB tables, or you\n" "have forgotten\nto delete the corresponding "
"have moved .frm files to another database?\n" ".frm files of InnoDB tables, or you\n"
"Look from section 15.1 of http://www.innodb.com/ibman.html\n" "have moved .frm files to another database?\n"
"how you can resolve the problem.\n", "Look from section 15.1 of "
"http://www.innodb.com/ibman.html\n"
"how you can resolve the problem.\n",
norm_name); norm_name);
free_share(share); free_share(share);
my_free((char*) upd_buff, MYF(0)); my_free((char*) upd_buff, MYF(0));
...@@ -2362,13 +2394,14 @@ ha_innobase::open( ...@@ -2362,13 +2394,14 @@ ha_innobase::open(
if (ib_table->ibd_file_missing && !thd->tablespace_op) { if (ib_table->ibd_file_missing && !thd->tablespace_op) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB error:\n" sql_print_error("MySQL is trying to open a table handle but "
"MySQL is trying to open a table handle but the .ibd file for\n" "the .ibd file for\ntable %s does not exist.\n"
"table %s does not exist.\n" "Have you deleted the .ibd file from the "
"Have you deleted the .ibd file from the database directory under\n" "database directory under\nthe MySQL datadir, "
"the MySQL datadir, or have you used DISCARD TABLESPACE?\n" "or have you used DISCARD TABLESPACE?\n"
"Look from section 15.1 of http://www.innodb.com/ibman.html\n" "Look from section 15.1 of "
"how you can resolve the problem.\n", "http://www.innodb.com/ibman.html\n"
"how you can resolve the problem.\n",
norm_name); norm_name);
free_share(share); free_share(share);
my_free((char*) upd_buff, MYF(0)); my_free((char*) upd_buff, MYF(0));
...@@ -2395,7 +2428,8 @@ ha_innobase::open( ...@@ -2395,7 +2428,8 @@ ha_innobase::open(
if (!row_table_got_default_clust_index(ib_table)) { if (!row_table_got_default_clust_index(ib_table)) {
if (primary_key >= MAX_KEY) { if (primary_key >= MAX_KEY) {
sql_print_error("Table %s has a primary key in InnoDB data dictionary, but not in MySQL!", name); sql_print_error("Table %s has a primary key in InnoDB data "
"dictionary, but not in MySQL!", name);
} }
((row_prebuilt_t*)innobase_prebuilt) ((row_prebuilt_t*)innobase_prebuilt)
...@@ -2409,7 +2443,15 @@ ha_innobase::open( ...@@ -2409,7 +2443,15 @@ ha_innobase::open(
ref_length = table->key_info[primary_key].key_length; ref_length = table->key_info[primary_key].key_length;
} else { } else {
if (primary_key != MAX_KEY) { if (primary_key != MAX_KEY) {
sql_print_error("Table %s has no primary key in InnoDB data dictionary, but has one in MySQL! If you created the table with a MySQL version < 3.23.54 and did not define a primary key, but defined a unique key with all non-NULL columns, then MySQL internally treats that key as the primary key. You can fix this error by dump + DROP + CREATE + reimport of the table.", name); sql_print_error("Table %s has no primary key in InnoDB data "
"dictionary, but has one in MySQL! If you "
"created the table with a MySQL version < "
"3.23.54 and did not define a primary key, "
"but defined a unique key with all non-NULL "
"columns, then MySQL internally treats that "
"key as the primary key. You can fix this "
"error by dump + DROP + CREATE + reimport "
"of the table.", name);
} }
((row_prebuilt_t*)innobase_prebuilt) ((row_prebuilt_t*)innobase_prebuilt)
...@@ -2426,7 +2468,9 @@ ha_innobase::open( ...@@ -2426,7 +2468,9 @@ ha_innobase::open(
and it will never be updated anyway. */ and it will never be updated anyway. */
if (key_used_on_scan != MAX_KEY) { if (key_used_on_scan != MAX_KEY) {
sql_print_warning("Table %s key_used_on_scan is %lu even though there is no primary key inside InnoDB.", name, (ulong) key_used_on_scan); sql_print_warning("Table %s key_used_on_scan is %lu even "
"though there is no primary key inside "
"InnoDB.", name, (ulong) key_used_on_scan);
} }
} }
...@@ -2581,7 +2625,10 @@ innobase_mysql_cmp( ...@@ -2581,7 +2625,10 @@ innobase_mysql_cmp(
charset = get_charset(charset_number, MYF(MY_WME)); charset = get_charset(charset_number, MYF(MY_WME));
if (charset == NULL) { if (charset == NULL) {
sql_print_error("InnoDB needs charset %lu for doing a comparison, but MySQL cannot find that charset.", (ulong) charset_number); sql_print_error("InnoDB needs charset %lu for doing "
"a comparison, but MySQL cannot "
"find that charset.",
(ulong) charset_number);
ut_a(0); ut_a(0);
} }
} }
...@@ -3147,7 +3194,10 @@ ha_innobase::write_row( ...@@ -3147,7 +3194,10 @@ ha_innobase::write_row(
if (prebuilt->trx != if (prebuilt->trx !=
(trx_t*) current_thd->ha_data[innobase_hton.slot]) { (trx_t*) current_thd->ha_data[innobase_hton.slot]) {
sql_print_error("The transaction object for the table handle is at %p, but for the current thread it is at %p", prebuilt->trx, (trx_t*) current_thd->ha_data[innobase_hton.slot]); sql_print_error("The transaction object for the table handle is at "
"%p, but for the current thread it is at %p",
prebuilt->trx,
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
fputs("InnoDB: Dump of 200 bytes around prebuilt: ", stderr); fputs("InnoDB: Dump of 200 bytes around prebuilt: ", stderr);
ut_print_buf(stderr, ((const byte*)prebuilt) - 100, 200); ut_print_buf(stderr, ((const byte*)prebuilt) - 100, 200);
...@@ -3635,7 +3685,9 @@ ha_innobase::unlock_row(void) ...@@ -3635,7 +3685,9 @@ ha_innobase::unlock_row(void)
if (last_query_id != user_thd->query_id) { if (last_query_id != user_thd->query_id) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
sql_print_error("last_query_id is %lu != user_thd_query_id is %lu", (ulong) last_query_id, (ulong) user_thd->query_id); sql_print_error("last_query_id is %lu != user_thd_query_id is "
"%lu", (ulong) last_query_id,
(ulong) user_thd->query_id);
mem_analyze_corruption((byte *) prebuilt->trx); mem_analyze_corruption((byte *) prebuilt->trx);
ut_error; ut_error;
} }
...@@ -3927,9 +3979,10 @@ ha_innobase::change_active_index( ...@@ -3927,9 +3979,10 @@ ha_innobase::change_active_index(
} }
if (!prebuilt->index) { if (!prebuilt->index) {
sql_print_error( sql_print_error("Innodb could not find key n:o %u with name %s "
"Innodb could not find key n:o %u with name %s from dict cache for table %s", "from dict cache for table %s",
keynr, key ? key->name : "NULL", prebuilt->table->name); keynr, key ? key->name : "NULL",
prebuilt->table->name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -4501,7 +4554,12 @@ create_index( ...@@ -4501,7 +4554,12 @@ create_index(
|| col_type == DATA_FLOAT || col_type == DATA_FLOAT
|| col_type == DATA_DOUBLE || col_type == DATA_DOUBLE
|| col_type == DATA_DECIMAL) { || col_type == DATA_DECIMAL) {
sql_print_error("MySQL is trying to create a column prefix index field, on an inappropriate data type. Table name %s, column name %s.", table_name, key_part->field->field_name); sql_print_error("MySQL is trying to create a column "
"prefix index field, on an "
"inappropriate data type. Table "
"name %s, column name %s.",
table_name,
key_part->field->field_name);
prefix_len = 0; prefix_len = 0;
} }
...@@ -5385,7 +5443,14 @@ ha_innobase::info( ...@@ -5385,7 +5443,14 @@ ha_innobase::info(
for (i = 0; i < table->s->keys; i++) { for (i = 0; i < table->s->keys; i++) {
if (index == NULL) { if (index == NULL) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
sql_print_error("Table %s contains less indexes inside InnoDB than are defined in the MySQL .frm file. Have you mixed up .frm files from different installations? See section 15.1 at http://www.innodb.com/ibman.html", ib_table->name); sql_print_error("Table %s contains less "
"indexes inside InnoDB than "
"are defined in the MySQL "
".frm file. Have you mixed up "
".frm files from different "
"installations? See section "
"15.1 at http://www.innodb.com/ibman.html",
ib_table->name);
break; break;
} }
...@@ -5393,7 +5458,21 @@ ha_innobase::info( ...@@ -5393,7 +5458,21 @@ ha_innobase::info(
if (j + 1 > index->n_uniq) { if (j + 1 > index->n_uniq) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
sql_print_error("Index %s of %s has %lu columns unique inside InnoDB, but MySQL is asking statistics for %lu columns. Have you mixed up .frm files from different installations? See section 15.1 at http://www.innodb.com/ibman.html", index->name, ib_table->name, (unsigned long) index->n_uniq, j + 1); sql_print_error("Index %s of %s has "
"%lu columns unique "
"inside InnoDB, but "
"MySQL is asking "
"statistics for %lu "
"columns. Have you "
"mixed up .frm files "
"from different "
"installations? See "
"section 15.1 at "
"http://www.innodb.com/ibman.html",
index->name,
ib_table->name,
(unsigned long)
index->n_uniq, j + 1);
break; break;
} }
...@@ -5941,7 +6020,9 @@ ha_innobase::start_stmt( ...@@ -5941,7 +6020,9 @@ ha_innobase::start_stmt(
if (prebuilt->stored_select_lock_type != LOCK_S if (prebuilt->stored_select_lock_type != LOCK_S
&& prebuilt->stored_select_lock_type != LOCK_X) { && prebuilt->stored_select_lock_type != LOCK_X) {
sql_print_error("stored_select_lock_type is %lu inside ::start_stmt()!", prebuilt->stored_select_lock_type); sql_print_error("stored_select_lock_type is %lu inside "
"::start_stmt()!",
prebuilt->stored_select_lock_type);
/* Set the value to LOCK_X: this is just fault /* Set the value to LOCK_X: this is just fault
tolerance, we do not know what the correct value tolerance, we do not know what the correct value
...@@ -6717,7 +6798,8 @@ ha_innobase::innobase_read_and_init_auto_inc( ...@@ -6717,7 +6798,8 @@ ha_innobase::innobase_read_and_init_auto_inc(
error = 0; error = 0;
} else { } else {
/* This should not happen in a consistent read */ /* This should not happen in a consistent read */
sql_print_error("Consistent read of auto-inc column returned %lu", (ulong) error); sql_print_error("Consistent read of auto-inc column "
"returned %lu", (ulong) error);
auto_inc = -1; auto_inc = -1;
goto func_exit; goto func_exit;
...@@ -7042,7 +7124,8 @@ innobase_xa_prepare( ...@@ -7042,7 +7124,8 @@ innobase_xa_prepare(
if (trx->active_trans == 0 && trx->conc_state != TRX_NOT_STARTED) { if (trx->active_trans == 0 && trx->conc_state != TRX_NOT_STARTED) {
sql_print_error("trx->active_trans == 0, but trx->conc_state != TRX_NOT_STARTED"); sql_print_error("trx->active_trans == 0, but trx->conc_state != "
"TRX_NOT_STARTED");
} }
if (all if (all
......
...@@ -2792,6 +2792,12 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) ...@@ -2792,6 +2792,12 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
{ {
/* If we are on execution stage */ /* If we are on execution stage */
String *escape_str= escape_item->val_str(&tmp_value1); String *escape_str= escape_item->val_str(&tmp_value1);
/* ESCAPE must be 1 char in length.*/
if (escape_str && escape_str->numchars() != 1)
{
my_error(ER_WRONG_ARGUMENTS,MYF(0),"ESCAPE");
return TRUE;
}
escape= escape_str ? *(escape_str->ptr()) : '\\'; escape= escape_str ? *(escape_str->ptr()) : '\\';
/* /*
......
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