summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc4
-rw-r--r--client/mysqldump.c61
-rw-r--r--client/mysqltest.c21
-rw-r--r--heap/hp_hash.c37
-rw-r--r--include/heap.h7
-rw-r--r--include/my_base.h10
-rw-r--r--include/my_bitmap.h6
-rw-r--r--include/myisam.h5
-rw-r--r--include/myisammrg.h5
-rw-r--r--innobase/btr/btr0btr.c2
-rw-r--r--innobase/btr/btr0cur.c6
-rw-r--r--innobase/btr/btr0sea.c4
-rw-r--r--innobase/buf/buf0buf.c8
-rw-r--r--innobase/dict/dict0dict.c66
-rw-r--r--innobase/dict/dict0load.c30
-rw-r--r--innobase/dict/dict0mem.c42
-rw-r--r--innobase/fil/fil0fil.c127
-rw-r--r--innobase/ibuf/ibuf0ibuf.c9
-rw-r--r--innobase/include/buf0buf.h14
-rw-r--r--innobase/include/buf0buf.ic2
-rw-r--r--innobase/include/data0data.h2
-rw-r--r--innobase/include/data0data.ic2
-rw-r--r--innobase/include/dict0dict.h53
-rw-r--r--innobase/include/dict0dict.ic10
-rw-r--r--innobase/include/dict0load.h23
-rw-r--r--innobase/include/dict0mem.h70
-rw-r--r--innobase/include/fil0fil.h104
-rw-r--r--innobase/include/mem0mem.h96
-rw-r--r--innobase/include/mem0mem.ic96
-rw-r--r--innobase/include/mtr0mtr.h8
-rw-r--r--innobase/include/mtr0mtr.ic4
-rw-r--r--innobase/include/os0file.h156
-rw-r--r--innobase/include/os0sync.h18
-rw-r--r--innobase/include/pars0pars.h6
-rw-r--r--innobase/include/pars0sym.h4
-rw-r--r--innobase/include/row0mysql.h51
-rw-r--r--innobase/include/row0sel.h10
-rw-r--r--innobase/include/sync0arr.h2
-rw-r--r--innobase/include/sync0ipm.ic4
-rw-r--r--innobase/include/sync0rw.h44
-rw-r--r--innobase/include/sync0rw.ic22
-rw-r--r--innobase/include/sync0sync.h16
-rw-r--r--innobase/include/sync0sync.ic8
-rw-r--r--innobase/include/trx0roll.h4
-rw-r--r--innobase/include/trx0sys.h2
-rw-r--r--innobase/include/trx0trx.h12
-rw-r--r--innobase/include/univ.i5
-rw-r--r--innobase/include/ut0dbg.h6
-rw-r--r--innobase/include/ut0mem.h21
-rw-r--r--innobase/include/ut0mem.ic12
-rw-r--r--innobase/include/ut0rnd.h10
-rw-r--r--innobase/include/ut0rnd.ic10
-rw-r--r--innobase/include/ut0ut.h15
-rw-r--r--innobase/lock/lock0lock.c42
-rw-r--r--innobase/log/log0recv.c6
-rw-r--r--innobase/mem/mem0mem.c34
-rw-r--r--innobase/os/os0file.c202
-rw-r--r--innobase/os/os0sync.c18
-rw-r--r--innobase/pars/pars0pars.c7
-rw-r--r--innobase/pars/pars0sym.c5
-rw-r--r--innobase/row/row0ins.c3
-rw-r--r--innobase/row/row0mysql.c58
-rw-r--r--innobase/row/row0sel.c13
-rw-r--r--innobase/row/row0umod.c3
-rw-r--r--innobase/row/row0upd.c3
-rw-r--r--innobase/sync/sync0arr.c4
-rw-r--r--innobase/sync/sync0rw.c12
-rw-r--r--innobase/sync/sync0sync.c13
-rw-r--r--innobase/trx/trx0rec.c24
-rw-r--r--innobase/trx/trx0roll.c4
-rw-r--r--innobase/trx/trx0sys.c2
-rw-r--r--innobase/trx/trx0trx.c4
-rw-r--r--innobase/ut/ut0dbg.c2
-rw-r--r--innobase/ut/ut0mem.c26
-rw-r--r--innobase/ut/ut0ut.c73
-rw-r--r--libmysqld/examples/Makefile.am1
-rw-r--r--myisam/mi_dynrec.c2
-rw-r--r--myisam/mi_range.c72
-rw-r--r--myisam/mi_test2.c22
-rw-r--r--myisam/rt_test.c79
-rw-r--r--myisam/sp_test.c84
-rw-r--r--myisammrg/myrg_range.c11
-rw-r--r--mysql-test/r/auto_increment.result2
-rw-r--r--mysql-test/r/bench_count_distinct.result2
-rw-r--r--mysql-test/r/case.result6
-rw-r--r--mysql-test/r/cast.result2
-rw-r--r--mysql-test/r/ctype_collate.result2
-rw-r--r--mysql-test/r/date_formats.result2
-rw-r--r--mysql-test/r/explain.result9
-rw-r--r--mysql-test/r/fulltext.result6
-rw-r--r--mysql-test/r/func_compress.result4
-rw-r--r--mysql-test/r/func_crypt.result2
-rw-r--r--mysql-test/r/func_default.result2
-rw-r--r--mysql-test/r/func_encrypt.result2
-rw-r--r--mysql-test/r/func_gconcat.result15
-rw-r--r--mysql-test/r/func_group.result2
-rw-r--r--mysql-test/r/func_if.result4
-rw-r--r--mysql-test/r/func_in.result2
-rw-r--r--mysql-test/r/func_math.result26
-rw-r--r--mysql-test/r/func_op.result4
-rw-r--r--mysql-test/r/func_regexp.result2
-rw-r--r--mysql-test/r/func_set.result2
-rw-r--r--mysql-test/r/func_str.result2
-rw-r--r--mysql-test/r/func_system.result2
-rw-r--r--mysql-test/r/func_test.result12
-rw-r--r--mysql-test/r/func_time.result2
-rw-r--r--mysql-test/r/gis.result22
-rw-r--r--mysql-test/r/grant.result24
-rw-r--r--mysql-test/r/group_by.result2
-rw-r--r--mysql-test/r/having.result2
-rw-r--r--mysql-test/r/innodb.result58
-rw-r--r--mysql-test/r/insert_update.result4
-rw-r--r--mysql-test/r/null.result6
-rw-r--r--mysql-test/r/olap.result2
-rw-r--r--mysql-test/r/order_by.result9
-rw-r--r--mysql-test/r/query_cache.result2
-rw-r--r--mysql-test/r/row.result2
-rw-r--r--mysql-test/r/rpl000001.result4
-rw-r--r--mysql-test/r/rpl_get_lock.result2
-rw-r--r--mysql-test/r/rpl_master_pos_wait.result2
-rw-r--r--mysql-test/r/rpl_server_id2.result3
-rw-r--r--mysql-test/r/select.result2
-rw-r--r--mysql-test/r/subselect.result181
-rw-r--r--mysql-test/r/type_blob.result2
-rw-r--r--mysql-test/r/type_float.result15
-rw-r--r--mysql-test/r/union.result4
-rw-r--r--mysql-test/r/varbinary.result2
-rw-r--r--mysql-test/r/variables.result6
-rw-r--r--mysql-test/t/explain.test11
-rw-r--r--mysql-test/t/fulltext.test1
-rw-r--r--mysql-test/t/func_gconcat.test10
-rw-r--r--mysql-test/t/grant.test23
-rw-r--r--mysql-test/t/innodb.test22
-rw-r--r--mysql-test/t/order_by.test10
-rw-r--r--mysql-test/t/rpl000015.test2
-rw-r--r--mysql-test/t/rpl_error_ignored_table.test2
-rw-r--r--mysql-test/t/rpl_log.test6
-rw-r--r--mysql-test/t/rpl_log_pos.test8
-rw-r--r--mysql-test/t/rpl_max_relay_size.test12
-rw-r--r--mysql-test/t/rpl_rotate_logs.test10
-rw-r--r--mysql-test/t/rpl_server_id2.test1
-rw-r--r--mysql-test/t/subselect.test34
-rw-r--r--mysql-test/t/type_float.test8
-rw-r--r--mysys/my_bitmap.c6
-rw-r--r--scripts/make_binary_distribution.sh1
-rw-r--r--sql/examples/ha_example.cc11
-rw-r--r--sql/field.cc9
-rw-r--r--sql/ha_berkeley.cc29
-rw-r--r--sql/ha_berkeley.h7
-rw-r--r--sql/ha_heap.cc34
-rw-r--r--sql/ha_heap.h5
-rw-r--r--sql/ha_innodb.cc103
-rw-r--r--sql/ha_innodb.h6
-rw-r--r--sql/ha_isam.cc23
-rw-r--r--sql/ha_isam.h6
-rw-r--r--sql/ha_myisam.cc26
-rw-r--r--sql/ha_myisam.h6
-rw-r--r--sql/ha_myisammrg.cc16
-rw-r--r--sql/ha_myisammrg.h6
-rw-r--r--sql/ha_ndbcluster.cc25
-rw-r--r--sql/ha_ndbcluster.h7
-rw-r--r--sql/handler.cc66
-rw-r--r--sql/handler.h25
-rw-r--r--sql/item_func.cc1
-rw-r--r--sql/item_subselect.cc107
-rw-r--r--sql/item_subselect.h4
-rw-r--r--sql/item_sum.cc8
-rw-r--r--sql/item_sum.h8
-rw-r--r--sql/key.cc76
-rw-r--r--sql/log_event.cc2
-rw-r--r--sql/mysql_priv.h5
-rw-r--r--sql/opt_range.cc81
-rw-r--r--sql/opt_range.h7
-rw-r--r--sql/opt_sum.cc2
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/sql_acl.cc22
-rw-r--r--sql/sql_base.cc11
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_class.h19
-rw-r--r--sql/sql_lex.cc3
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/sql_parse.cc4
-rw-r--r--sql/sql_select.cc52
-rw-r--r--sql/sql_select.h1
-rw-r--r--sql/sql_show.cc9
-rw-r--r--sql/sql_table.cc12
-rw-r--r--sql/sql_union.cc39
-rw-r--r--sql/sql_yacc.yy4
-rw-r--r--strings/my_strtoll10.c14
-rw-r--r--tests/client_test.c5
190 files changed, 2144 insertions, 1607 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index ddc6441f08a..cf80a5594e4 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2404,6 +2404,10 @@ static int
com_shell(String *buffer, char *line __attribute__((unused)))
{
char *shell_cmd;
+
+ /* Skip space from line begin */
+ while (isspace(*line))
+ line++;
if (!(shell_cmd = strchr(line, ' ')))
{
put_info("Usage: \\! shell-command", INFO_ERROR);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 20792f8c025..97ae0070e04 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1264,18 +1264,32 @@ static char *field_escape(char *to,const char *from,uint length)
} /* field_escape */
+static char *alloc_query_str(ulong size)
+{
+ char *query;
+
+ if (!(query= (char*) my_malloc(size, MYF(MY_WME))))
+ {
+ ignore_errors= 0; /* Fatal error */
+ safe_exit(EX_MYSQLERR); /* Force exit */
+ }
+ return query;
+}
+
/*
** dumpTable saves database contents as a series of INSERT statements.
*/
static void dumpTable(uint numFields, char *table)
{
- char query[QUERY_LENGTH], *end, buff[256],table_buff[NAME_LEN+3];
+ char query_buf[QUERY_LENGTH], *end, buff[256],table_buff[NAME_LEN+3];
char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table;
+ char *query= query_buf;
MYSQL_RES *res;
MYSQL_FIELD *field;
MYSQL_ROW row;
ulong rownr, row_break, total_length, init_length;
const char *table_type;
+ int error= 0;
result_table= quote_name(table,table_buff, 1);
opt_quoted_table= quote_name(table, table_buff2, 0);
@@ -1321,8 +1335,11 @@ static void dumpTable(uint numFields, char *table)
sprintf(buff," FROM %s", result_table);
end= strmov(end,buff);
if (where)
- end= strxmov(end, " WHERE ",where,NullS);
- if (mysql_query(sock, query))
+ {
+ query= alloc_query_str((ulong) (strlen(where) + (end - query) + 10));
+ end= strxmov(query, query_buf, " WHERE ", where, NullS);
+ }
+ if (mysql_real_query(sock, query, (uint) (end - query)))
{
DBerror(sock, "when executing 'SELECT INTO OUTFILE'");
return;
@@ -1339,14 +1356,16 @@ static void dumpTable(uint numFields, char *table)
{
if (!opt_xml && opt_comments)
fprintf(md_result_file,"-- WHERE: %s\n",where);
- strxmov(strend(query), " WHERE ",where,NullS);
+ query= alloc_query_str((ulong) (strlen(where) + strlen(query) + 10));
+ strxmov(query, query_buf, " WHERE ", where, NullS);
}
if (!opt_xml && !opt_compact)
fputs("\n", md_result_file);
if (mysql_query(sock, query))
{
DBerror(sock, "when retrieving data from server");
- return;
+ error= EX_CONSCHECK;
+ goto err;
}
if (quick)
res=mysql_use_result(sock);
@@ -1355,7 +1374,8 @@ static void dumpTable(uint numFields, char *table)
if (!res)
{
DBerror(sock, "when retrieving data from server");
- return;
+ error= EX_CONSCHECK;
+ goto err;
}
if (verbose)
fprintf(stderr, "-- Retrieving rows...\n");
@@ -1363,8 +1383,8 @@ static void dumpTable(uint numFields, char *table)
{
fprintf(stderr,"%s: Error in field count for table: %s ! Aborting.\n",
my_progname, result_table);
- safe_exit(EX_CONSCHECK);
- return;
+ error= EX_CONSCHECK;
+ goto err;
}
if (opt_disable_keys)
@@ -1402,8 +1422,8 @@ static void dumpTable(uint numFields, char *table)
sprintf(query,"%s: Not enough fields from table %s! Aborting.\n",
my_progname, result_table);
fputs(query,stderr);
- safe_exit(EX_CONSCHECK);
- return;
+ error= EX_CONSCHECK;
+ goto err;
}
if (extended_insert)
{
@@ -1422,7 +1442,8 @@ static void dumpTable(uint numFields, char *table)
if (dynstr_realloc(&extended_row,length * 2+2))
{
fputs("Aborting dump (out of memory)",stderr);
- safe_exit(EX_EOM);
+ error= EX_EOM;
+ goto err;
}
dynstr_append(&extended_row,"'");
extended_row.length +=
@@ -1458,7 +1479,8 @@ static void dumpTable(uint numFields, char *table)
else if (dynstr_append(&extended_row,"NULL"))
{
fputs("Aborting dump (out of memory)",stderr);
- safe_exit(EX_EOM);
+ error= EX_EOM;
+ goto err;
}
}
else
@@ -1552,8 +1574,8 @@ static void dumpTable(uint numFields, char *table)
result_table,
rownr);
fputs(query,stderr);
- safe_exit(EX_CONSCHECK);
- return;
+ error= EX_CONSCHECK;
+ goto err;
}
if (opt_lock)
fputs("UNLOCK TABLES;\n", md_result_file);
@@ -1563,7 +1585,16 @@ static void dumpTable(uint numFields, char *table)
if (opt_autocommit)
fprintf(md_result_file, "commit;\n");
mysql_free_result(res);
- }
+ if (query != query_buf)
+ my_free(query, MYF(MY_ALLOW_ZERO_PTR));
+ }
+ return;
+
+err:
+ if (query != query_buf)
+ my_free(query, MYF(MY_ALLOW_ZERO_PTR));
+ safe_exit(error);
+ return;
} /* dumpTable */
diff --git a/client/mysqltest.c b/client/mysqltest.c
index be5dac1c9d9..2cd395a02b8 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -1097,7 +1097,7 @@ int do_sync_with_master2(const char* p)
MYSQL_ROW row;
MYSQL* mysql = &cur_con->mysql;
char query_buf[FN_REFLEN+128];
- int offset = 0;
+ int offset= 0, tries= 0;
int rpl_parse;
if (!master_pos.file[0])
@@ -1112,6 +1112,9 @@ int do_sync_with_master2(const char* p)
sprintf(query_buf, "select master_pos_wait('%s', %ld)", master_pos.file,
master_pos.pos + offset);
+
+wait_for_position:
+
if (mysql_query(mysql, query_buf))
die("line %u: failed in %s: %d: %s", start_lineno, query_buf,
mysql_errno(mysql), mysql_error(mysql));
@@ -1122,8 +1125,20 @@ int do_sync_with_master2(const char* p)
if (!(row = mysql_fetch_row(res)))
die("line %u: empty result in %s", start_lineno, query_buf);
if (!row[0])
- die("line %u: could not sync with master ('%s' returned NULL)",
- start_lineno, query_buf);
+ {
+ /*
+ It may be that the slave SQL thread has not started yet, though START
+ SLAVE has been issued ?
+ */
+ if (tries++ == 3)
+ {
+ die("line %u: could not sync with master ('%s' returned NULL)",
+ start_lineno, query_buf);
+ }
+ sleep(1); /* So at most we will wait 3 seconds and make 4 tries */
+ mysql_free_result(res);
+ goto wait_for_position;
+ }
mysql_free_result(res);
last_result=0;
if (rpl_parse)
diff --git a/heap/hp_hash.c b/heap/hp_hash.c
index d040f37aea0..38ed581fe58 100644
--- a/heap/hp_hash.c
+++ b/heap/hp_hash.c
@@ -29,19 +29,15 @@
hp_rb_records_in_range()
info HEAP handler
inx Index to use
- start_key Start of range. Null pointer if from first key
- start_key_len Length of start key
- start_search_flag Flag if start key should be included or not
- end_key End of range. Null pointer if to last key
- end_key_len Length of end key
- end_search_flag Flag if start key should be included or not
+ min_key Min key. Is = 0 if no min range
+ max_key Max key. Is = 0 if no max range
NOTES
- start_search_flag can have one of the following values:
+ min_key.flag can have one of the following values:
HA_READ_KEY_EXACT Include the key in the range
HA_READ_AFTER_KEY Don't include key in range
- end_search_flag can have one of the following values:
+ max_key.flag can have one of the following values:
HA_READ_BEFORE_KEY Don't include key in range
HA_READ_AFTER_KEY Include all 'end_key' values in the range
@@ -52,11 +48,8 @@
the range.
*/
-ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
- uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key, uint end_key_len,
- enum ha_rkey_function end_search_flag)
+ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key,
+ key_range *max_key)
{
ha_rows start_pos, end_pos;
HP_KEYDEF *keyinfo= info->s->keydef + inx;
@@ -67,12 +60,12 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
info->lastinx= inx;
custom_arg.keyseg= keyinfo->seg;
custom_arg.search_flag= SEARCH_FIND | SEARCH_SAME;
- if (start_key)
+ if (min_key)
{
custom_arg.key_length= hp_rb_pack_key(keyinfo, (uchar*) info->recbuf,
- (uchar*) start_key,
- start_key_len);
- start_pos= tree_record_pos(rb_tree, info->recbuf, start_search_flag,
+ (uchar*) min_key->key,
+ min_key->length);
+ start_pos= tree_record_pos(rb_tree, info->recbuf, min_key->flag,
&custom_arg);
}
else
@@ -80,11 +73,12 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
start_pos= 0;
}
- if (end_key)
+ if (max_key)
{
custom_arg.key_length= hp_rb_pack_key(keyinfo, (uchar*) info->recbuf,
- (uchar*) end_key, end_key_len);
- end_pos= tree_record_pos(rb_tree, info->recbuf, end_search_flag,
+ (uchar*) max_key->key,
+ max_key->length);
+ end_pos= tree_record_pos(rb_tree, info->recbuf, max_key->flag,
&custom_arg);
}
else
@@ -100,12 +94,13 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
(end_pos == start_pos ? (ha_rows) 1 : end_pos - start_pos));
}
+
/* Search after a record based on a key */
/* Sets info->current_ptr to found record */
/* next_flag: Search=0, next=1, prev =2, same =3 */
byte *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key,
- uint nextflag)
+ uint nextflag)
{
reg1 HASH_INFO *pos,*prev_ptr;
int flag;
diff --git a/include/heap.h b/include/heap.h
index b536937c8c0..63f2abbabc7 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -182,11 +182,8 @@ extern int heap_disable_indexes(HP_INFO *info);
extern int heap_enable_indexes(HP_INFO *info);
extern int heap_indexes_are_disabled(HP_INFO *info);
extern void heap_update_auto_increment(HP_INFO *info, const byte *record);
-ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
- uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key, uint end_key_len,
- enum ha_rkey_function end_search_flag);
+ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key,
+ key_range *max_key);
int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
uint key_len, enum ha_rkey_function find_flag);
extern gptr heap_find(HP_INFO *info,int inx,const byte *key);
diff --git a/include/my_base.h b/include/my_base.h
index 4a2f3f85083..f912cb4278c 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -349,6 +349,16 @@ enum data_file_type {
STATIC_RECORD,DYNAMIC_RECORD,COMPRESSED_RECORD
};
+/* For key ranges */
+
+typedef struct st_key_range
+{
+ const byte *key;
+ uint length;
+ enum ha_rkey_function flag;
+} key_range;
+
+
/* For number of records */
#ifdef BIG_TABLES
#define rows2double(A) ulonglong2double(A)
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index 5b3da011f54..a4511bf3414 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -55,6 +55,12 @@ extern void bitmap_set_bit(MY_BITMAP *map, uint bitmap_bit);
extern void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size);
extern void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2);
extern void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2);
+
+/* Fast, not thread safe, bitmap functions */
+#define bitmap_fast_set_bit(MAP, BIT) (MAP)->bitmap[(BIT) / 8] |= (1 << ((BIT) & 7))
+#define bitmap_fast_clear_bit(MAP, BIT) (MAP)->bitmap[(BIT) / 8] &= ~ (1 << ((BIT) & 7))
+#define bitmap_fast_is_set(MAP, BIT) (MAP)->bitmap[(BIT) / 8] & (1 << ((BIT) & 7))
+
#ifdef __cplusplus
}
#endif
diff --git a/include/myisam.h b/include/myisam.h
index 93e2dc15574..c99e9a30b08 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -231,10 +231,7 @@ extern int mi_extra(struct st_myisam_info *file,
enum ha_extra_function function,
void *extra_arg);
extern ha_rows mi_records_in_range(struct st_myisam_info *info,int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
+ key_range *min_key, key_range *max_key);
extern int mi_log(int activate_log);
extern int mi_is_changed(struct st_myisam_info *info);
extern int mi_delete_all_rows(struct st_myisam_info *info);
diff --git a/include/myisammrg.h b/include/myisammrg.h
index 8b09e1a9231..de8a36c2d0a 100644
--- a/include/myisammrg.h
+++ b/include/myisammrg.h
@@ -101,10 +101,7 @@ extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function,
void *extra_arg);
extern void myrg_extrafunc(MYRG_INFO *info,invalidator_by_filename inv);
extern ha_rows myrg_records_in_range(MYRG_INFO *info,int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
+ key_range *min_key, key_range *max_key);
extern ulonglong myrg_position(MYRG_INFO *info);
#ifdef __cplusplus
diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c
index 8388009dc9c..09f5c66f687 100644
--- a/innobase/btr/btr0btr.c
+++ b/innobase/btr/btr0btr.c
@@ -883,7 +883,7 @@ btr_page_reorganize_low(
fprintf(stderr,
"InnoDB: Error: page old data size %lu new data size %lu\n"
"InnoDB: Error: page old max ins size %lu new max ins size %lu\n"
-"InnoDB: Make a detailed bug report and send it to mysql@lists.mysql.com\n",
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
(unsigned long) data_size1, (unsigned long) data_size2,
(unsigned long) max_ins_size1,
(unsigned long) max_ins_size2);
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c
index e67d1d76113..5829cc2c406 100644
--- a/innobase/btr/btr0cur.c
+++ b/innobase/btr/btr0cur.c
@@ -399,7 +399,7 @@ btr_cur_search_to_nth_level(
retry_page_get:
page = buf_page_get_gen(space, page_no, rw_latch, guess,
buf_mode,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
if (page == NULL) {
/* This must be a search to perform an insert;
@@ -580,7 +580,7 @@ btr_cur_open_at_index_side(
for (;;) {
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
btr_page_get_index_id(page)));
@@ -689,7 +689,7 @@ btr_cur_open_at_rnd_pos(
for (;;) {
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
btr_page_get_index_id(page)));
diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
index f2b03f9f348..9384168df88 100644
--- a/innobase/btr/btr0sea.c
+++ b/innobase/btr/btr0sea.c
@@ -764,7 +764,7 @@ btr_search_guess_on_hash(
success = buf_page_get_known_nowait(latch_mode, page,
BUF_MAKE_YOUNG,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
rw_lock_s_unlock(&btr_search_latch);
@@ -1048,7 +1048,7 @@ btr_search_drop_page_hash_when_freed(
having to fear a deadlock. */
page = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL,
- BUF_GET_IF_IN_POOL, IB__FILE__, __LINE__,
+ BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr);
#ifdef UNIV_SYNC_DEBUG
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c
index 7a5ef3c5e14..4d83fb4c9f2 100644
--- a/innobase/buf/buf0buf.c
+++ b/innobase/buf/buf0buf.c
@@ -1048,7 +1048,7 @@ buf_page_get_gen(
buf_frame_t* guess, /* in: guessed frame or NULL */
ulint mode, /* in: BUF_GET, BUF_GET_IF_IN_POOL,
BUF_GET_NO_LATCH, BUF_GET_NOWAIT */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr) /* in: mini-transaction */
{
@@ -1257,7 +1257,7 @@ buf_page_optimistic_get_func(
frames */
dulint modify_clock,/* in: modify clock value if mode is
..._GUESS_ON_CLOCK */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr) /* in: mini-transaction */
{
@@ -1382,7 +1382,7 @@ buf_page_get_known_nowait(
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */
buf_frame_t* guess, /* in: the known page frame */
ulint mode, /* in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr) /* in: mini-transaction */
{
@@ -1742,7 +1742,7 @@ buf_page_create(
buf_LRU_add_block(block, FALSE);
#ifdef UNIV_SYNC_DEBUG
- buf_block_buf_fix_inc_debug(block, IB__FILE__, __LINE__);
+ buf_block_buf_fix_inc_debug(block, __FILE__, __LINE__);
#else
buf_block_buf_fix_inc(block);
#endif
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index b22d93d6bd8..6a6ac2492f8 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -70,7 +70,7 @@ dict_col_reposition_in_cache(
/*=========================*/
dict_table_t* table, /* in: table */
dict_col_t* col, /* in: column */
- char* new_name); /* in: new table name */
+ const char* new_name); /* in: new table name */
/**************************************************************************
Removes a column from the data dictionary hash table. */
static
@@ -309,7 +309,7 @@ dict_table_get_index_noninline(
/*===========================*/
/* out: index, NULL if does not exist */
dict_table_t* table, /* in: table */
- char* name) /* in: index name */
+ const char* name) /* in: index name */
{
return(dict_table_get_index(table, name));
}
@@ -693,9 +693,10 @@ directory dict_table_get_low is usually the appropriate function. */
dict_table_t*
dict_table_get(
/*===========*/
- /* out: table, NULL if does not exist */
- char* table_name, /* in: table name */
- trx_t* trx) /* in: transaction handle or NULL */
+ /* out: table, NULL if
+ does not exist */
+ const char* table_name, /* in: table name */
+ trx_t* trx) /* in: transaction handle or NULL */
{
dict_table_t* table;
@@ -722,9 +723,10 @@ Returns a table object and increments MySQL open handle count on the table. */
dict_table_t*
dict_table_get_and_increment_handle_count(
/*======================================*/
- /* out: table, NULL if does not exist */
- char* table_name, /* in: table name */
- trx_t* trx) /* in: transaction handle or NULL */
+ /* out: table, NULL if
+ does not exist */
+ const char* table_name, /* in: table name */
+ trx_t* trx) /* in: transaction handle or NULL */
{
dict_table_t* table;
@@ -886,7 +888,7 @@ dict_table_rename_in_cache(
/*=======================*/
/* out: TRUE if success */
dict_table_t* table, /* in: table */
- char* new_name, /* in: new name */
+ const char* new_name, /* in: new name */
ibool rename_also_foreigns)/* in: in ALTER TABLE we want
to preserve the original table name
in constraints which reference it */
@@ -1294,7 +1296,7 @@ dict_col_reposition_in_cache(
/*=========================*/
dict_table_t* table, /* in: table */
dict_col_t* col, /* in: column */
- char* new_name) /* in: new table name */
+ const char* new_name) /* in: new table name */
{
ulint fold;
@@ -2019,7 +2021,7 @@ dict_foreign_find_index(
column types must match */
{
dict_index_t* index;
- char* col_name;
+ const char* col_name;
ulint i;
index = dict_table_get_first_index(table);
@@ -2564,14 +2566,14 @@ static
char*
dict_strip_comments(
/*================*/
- /* out, own: SQL string stripped from
- comments; the caller must free this
- with mem_free()! */
- char* sql_string) /* in: SQL string */
+ /* out, own: SQL string stripped from
+ comments; the caller must free this
+ with mem_free()! */
+ const char* sql_string) /* in: SQL string */
{
- char* str;
- char* sptr;
- char* ptr;
+ char* str;
+ const char* sptr;
+ char* ptr;
str = mem_alloc(strlen(sql_string) + 1);
@@ -2970,7 +2972,8 @@ col_loop1:
}
foreign->foreign_table = table;
- foreign->foreign_table_name = table->name;
+ foreign->foreign_table_name = mem_heap_strdup(foreign->heap,
+ table->name);
foreign->foreign_index = index;
foreign->n_fields = i;
foreign->foreign_col_names = mem_heap_alloc(foreign->heap,
@@ -3244,16 +3247,19 @@ allowed to contain more fields than mentioned in the constraint. */
ulint
dict_create_foreign_constraints(
/*============================*/
- /* out: error code or DB_SUCCESS */
- trx_t* trx, /* in: transaction */
- char* sql_string, /* in: table create or ALTER TABLE
- statement where foreign keys are declared like:
- FOREIGN KEY (a, b) REFERENCES table2(c, d),
- table2 can be written also with the database
- name before it: test.table2; the default
- database is the database of parameter name */
- char* name) /* in: table full name in the normalized form
- database_name/table_name */
+ /* out: error code or DB_SUCCESS */
+ trx_t* trx, /* in: transaction */
+ const char* sql_string, /* in: table create statement where
+ foreign keys are declared like:
+ FOREIGN KEY (a, b) REFERENCES
+ table2(c, d), table2 can be written
+ also with the database
+ name before it: test.table2; the
+ default database id the database of
+ parameter name */
+ const char* name) /* in: table full name in the
+ normalized form
+ database_name/table_name */
{
char* str;
ulint err;
@@ -4287,5 +4293,5 @@ dict_index_name_print(
fputs("index ", file);
ut_print_name(file, index->name);
fputs(" of table ", file);
- ut_print_name(stderr, index->table_name);
+ ut_print_name(file, index->table_name);
}
diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c
index abb06b15ea7..071a3b4c684 100644
--- a/innobase/dict/dict0load.c
+++ b/innobase/dict/dict0load.c
@@ -27,9 +27,10 @@ Finds the first table name in the given database. */
char*
dict_get_first_table_name_in_db(
/*============================*/
- /* out, own: table name, NULL if does not exist;
- the caller must free the memory in the string! */
- char* name) /* in: database name which ends to '/' */
+ /* out, own: table name, NULL if
+ does not exist; the caller must
+ free the memory in the string! */
+ const char* name) /* in: database name which ends to '/' */
{
dict_table_t* sys_tables;
btr_pcur_t pcur;
@@ -389,8 +390,8 @@ Report that an index field or index for a table has been delete marked. */
static
void
dict_load_report_deleted_index(
- char* name, /* in: table name */
- ulint field) /* in: index field, or ULINT_UNDEFINED */
+ const char* name, /* in: table name */
+ ulint field) /* in: index field, or ULINT_UNDEFINED */
{
fputs("InnoDB: Error: data dictionary entry"
" for table ", stderr);
@@ -688,12 +689,13 @@ dictionary cache. */
dict_table_t*
dict_load_table(
/*============*/
- /* out: table, NULL if does not exist; if the table is
- stored in an .ibd file, but the file does not exist,
- then we set the ibd_file_missing flag TRUE in the table
- object we return */
- char* name) /* in: table name in the databasename/tablename
- format */
+ /* out: table, NULL if does not exist;
+ if the table is stored in an .ibd file,
+ but the file does not exist,
+ then we set the ibd_file_missing flag TRUE
+ in the table object we return */
+ const char* name) /* in: table name in the
+ databasename/tablename format */
{
ibool ibd_file_missing = FALSE;
dict_table_t* table;
@@ -849,7 +851,7 @@ dict_load_table(
"InnoDB: the foreign key table or the referenced table!\n"
"InnoDB: The data dictionary of InnoDB is corrupt. You may need to drop\n"
"InnoDB: and recreate the foreign key table or the referenced table.\n"
-"InnoDB: Send a detailed bug report to mysql@lists.mysql.com\n"
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
"InnoDB: Latest foreign key error printout:\n%s\n", dict_foreign_err_buf);
mutex_exit(&dict_foreign_err_mutex);
@@ -1185,8 +1187,8 @@ already in the dictionary cache. */
ulint
dict_load_foreigns(
/*===============*/
- /* out: DB_SUCCESS or error code */
- char* table_name) /* in: table name */
+ /* out: DB_SUCCESS or error code */
+ const char* table_name) /* in: table name */
{
btr_pcur_t pcur;
mem_heap_t* heap;
diff --git a/innobase/dict/dict0mem.c b/innobase/dict/dict0mem.c
index a4f83ddd657..936b06b1905 100644
--- a/innobase/dict/dict0mem.c
+++ b/innobase/dict/dict0mem.c
@@ -30,15 +30,14 @@ dict_table_t*
dict_mem_table_create(
/*==================*/
/* out, own: table object */
- char* name, /* in: table name */
- ulint space, /* in: space where the clustered index of
+ const char* name, /* in: table name */
+ ulint space, /* in: space where the clustered index of
the table is placed; this parameter is
ignored if the table is made a member of
a cluster */
- ulint n_cols) /* in: number of columns */
+ ulint n_cols) /* in: number of columns */
{
dict_table_t* table;
- char* str;
mem_heap_t* heap;
ut_ad(name);
@@ -48,11 +47,9 @@ dict_mem_table_create(
table = mem_heap_alloc(heap, sizeof(dict_table_t));
table->heap = heap;
-
- str = mem_heap_strdup(heap, name);
table->type = DICT_TABLE_ORDINARY;
- table->name = str;
+ table->name = mem_heap_strdup(heap, name);
table->space = space;
table->ibd_file_missing = FALSE;
table->tablespace_discarded = FALSE;
@@ -103,11 +100,11 @@ dict_table_t*
dict_mem_cluster_create(
/*====================*/
/* out, own: cluster object */
- char* name, /* in: cluster name */
- ulint space, /* in: space where the clustered indexes
+ const char* name, /* in: cluster name */
+ ulint space, /* in: space where the clustered indexes
of the member tables are placed */
- ulint n_cols, /* in: number of columns */
- ulint mix_len) /* in: length of the common key prefix in the
+ ulint n_cols, /* in: number of columns */
+ ulint mix_len)/* in: length of the common key prefix in the
cluster */
{
dict_table_t* cluster;
@@ -127,7 +124,7 @@ void
dict_mem_table_make_cluster_member(
/*===============================*/
dict_table_t* table, /* in: non-published table */
- char* cluster_name) /* in: cluster name */
+ const char* cluster_name) /* in: cluster name */
{
table->type = DICT_TABLE_CLUSTER_MEMBER;
table->cluster_name = cluster_name;
@@ -140,7 +137,7 @@ void
dict_mem_table_add_col(
/*===================*/
dict_table_t* table, /* in: table */
- char* name, /* in: column name */
+ const char* name, /* in: column name */
ulint mtype, /* in: main datatype */
ulint prtype, /* in: precise type */
ulint len, /* in: length */
@@ -174,14 +171,15 @@ Creates an index memory object. */
dict_index_t*
dict_mem_index_create(
/*==================*/
- /* out, own: index object */
- char* table_name, /* in: table name */
- char* index_name, /* in: index name */
- ulint space, /* in: space where the index tree is placed,
- ignored if the index is of the clustered
- type */
- ulint type, /* in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */
- ulint n_fields) /* in: number of fields */
+ /* out, own: index object */
+ const char* table_name, /* in: table name */
+ const char* index_name, /* in: index name */
+ ulint space, /* in: space where the index tree is
+ placed, ignored if the index is of
+ the clustered type */
+ ulint type, /* in: DICT_UNIQUE,
+ DICT_CLUSTERED, ... ORed */
+ ulint n_fields) /* in: number of fields */
{
dict_index_t* index;
mem_heap_t* heap;
@@ -259,7 +257,7 @@ void
dict_mem_index_add_field(
/*=====================*/
dict_index_t* index, /* in: index */
- char* name, /* in: column name */
+ const char* name, /* in: column name */
ulint order, /* in: order criterion; 0 means an
ascending order */
ulint prefix_len) /* in: 0 or the column prefix length
diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c
index b9aff246802..28eea0ba188 100644
--- a/innobase/fil/fil0fil.c
+++ b/innobase/fil/fil0fil.c
@@ -390,11 +390,12 @@ Appends a new file to the chain of files of a space. File must be closed. */
void
fil_node_create(
/*============*/
- char* name, /* in: file name (file must be closed) */
- ulint size, /* in: file size in database blocks, rounded downwards
- to an integer */
- ulint id, /* in: space id where to append */
- ibool is_raw) /* in: TRUE if a raw device or a raw disk partition */
+ const char* name, /* in: file name (file must be closed) */
+ ulint size, /* in: file size in database blocks, rounded
+ downwards to an integer */
+ ulint id, /* in: space id where to append */
+ ibool is_raw) /* in: TRUE if a raw device or
+ a raw disk partition */
{
fil_system_t* system = fil_system;
fil_node_t* node;
@@ -804,10 +805,10 @@ there is an error, prints an error message to the .err log. */
ibool
fil_space_create(
/*=============*/
- /* out: TRUE if success */
- char* name, /* in: space name */
- ulint id, /* in: space id */
- ulint purpose)/* in: FIL_TABLESPACE, or FIL_LOG if log */
+ /* out: TRUE if success */
+ const char* name, /* in: space name */
+ ulint id, /* in: space id */
+ ulint purpose)/* in: FIL_TABLESPACE, or FIL_LOG if log */
{
fil_system_t* system = fil_system;
fil_space_t* space;
@@ -1542,16 +1543,18 @@ static
void
fil_op_write_log(
/*=============*/
- ulint type, /* in: MLOG_FILE_CREATE, MLOG_FILE_DELETE, or
- MLOG_FILE_RENAME */
- ulint space_id, /* in: space id */
- char* name, /* in: table name in the familiar
- 'databasename/tablename' format, or the file
- path in the case of MLOG_FILE_DELETE */
- char* new_name, /* in: if type is MLOG_FILE_RENAME, the new
- table name in the 'databasename/tablename'
- format */
- mtr_t* mtr) /* in: mini-transaction handle */
+ ulint type, /* in: MLOG_FILE_CREATE,
+ MLOG_FILE_DELETE, or
+ MLOG_FILE_RENAME */
+ ulint space_id, /* in: space id */
+ const char* name, /* in: table name in the familiar
+ 'databasename/tablename' format, or
+ the file path in the case of
+ MLOG_FILE_DELETE */
+ const char* new_name, /* in: if type is MLOG_FILE_RENAME,
+ the new table name in the
+ 'databasename/tablename' format */
+ mtr_t* mtr) /* in: mini-transaction handle */
{
byte* log_ptr;
@@ -1960,14 +1963,15 @@ tablespace memory cache. */
ibool
fil_rename_tablespace(
/*==================*/
- /* out: TRUE if success */
- char* old_name, /* in: old table name in the standard
- databasename/tablename format of InnoDB, or
- NULL if we do the rename based on the space
- id only */
- ulint id, /* in: space id */
- char* new_name) /* in: new table name in the standard
- databasename/tablename format of InnoDB */
+ /* out: TRUE if success */
+ const char* old_name, /* in: old table name in the standard
+ databasename/tablename format of
+ InnoDB, or NULL if we do the rename
+ based on the space id only */
+ ulint id, /* in: space id */
+ const char* new_name) /* in: new table name in the standard
+ databasename/tablename format
+ of InnoDB */
{
fil_system_t* system = fil_system;
ibool success;
@@ -2124,15 +2128,16 @@ path '.'. */
ulint
fil_create_new_single_table_tablespace(
/*===================================*/
- /* out: DB_SUCCESS or error code */
- ulint* space_id, /* in/out: space id; if this is != 0, then
- this is an input parameter, otherwise
- output */
- char* tablename, /* in: the table name in the usual
- databasename/tablename format of InnoDB */
- ulint size) /* in: the initial size of the tablespace file
- in pages, must be >= FIL_IBD_FILE_INITIAL_SIZE
- */
+ /* out: DB_SUCCESS or error code */
+ ulint* space_id, /* in/out: space id; if this is != 0,
+ then this is an input parameter,
+ otherwise output */
+ const char* tablename, /* in: the table name in the usual
+ databasename/tablename format
+ of InnoDB */
+ ulint size) /* in: the initial size of the
+ tablespace file in pages,
+ must be >= FIL_IBD_FILE_INITIAL_SIZE */
{
os_file_t file;
ibool ret;
@@ -2293,12 +2298,12 @@ lsn's just by looking at that flush lsn. */
ibool
fil_reset_too_high_lsns(
/*====================*/
- /* out: TRUE if success */
- char* name, /* in: table name in the databasename/tablename
- format */
- dulint current_lsn) /* in: reset lsn's if the lsn stamped to
- FIL_PAGE_FILE_FLUSH_LSN in the first page is
- too high */
+ /* out: TRUE if success */
+ const char* name, /* in: table name in the
+ databasename/tablename format */
+ dulint current_lsn) /* in: reset lsn's if the lsn stamped
+ to FIL_PAGE_FILE_FLUSH_LSN in the
+ first page is too high */
{
os_file_t file;
char* filepath;
@@ -2433,10 +2438,10 @@ closes it after we have looked at the space id in it. */
ibool
fil_open_single_table_tablespace(
/*=============================*/
- /* out: TRUE if success */
- ulint id, /* in: space id */
- char* name) /* in: table name in the databasename/tablename
- format */
+ /* out: TRUE if success */
+ ulint id, /* in: space id */
+ const char* name) /* in: table name in the
+ databasename/tablename format */
{
os_file_t file;
char* filepath;
@@ -2937,20 +2942,22 @@ there may be many tablespaces which are not yet in the memory cache. */
ibool
fil_space_for_table_exists_in_mem(
/*==============================*/
- /* out: TRUE if a matching tablespace exists
- in the memory cache */
- ulint id, /* in: space id */
- char* name, /* in: table name in the standard
- 'databasename/tablename' format */
- ibool mark_space, /* in: in crash recovery, at database startup
- we mark all spaces which have an associated
- table in the InnoDB data dictionary, so that
- we can print a warning about orphaned
- tablespaces */
- ibool print_error_if_does_not_exist)
- /* in: print detailed error information to
- the .err log if a matching tablespace is
- not found from memory */
+ /* out: TRUE if a matching tablespace
+ exists in the memory cache */
+ ulint id, /* in: space id */
+ const char* name, /* in: table name in the standard
+ 'databasename/tablename' format */
+ ibool mark_space, /* in: in crash recovery, at database
+ startup we mark all spaces which have
+ an associated table in the InnoDB
+ data dictionary, so that
+ we can print a warning about orphaned
+ tablespaces */
+ ibool print_error_if_does_not_exist)
+ /* in: print detailed error
+ information to the .err log if a
+ matching tablespace is not found from
+ memory */
{
fil_system_t* system = fil_system;
fil_space_t* namespace;
diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c
index ecdcf08e4c6..9246bb03138 100644
--- a/innobase/ibuf/ibuf0ibuf.c
+++ b/innobase/ibuf/ibuf0ibuf.c
@@ -2770,7 +2770,7 @@ ibuf_insert_to_index_page(
fprintf(stderr, "Bitmap bits %lu\n", (ulong) old_bits);
fputs(
-"InnoDB: Send a detailed bug report to mysql@lists.mysql.com!\n", stderr);
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
}
}
}
@@ -2833,7 +2833,7 @@ ibuf_delete_rec(
if (!success) {
fprintf(stderr,
- "InnoDB: ERROR: Send the output to mysql@lists.mysql.com\n"
+ "InnoDB: ERROR: Submit the output to http://bugs.mysql.com\n"
"InnoDB: ibuf cursor restoration fails!\n"
"InnoDB: ibuf record inserted to page %lu\n", (ulong) page_no);
fflush(stderr);
@@ -3025,8 +3025,7 @@ ibuf_merge_or_delete_for_page(
"InnoDB: We try to resolve the problem by skipping the insert buffer\n"
"InnoDB: merge for this page. Please run CHECK TABLE on your tables\n"
"InnoDB: to determine if they are corrupt after this.\n\n"
-"InnoDB: Please make a detailed bug report and send it to\n"
-"InnoDB: mysql@lists.mysql.com\n\n",
+"InnoDB: Please submit a detailed bug report to http://bugs.mysql.com\n\n",
(ulong) page_no,
(ulong) fil_page_get_type(page));
}
@@ -3042,7 +3041,7 @@ loop:
if (page) {
ibool success = buf_page_get_known_nowait(RW_X_LATCH, page,
BUF_KEEP_OLD,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
ut_a(success);
#ifdef UNIV_SYNC_DEBUG
diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h
index 6b8da886045..9590fea1276 100644
--- a/innobase/include/buf0buf.h
+++ b/innobase/include/buf0buf.h
@@ -132,7 +132,7 @@ to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed
in LA! */
#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
- BUF_GET, IB__FILE__, __LINE__, MTR)
+ BUF_GET, __FILE__, __LINE__, MTR)
/******************************************************************
Use these macros to bufferfix a page with no latching. Remember not to
read the contents of the page unless you know it is safe. Do not modify
@@ -141,19 +141,19 @@ error-prone programming not to set a latch, and it should be used
with care. */
#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\
SP, OF, RW_NO_LATCH, NULL,\
- BUF_GET_NO_LATCH, IB__FILE__, __LINE__, MTR)
+ BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
/******************************************************************
NOTE! The following macros should be used instead of buf_page_get_gen, to
improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */
#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
- BUF_GET_NOWAIT, IB__FILE__, __LINE__, MTR)
+ BUF_GET_NOWAIT, __FILE__, __LINE__, MTR)
/******************************************************************
NOTE! The following macros should be used instead of
buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and
RW_X_LATCH are allowed as LA! */
#define buf_page_optimistic_get(LA, BL, G, MC, MTR) buf_page_optimistic_get_func(\
- LA, BL, G, MC, IB__FILE__, __LINE__, MTR)
+ LA, BL, G, MC, __FILE__, __LINE__, MTR)
/************************************************************************
This is the general function used to get optimistic access to a database
page. */
@@ -168,7 +168,7 @@ buf_page_optimistic_get_func(
frames */
dulint modify_clock,/* in: modify clock value if mode is
..._GUESS_ON_CLOCK */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr); /* in: mini-transaction */
/************************************************************************
@@ -201,7 +201,7 @@ buf_page_get_known_nowait(
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */
buf_frame_t* guess, /* in: the known page frame */
ulint mode, /* in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr); /* in: mini-transaction */
/************************************************************************
@@ -217,7 +217,7 @@ buf_page_get_gen(
buf_frame_t* guess, /* in: guessed frame or NULL */
ulint mode, /* in: BUF_GET, BUF_GET_IF_IN_POOL,
BUF_GET_NO_LATCH */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr); /* in: mini-transaction */
/************************************************************************
diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic
index b644afcbdff..4d1173a0d7f 100644
--- a/innobase/include/buf0buf.ic
+++ b/innobase/include/buf0buf.ic
@@ -585,7 +585,7 @@ buf_page_get_release_on_io(
frame = buf_page_get_gen(space, offset, rw_latch, guess,
BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
if (frame != NULL) {
diff --git a/innobase/include/data0data.h b/innobase/include/data0data.h
index 99d3c297039..e2de13d0520 100644
--- a/innobase/include/data0data.h
+++ b/innobase/include/data0data.h
@@ -86,7 +86,7 @@ void
dfield_set_data(
/*============*/
dfield_t* field, /* in: field */
- void* data, /* in: data */
+ const void* data, /* in: data */
ulint len); /* in: length or UNIV_SQL_NULL */
/**************************************************************************
Writes an SQL null field full of zeros. */
diff --git a/innobase/include/data0data.ic b/innobase/include/data0data.ic
index 697a272ccd6..569bf898801 100644
--- a/innobase/include/data0data.ic
+++ b/innobase/include/data0data.ic
@@ -93,7 +93,7 @@ void
dfield_set_data(
/*============*/
dfield_t* field, /* in: field */
- void* data, /* in: data */
+ const void* data, /* in: data */
ulint len) /* in: length or UNIV_SQL_NULL */
{
ut_ad(field);
diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h
index 98636f6e1cb..fe04359d6f1 100644
--- a/innobase/include/dict0dict.h
+++ b/innobase/include/dict0dict.h
@@ -166,7 +166,7 @@ dict_table_rename_in_cache(
/*=======================*/
/* out: TRUE if success */
dict_table_t* table, /* in: table */
- char* new_name, /* in: new name */
+ const char* new_name, /* in: new name */
ibool rename_also_foreigns);/* in: in ALTER TABLE we want
to preserve the original table name
in constraints which reference it */
@@ -210,16 +210,19 @@ fields than mentioned in the constraint. */
ulint
dict_create_foreign_constraints(
/*============================*/
- /* out: error code or DB_SUCCESS */
- trx_t* trx, /* in: transaction */
- char* sql_string, /* in: table create statement where
- foreign keys are declared like:
- FOREIGN KEY (a, b) REFERENCES table2(c, d),
- table2 can be written also with the database
- name before it: test.table2; the default
- database id the database of parameter name */
- char* name); /* in: table full name in the normalized form
- database_name/table_name */
+ /* out: error code or DB_SUCCESS */
+ trx_t* trx, /* in: transaction */
+ const char* sql_string, /* in: table create statement where
+ foreign keys are declared like:
+ FOREIGN KEY (a, b) REFERENCES
+ table2(c, d), table2 can be written
+ also with the database
+ name before it: test.table2; the
+ default database id the database of
+ parameter name */
+ const char* name); /* in: table full name in the
+ normalized form
+ database_name/table_name */
/**************************************************************************
Parses the CONSTRAINT id's to be dropped in an ALTER TABLE statement. */
@@ -246,9 +249,10 @@ directory dict_table_get_low is usually the appropriate function. */
dict_table_t*
dict_table_get(
/*===========*/
- /* out: table, NULL if does not exist */
- char* table_name, /* in: table name */
- trx_t* trx); /* in: transaction handle */
+ /* out: table, NULL if
+ does not exist */
+ const char* table_name, /* in: table name */
+ trx_t* trx); /* in: transaction handle */
/**************************************************************************
Returns a table object and increments MySQL open handle count on the table.
*/
@@ -256,9 +260,10 @@ Returns a table object and increments MySQL open handle count on the table.
dict_table_t*
dict_table_get_and_increment_handle_count(
/*======================================*/
- /* out: table, NULL if does not exist */
- char* table_name, /* in: table name */
- trx_t* trx); /* in: transaction handle or NULL */
+ /* out: table, NULL if
+ does not exist */
+ const char* table_name, /* in: table name */
+ trx_t* trx); /* in: transaction handle or NULL */
/**************************************************************************
Returns a table object, based on table id, and memoryfixes it. */
@@ -290,8 +295,8 @@ UNIV_INLINE
dict_table_t*
dict_table_check_if_in_cache_low(
/*==============================*/
- /* out: table, NULL if not found */
- char* table_name); /* in: table name */
+ /* out: table, NULL if not found */
+ const char* table_name); /* in: table name */
/**************************************************************************
Gets a table; loads it to the dictionary cache if necessary. A low-level
function. */
@@ -299,8 +304,8 @@ UNIV_INLINE
dict_table_t*
dict_table_get_low(
/*===============*/
- /* out: table, NULL if not found */
- char* table_name); /* in: table name */
+ /* out: table, NULL if not found */
+ const char* table_name); /* in: table name */
/**************************************************************************
Returns an index object. */
UNIV_INLINE
@@ -309,7 +314,7 @@ dict_table_get_index(
/*=================*/
/* out: index, NULL if does not exist */
dict_table_t* table, /* in: table */
- char* name); /* in: index name */
+ const char* name); /* in: index name */
/**************************************************************************
Returns an index object. */
@@ -318,7 +323,7 @@ dict_table_get_index_noninline(
/*===========================*/
/* out: index, NULL if does not exist */
dict_table_t* table, /* in: table */
- char* name); /* in: index name */
+ const char* name); /* in: index name */
/**************************************************************************
Prints a table data. */
@@ -340,7 +345,7 @@ Prints a table data when we know the table name. */
void
dict_table_print_by_name(
/*=====================*/
- char* name);
+ const char* name);
#endif /* UNIV_DEBUG */
/**************************************************************************
Outputs info on foreign keys of a table. */
diff --git a/innobase/include/dict0dict.ic b/innobase/include/dict0dict.ic
index 57ef4b896f5..0f7cc8973db 100644
--- a/innobase/include/dict0dict.ic
+++ b/innobase/include/dict0dict.ic
@@ -536,8 +536,8 @@ UNIV_INLINE
dict_table_t*
dict_table_check_if_in_cache_low(
/*==============================*/
- /* out: table, NULL if not found */
- char* table_name) /* in: table name */
+ /* out: table, NULL if not found */
+ const char* table_name) /* in: table name */
{
dict_table_t* table;
ulint table_fold;
@@ -562,8 +562,8 @@ UNIV_INLINE
dict_table_t*
dict_table_get_low(
/*===============*/
- /* out: table, NULL if not found */
- char* table_name) /* in: table name */
+ /* out: table, NULL if not found */
+ const char* table_name) /* in: table name */
{
dict_table_t* table;
@@ -642,7 +642,7 @@ dict_table_get_index(
/*=================*/
/* out: index, NULL if does not exist */
dict_table_t* table, /* in: table */
- char* name) /* in: index name */
+ const char* name) /* in: index name */
{
dict_index_t* index = NULL;
diff --git a/innobase/include/dict0load.h b/innobase/include/dict0load.h
index f7168a0f45f..d4dccb33373 100644
--- a/innobase/include/dict0load.h
+++ b/innobase/include/dict0load.h
@@ -31,9 +31,10 @@ Finds the first table name in the given database. */
char*
dict_get_first_table_name_in_db(
/*============================*/
- /* out, own: table name, NULL if does not exist;
- the caller must free the memory in the string! */
- char* name); /* in: database name which ends to '/' */
+ /* out, own: table name, NULL if
+ does not exist; the caller must free
+ the memory in the string! */
+ const char* name); /* in: database name which ends to '/' */
/************************************************************************
Loads a table definition and also all its index definitions, and also
the cluster definition if the table is a member in a cluster. Also loads
@@ -43,11 +44,13 @@ a foreign key references columns in this table. */
dict_table_t*
dict_load_table(
/*============*/
- /* out: table, NULL if does not exist; if the table is
- stored in an .ibd file, but the file does not exist,
- then we set the ibd_file_missing flag TRUE in the table
- object we return */
- char* name); /* in: table name */
+ /* out: table, NULL if does not exist;
+ if the table is stored in an .ibd file,
+ but the file does not exist,
+ then we set the ibd_file_missing flag TRUE
+ in the table object we return */
+ const char* name); /* in: table name in the
+ databasename/tablename format */
/***************************************************************************
Loads a table object based on the table id. */
@@ -75,8 +78,8 @@ already in the dictionary cache. */
ulint
dict_load_foreigns(
/*===============*/
- /* out: DB_SUCCESS or error code */
- char* table_name); /* in: table name */
+ /* out: DB_SUCCESS or error code */
+ const char* table_name); /* in: table name */
/************************************************************************
Prints to the standard output information on all tables found in the data
dictionary system table. */
diff --git a/innobase/include/dict0mem.h b/innobase/include/dict0mem.h
index 674868c9fce..f141ea9da09 100644
--- a/innobase/include/dict0mem.h
+++ b/innobase/include/dict0mem.h
@@ -48,27 +48,28 @@ Creates a table memory object. */
dict_table_t*
dict_mem_table_create(
/*==================*/
- /* out, own: table object */
- char* name, /* in: table name */
- ulint space, /* in: space where the clustered index of
- the table is placed; this parameter is
- ignored if the table is made a member of
- a cluster */
- ulint n_cols); /* in: number of columns */
+ /* out, own: table object */
+ const char* name, /* in: table name */
+ ulint space, /* in: space where the clustered index
+ of the table is placed; this parameter
+ is ignored if the table is made
+ a member of a cluster */
+ ulint n_cols); /* in: number of columns */
/**************************************************************************
Creates a cluster memory object. */
dict_cluster_t*
dict_mem_cluster_create(
/*====================*/
- /* out, own: cluster object (where the type
- dict_cluster_t == dict_table_t) */
- char* name, /* in: cluster name */
- ulint space, /* in: space where the clustered indexes
- of the member tables are placed */
- ulint n_cols, /* in: number of columns */
- ulint mix_len); /* in: length of the common key prefix in the
- cluster */
+ /* out, own: cluster object (where the
+ type dict_cluster_t == dict_table_t) */
+ const char* name, /* in: cluster name */
+ ulint space, /* in: space where the clustered
+ indexes of the member tables are
+ placed */
+ ulint n_cols, /* in: number of columns */
+ ulint mix_len); /* in: length of the common key prefix
+ in the cluster */
/**************************************************************************
Declares a non-published table as a member in a cluster. */
@@ -76,7 +77,7 @@ void
dict_mem_table_make_cluster_member(
/*===============================*/
dict_table_t* table, /* in: non-published table */
- char* cluster_name); /* in: cluster name */
+ const char* cluster_name); /* in: cluster name */
/**************************************************************************
Adds a column definition to a table. */
@@ -84,7 +85,7 @@ void
dict_mem_table_add_col(
/*===================*/
dict_table_t* table, /* in: table */
- char* name, /* in: column name */
+ const char* name, /* in: column name */
ulint mtype, /* in: main datatype */
ulint prtype, /* in: precise type */
ulint len, /* in: length */
@@ -95,14 +96,15 @@ Creates an index memory object. */
dict_index_t*
dict_mem_index_create(
/*==================*/
- /* out, own: index object */
- char* table_name, /* in: table name */
- char* index_name, /* in: index name */
- ulint space, /* in: space where the index tree is placed,
- ignored if the index is of the clustered
- type */
- ulint type, /* in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */
- ulint n_fields); /* in: number of fields */
+ /* out, own: index object */
+ const char* table_name, /* in: table name */
+ const char* index_name, /* in: index name */
+ ulint space, /* in: space where the index tree is
+ placed, ignored if the index is of
+ the clustered type */
+ ulint type, /* in: DICT_UNIQUE,
+ DICT_CLUSTERED, ... ORed */
+ ulint n_fields); /* in: number of fields */
/**************************************************************************
Adds a field definition to an index. NOTE: does not take a copy
of the column name if the field is a column. The memory occupied
@@ -112,7 +114,7 @@ void
dict_mem_index_add_field(
/*=====================*/
dict_index_t* index, /* in: index */
- char* name, /* in: column name */
+ const char* name, /* in: column name */
ulint order, /* in: order criterion; 0 means an
ascending order */
ulint prefix_len); /* in: 0 or the column prefix length
@@ -142,7 +144,7 @@ struct dict_col_struct{
clustered index */
ulint ord_part;/* count of how many times this column
appears in ordering fields of an index */
- char* name; /* name */
+ const char* name; /* name */
dtype_t type; /* data type */
dict_table_t* table; /* back pointer to table of this column */
ulint aux; /* this is used as an auxiliary variable
@@ -154,7 +156,7 @@ struct dict_col_struct{
/* Data structure for a field in an index */
struct dict_field_struct{
dict_col_t* col; /* pointer to the table column */
- char* name; /* name of the column */
+ const char* name; /* name of the column */
ulint order; /* flags for ordering this field:
DICT_DESCEND, ... */
ulint prefix_len; /* 0 or the length of the column
@@ -197,8 +199,8 @@ struct dict_index_struct{
dulint id; /* id of the index */
mem_heap_t* heap; /* memory heap */
ulint type; /* index type */
- char* name; /* index name */
- char* table_name; /* table name */
+ const char* name; /* index name */
+ const char* table_name; /* table name */
dict_table_t* table; /* back pointer to table */
ulint space; /* space where the index tree is placed */
ulint page_no;/* page number of the index tree root */
@@ -254,12 +256,12 @@ struct dict_foreign_struct{
or DICT_FOREIGN_ON_DELETE_SET_NULL */
char* foreign_table_name;/* foreign table name */
dict_table_t* foreign_table; /* table where the foreign key is */
- char** foreign_col_names;/* names of the columns in the
+ const char** foreign_col_names;/* names of the columns in the
foreign key */
char* referenced_table_name;/* referenced table name */
dict_table_t* referenced_table;/* table where the referenced key
is */
- char** referenced_col_names;/* names of the referenced
+ const char** referenced_col_names;/* names of the referenced
columns in the referenced table */
ulint n_fields; /* number of indexes' first fields
for which the the foreign key
@@ -295,7 +297,7 @@ struct dict_table_struct{
dulint id; /* id of the table or cluster */
ulint type; /* DICT_TABLE_ORDINARY, ... */
mem_heap_t* heap; /* memory heap */
- char* name; /* table name */
+ const char* name; /* table name */
ulint space; /* space where the clustered index of the
table is placed */
ibool ibd_file_missing;/* TRUE if this is in a single-table
@@ -363,7 +365,7 @@ struct dict_table_struct{
byte mix_id_buf[12];
/* mix id of a mixed table written in
a compressed form */
- char* cluster_name; /* if the table is a member in a
+ const char* cluster_name; /* if the table is a member in a
cluster, this is the name of the cluster */
/*----------------------*/
ibool does_not_fit_in_memory;
diff --git a/innobase/include/fil0fil.h b/innobase/include/fil0fil.h
index f7cdeb7f195..b750e9b38f2 100644
--- a/innobase/include/fil0fil.h
+++ b/innobase/include/fil0fil.h
@@ -132,11 +132,12 @@ Appends a new file to the chain of files of a space. File must be closed. */
void
fil_node_create(
/*============*/
- char* name, /* in: file name (file must be closed) */
- ulint size, /* in: file size in database blocks, rounded downwards
- to an integer */
- ulint id, /* in: space id where to append */
- ibool is_raw);/* in: TRUE if a raw device or a raw disk partition */
+ const char* name, /* in: file name (file must be closed) */
+ ulint size, /* in: file size in database blocks, rounded
+ downwards to an integer */
+ ulint id, /* in: space id where to append */
+ ibool is_raw);/* in: TRUE if a raw device or
+ a raw disk partition */
/********************************************************************
Drops files from the start of a file space, so that its size is cut by
the amount given. */
@@ -155,10 +156,10 @@ there is an error, prints an error message to the .err log. */
ibool
fil_space_create(
/*=============*/
- /* out: TRUE if success */
- char* name, /* in: space name */
- ulint id, /* in: space id */
- ulint purpose);/* in: FIL_TABLESPACE, or FIL_LOG if log */
+ /* out: TRUE if success */
+ const char* name, /* in: space name */
+ ulint id, /* in: space id */
+ ulint purpose);/* in: FIL_TABLESPACE, or FIL_LOG if log */
/***********************************************************************
Frees a space object from a the tablespace memory cache. Closes the files in
the chain but does not delete them. */
@@ -327,14 +328,15 @@ tablespace memory cache. */
ibool
fil_rename_tablespace(
/*==================*/
- /* out: TRUE if success */
- char* old_name, /* in: old table name in the standard
- databasename/tablename format of InnoDB, or
- NULL if we do the rename based on the space
- id only */
- ulint id, /* in: space id */
- char* new_name); /* in: new table name in the standard
- databasename/tablename format of InnoDB */
+ /* out: TRUE if success */
+ const char* old_name, /* in: old table name in the standard
+ databasename/tablename format of
+ InnoDB, or NULL if we do the rename
+ based on the space id only */
+ ulint id, /* in: space id */
+ const char* new_name); /* in: new table name in the standard
+ databasename/tablename format
+ of InnoDB */
/***********************************************************************
Creates a new single-table tablespace to a database directory of MySQL.
Database directories are under the 'datadir' of MySQL. The datadir is the
@@ -344,14 +346,16 @@ path '.'. */
ulint
fil_create_new_single_table_tablespace(
/*===================================*/
- /* out: DB_SUCCESS or error code */
- ulint* space_id, /* in/out: space id; if this is != 0, then
- this is an input parameter, otherwise
- output */
- char* tablename, /* in: the table name in the usual
- databasename/tablename format of InnoDB */
- ulint size); /* in: the initial size of the tablespace file
- in pages, must be > 0 */
+ /* out: DB_SUCCESS or error code */
+ ulint* space_id, /* in/out: space id; if this is != 0,
+ then this is an input parameter,
+ otherwise output */
+ const char* tablename, /* in: the table name in the usual
+ databasename/tablename format
+ of InnoDB */
+ ulint size); /* in: the initial size of the
+ tablespace file in pages,
+ must be >= FIL_IBD_FILE_INITIAL_SIZE */
/************************************************************************
Tries to open a single-table tablespace and checks the space id is right in
it. If does not succeed, prints an error message to the .err log. This
@@ -362,10 +366,10 @@ protection of the dictionary mutex, so that two users cannot race here. */
ibool
fil_open_single_table_tablespace(
/*=============================*/
- /* out: TRUE if success */
- ulint id, /* in: space id */
- char* name); /* in: table name in the databasename/tablename
- format */
+ /* out: TRUE if success */
+ ulint id, /* in: space id */
+ const char* name); /* in: table name in the
+ databasename/tablename format */
/************************************************************************
It is possible, though very improbable, that the lsn's in the tablespace to be
imported have risen above the current system lsn, if a lengthy purge, ibuf
@@ -379,12 +383,12 @@ lsn's just by looking at that flush lsn. */
ibool
fil_reset_too_high_lsns(
/*====================*/
- /* out: TRUE if success */
- char* name, /* in: table name in the databasename/tablename
- format */
- dulint current_lsn); /* in: reset lsn's if the lsn stamped to
- FIL_PAGE_FILE_FLUSH_LSN in the first page is
- too high */
+ /* out: TRUE if success */
+ const char* name, /* in: table name in the
+ databasename/tablename format */
+ dulint current_lsn); /* in: reset lsn's if the lsn stamped
+ to FIL_PAGE_FILE_FLUSH_LSN in the
+ first page is too high */
/************************************************************************
At the server startup, if we need crash recovery, scans the database
directories under the MySQL datadir, looking for .ibd files. Those files are
@@ -436,20 +440,22 @@ there may be many tablespaces which are not yet in the memory cache. */
ibool
fil_space_for_table_exists_in_mem(
/*==============================*/
- /* out: TRUE if a matching tablespace
- exists in the memory cache */
- ulint id, /* in: space id */
- char* name, /* in: table name in the standard
- 'databasename/tablename' format */
- ibool mark_space, /* in: in crash recovery, at database startup
- we mark all spaces which have an associated
- table in the InnoDB data dictionary, so that
- we can print a warning about orphaned
- tablespaces */
- ibool print_error_if_does_not_exist);
- /* in: print detailed error information to
- the .err log if a matching tablespace is
- not found from memory */
+ /* out: TRUE if a matching tablespace
+ exists in the memory cache */
+ ulint id, /* in: space id */
+ const char* name, /* in: table name in the standard
+ 'databasename/tablename' format */
+ ibool mark_space, /* in: in crash recovery, at database
+ startup we mark all spaces which have
+ an associated table in the InnoDB
+ data dictionary, so that
+ we can print a warning about orphaned
+ tablespaces */
+ ibool print_error_if_does_not_exist);
+ /* in: print detailed error
+ information to the .err log if a
+ matching tablespace is not found from
+ memory */
/**************************************************************************
Tries to extend a data file so that it would accommodate the number of pages
given. The tablespace must be cached in the memory cache. If the space is big
diff --git a/innobase/include/mem0mem.h b/innobase/include/mem0mem.h
index 89e2a337c99..18bffe5732e 100644
--- a/innobase/include/mem0mem.h
+++ b/innobase/include/mem0mem.h
@@ -64,14 +64,14 @@ heap creation. */
#define mem_heap_create(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_DYNAMIC,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap creation. */
#define mem_heap_create_in_buffer(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BUFFER,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap creation. */
@@ -79,7 +79,7 @@ heap creation. */
#define mem_heap_create_in_btr_search(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BTR_SEARCH |\
MEM_HEAP_BUFFER,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for fast
memory heap creation. An initial block of memory B is given by the
@@ -88,14 +88,14 @@ mem_heap_free. See the parameter comment in mem_heap_create_func below. */
#define mem_heap_fast_create(N, B) mem_heap_create_func(\
(N), (B), MEM_HEAP_DYNAMIC,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap freeing. */
#define mem_heap_free(heap) mem_heap_free_func(\
- (heap), IB__FILE__, __LINE__)
+ (heap), __FILE__, __LINE__)
/*********************************************************************
NOTE: Use the corresponding macros instead of this function. Creates a
memory heap which allocates memory from dynamic space. For debugging
@@ -105,26 +105,27 @@ UNIV_INLINE
mem_heap_t*
mem_heap_create_func(
/*=================*/
- /* out, own: memory heap */
- ulint n, /* in: desired start block size,
- this means that a single user buffer
- of size n will fit in the block,
- 0 creates a default size block;
- if init_block is not NULL, n tells
- its size in bytes */
- void* init_block, /* in: if very fast creation is
- wanted, the caller can reserve some
- memory from its stack, for example,
- and pass it as the the initial block
- to the heap: then no OS call of malloc
- is needed at the creation. CAUTION:
- the caller must make sure the initial
- block is not unintentionally erased
- (if allocated in the stack), before
- the memory heap is explicitly freed. */
- ulint type, /* in: MEM_HEAP_DYNAMIC or MEM_HEAP_BUFFER */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: memory heap */
+ ulint n, /* in: desired start block size,
+ this means that a single user buffer
+ of size n will fit in the block,
+ 0 creates a default size block;
+ if init_block is not NULL, n tells
+ its size in bytes */
+ void* init_block, /* in: if very fast creation is
+ wanted, the caller can reserve some
+ memory from its stack, for example,
+ and pass it as the the initial block
+ to the heap: then no OS call of malloc
+ is needed at the creation. CAUTION:
+ the caller must make sure the initial
+ block is not unintentionally erased
+ (if allocated in the stack), before
+ the memory heap is explicitly freed. */
+ ulint type, /* in: MEM_HEAP_DYNAMIC
+ or MEM_HEAP_BUFFER */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/*********************************************************************
NOTE: Use the corresponding macro instead of this function. Frees the space
@@ -135,7 +136,7 @@ void
mem_heap_free_func(
/*===============*/
mem_heap_t* heap, /* in, own: heap to be freed */
- char* file_name __attribute__((unused)),
+ const char* file_name __attribute__((unused)),
/* in: file name where freed */
ulint line __attribute__((unused)));
/* in: line where freed */
@@ -206,13 +207,13 @@ mem_heap_get_size(
Use this macro instead of the corresponding function!
Macro for memory buffer allocation */
-#define mem_alloc(N) mem_alloc_func((N), IB__FILE__, __LINE__)
+#define mem_alloc(N) mem_alloc_func((N), __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function!
Macro for memory buffer allocation */
#define mem_alloc_noninline(N) mem_alloc_func_noninline(\
- (N), IB__FILE__, __LINE__)
+ (N), __FILE__, __LINE__)
/*******************************************************************
NOTE: Use the corresponding macro instead of this function.
Allocates a single buffer of memory from the dynamic memory of
@@ -222,11 +223,11 @@ UNIV_INLINE
void*
mem_alloc_func(
/*===========*/
- /* out, own: free storage, NULL
- if did not succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage, NULL
+ if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/*******************************************************************
NOTE: Use the corresponding macro instead of this function.
@@ -237,17 +238,17 @@ with mem_free. */
void*
mem_alloc_func_noninline(
/*=====================*/
- /* out, own: free storage, NULL if did not
- succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/******************************************************************
Use this macro instead of the corresponding function!
Macro for memory buffer freeing */
-#define mem_free(PTR) mem_free_func((PTR), IB__FILE__, __LINE__)
+#define mem_free(PTR) mem_free_func((PTR), __FILE__, __LINE__)
/*******************************************************************
NOTE: Use the corresponding macro instead of this function.
Frees a single buffer of storage from
@@ -256,9 +257,9 @@ UNIV_INLINE
void
mem_free_func(
/*==========*/
- void* ptr, /* in, own: buffer to be freed */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ void* ptr, /* in, own: buffer to be freed */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/*******************************************************************
Implements realloc. */
@@ -266,11 +267,12 @@ UNIV_INLINE
void*
mem_realloc(
/*========*/
- /* out, own: free storage, NULL if did not succeed */
- void* buf, /* in: pointer to an old buffer */
- ulint n, /* in: desired number of bytes */
- char* file_name,/* in: file name where called */
- ulint line); /* in: line where called */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ void* buf, /* in: pointer to an old buffer */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where called */
+ ulint line); /* in: line where called */
/**************************************************************************
Duplicates a NUL-terminated string. */
diff --git a/innobase/include/mem0mem.ic b/innobase/include/mem0mem.ic
index c250e6948ec..df3dbf9b576 100644
--- a/innobase/include/mem0mem.ic
+++ b/innobase/include/mem0mem.ic
@@ -16,18 +16,18 @@ Creates a memory heap block where data can be allocated. */
mem_block_t*
mem_heap_create_block(
/*==================*/
- /* out, own: memory heap block, NULL if did not
- succeed */
- mem_heap_t* heap,/* in: memory heap or NULL if first block should
- be created */
- ulint n, /* in: number of bytes needed for user data, or
- if init_block is not NULL, its size in bytes */
- void* init_block, /* in: init block in fast create, type must be
- MEM_HEAP_DYNAMIC */
- ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC or
- MEM_HEAP_BUFFER */
- char* file_name,/* in: file name where created */
- ulint line); /* in: line where created */
+ /* out, own: memory heap block,
+ NULL if did not succeed */
+ mem_heap_t* heap, /* in: memory heap or NULL if first block
+ should be created */
+ ulint n, /* in: number of bytes needed for user data, or
+ if init_block is not NULL, its size in bytes */
+ void* init_block, /* in: init block in fast create,
+ type must be MEM_HEAP_DYNAMIC */
+ ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC or
+ MEM_HEAP_BUFFER */
+ const char* file_name,/* in: file name where created */
+ ulint line); /* in: line where created */
/**********************************************************************
Frees a block from a memory heap. */
@@ -377,27 +377,27 @@ UNIV_INLINE
mem_heap_t*
mem_heap_create_func(
/*=================*/
- /* out, own: memory heap */
- ulint n, /* in: desired start block size,
- this means that a single user buffer
- of size n will fit in the block,
- 0 creates a default size block;
- if init_block is not NULL, n tells
- its size in bytes */
- void* init_block, /* in: if very fast creation is
- wanted, the caller can reserve some
- memory from its stack, for example,
- and pass it as the the initial block
- to the heap: then no OS call of malloc
- is needed at the creation. CAUTION:
- the caller must make sure the initial
- block is not unintentionally erased
- (if allocated in the stack), before
- the memory heap is explicitly freed. */
- ulint type, /* in: MEM_HEAP_DYNAMIC, or MEM_HEAP_BUFFER
- possibly ORed to MEM_HEAP_BTR_SEARCH */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: memory heap */
+ ulint n, /* in: desired start block size,
+ this means that a single user buffer
+ of size n will fit in the block,
+ 0 creates a default size block;
+ if init_block is not NULL, n tells
+ its size in bytes */
+ void* init_block, /* in: if very fast creation is
+ wanted, the caller can reserve some
+ memory from its stack, for example,
+ and pass it as the the initial block
+ to the heap: then no OS call of malloc
+ is needed at the creation. CAUTION:
+ the caller must make sure the initial
+ block is not unintentionally erased
+ (if allocated in the stack), before
+ the memory heap is explicitly freed. */
+ ulint type, /* in: MEM_HEAP_DYNAMIC
+ or MEM_HEAP_BUFFER */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
mem_block_t* block;
@@ -440,10 +440,9 @@ void
mem_heap_free_func(
/*===============*/
mem_heap_t* heap, /* in, own: heap to be freed */
- char* file_name __attribute__((unused)),
+ const char* file_name __attribute__((unused)),
/* in: file name where freed */
ulint line __attribute__((unused)))
- /* in: line where freed */
{
mem_block_t* block;
mem_block_t* prev_block;
@@ -486,11 +485,11 @@ UNIV_INLINE
void*
mem_alloc_func(
/*===========*/
- /* out, own: free storage, NULL if did not
- succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage, NULL
+ if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
mem_heap_t* heap;
@@ -523,9 +522,9 @@ UNIV_INLINE
void
mem_free_func(
/*==========*/
- void* ptr, /* in, own: buffer to be freed */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ void* ptr, /* in, own: buffer to be freed */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
mem_heap_t* heap;
@@ -569,11 +568,12 @@ UNIV_INLINE
void*
mem_realloc(
/*========*/
- /* out, own: free storage, NULL if did not succeed */
- void* buf, /* in: pointer to an old buffer */
- ulint n, /* in: desired number of bytes */
- char* file_name,/* in: file name where called */
- ulint line) /* in: line where called */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ void* buf, /* in: pointer to an old buffer */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where called */
+ ulint line) /* in: line where called */
{
mem_free(buf);
diff --git a/innobase/include/mtr0mtr.h b/innobase/include/mtr0mtr.h
index 73338977b9c..f6dfe23bc41 100644
--- a/innobase/include/mtr0mtr.h
+++ b/innobase/include/mtr0mtr.h
@@ -198,11 +198,11 @@ mtr_read_dulint(
mtr_t* mtr); /* in: mini-transaction handle */
/*************************************************************************
This macro locks an rw-lock in s-mode. */
-#define mtr_s_lock(B, MTR) mtr_s_lock_func((B), IB__FILE__, __LINE__,\
+#define mtr_s_lock(B, MTR) mtr_s_lock_func((B), __FILE__, __LINE__,\
(MTR))
/*************************************************************************
This macro locks an rw-lock in x-mode. */
-#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), IB__FILE__, __LINE__,\
+#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), __FILE__, __LINE__,\
(MTR))
/*************************************************************************
NOTE! Use the macro above!
@@ -212,7 +212,7 @@ void
mtr_s_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr); /* in: mtr */
/*************************************************************************
@@ -223,7 +223,7 @@ void
mtr_x_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr); /* in: mtr */
diff --git a/innobase/include/mtr0mtr.ic b/innobase/include/mtr0mtr.ic
index 51112fc0d14..4fc6dd2f6a9 100644
--- a/innobase/include/mtr0mtr.ic
+++ b/innobase/include/mtr0mtr.ic
@@ -217,7 +217,7 @@ void
mtr_s_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr) /* in: mtr */
{
@@ -236,7 +236,7 @@ void
mtr_x_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr) /* in: mtr */
{
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index 3eccfcd3be5..930390241d3 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -177,13 +177,15 @@ and '..' items at the start of the directory listing. */
os_file_dir_t
os_file_opendir(
/*============*/
- /* out: directory stream, NULL if error */
- char* dirname, /* in: directory name; it must not contain
- a trailing '\' or '/' */
- ibool error_is_fatal);/* in: TRUE if we should treat an error as a
- fatal error; if we try to open symlinks then
- we do not wish a fatal error if it happens
- not to be a directory */
+ /* out: directory stream, NULL if
+ error */
+ const char* dirname, /* in: directory name; it must not
+ contain a trailing '\' or '/' */
+ ibool error_is_fatal);/* in: TRUE if we should treat an
+ error as a fatal error; if we try to
+ open symlinks then we do not wish a
+ fatal error if it happens not to be
+ a directory */
/***************************************************************************
Closes a directory stream. */
@@ -201,7 +203,7 @@ os_file_readdir_next_file(
/*======================*/
/* out: 0 if ok, -1 if error, 1 if at the end
of the directory */
- char* dirname,/* in: directory name or path */
+ const char* dirname,/* in: directory name or path */
os_file_dir_t dir, /* in: directory stream */
os_file_stat_t* info); /* in/out: buffer where the info is returned */
/*********************************************************************
@@ -213,81 +215,89 @@ fail_if_exists arguments is true. */
ibool
os_file_create_directory(
/*=====================*/
- /* out: TRUE if call succeeds, FALSE on
- error */
- char* pathname, /* in: directory name as null-terminated
- string */
- ibool fail_if_exists);/* in: if TRUE, pre-existing directory is
- treated as an error. */
+ /* out: TRUE if call succeeds,
+ FALSE on error */
+ const char* pathname, /* in: directory name as
+ null-terminated string */
+ ibool fail_if_exists);/* in: if TRUE, pre-existing directory
+ is treated as an error. */
/********************************************************************
A simple function to open or create a file. */
os_file_t
os_file_create_simple(
/*==================*/
- /* out, own: handle to the file, not defined if error,
- error number can be retrieved with
- os_file_get_last_error */
- char* name, /* in: name of the file or path as a null-terminated
- string */
- ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
- (if does not exist, error), or OS_FILE_CREATE if a new
- file is created (if exists, error), or
- OS_FILE_CREATE_PATH if new file (if exists, error) and
- subdirectories along its path are created (if needed)*/
- ulint access_type,/* in: OS_FILE_READ_ONLY or OS_FILE_READ_WRITE */
- ibool* success);/* out: TRUE if succeed, FALSE if error */
+ /* out, own: handle to the file, not defined
+ if error, error number can be retrieved with
+ os_file_get_last_error */
+ const char* name, /* in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/* in: OS_FILE_OPEN if an existing file is
+ opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error), or
+ OS_FILE_CREATE_PATH if new file
+ (if exists, error) and subdirectories along
+ its path are created (if needed)*/
+ ulint access_type,/* in: OS_FILE_READ_ONLY or
+ OS_FILE_READ_WRITE */
+ ibool* success);/* out: TRUE if succeed, FALSE if error */
/********************************************************************
A simple function to open or create a file. */
os_file_t
os_file_create_simple_no_error_handling(
/*====================================*/
- /* out, own: handle to the file, not defined if error,
- error number can be retrieved with
- os_file_get_last_error */
- char* name, /* in: name of the file or path as a null-terminated
- string */
- ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
- (if does not exist, error), or OS_FILE_CREATE if a new
- file is created (if exists, error) */
- ulint access_type,/* in: OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or
- OS_FILE_READ_ALLOW_DELETE; the last option is used by
- a backup program reading the file */
- ibool* success);/* out: TRUE if succeed, FALSE if error */
+ /* out, own: handle to the file, not defined
+ if error, error number can be retrieved with
+ os_file_get_last_error */
+ const char* name, /* in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/* in: OS_FILE_OPEN if an existing file
+ is opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error) */
+ ulint access_type,/* in: OS_FILE_READ_ONLY,
+ OS_FILE_READ_WRITE, or
+ OS_FILE_READ_ALLOW_DELETE; the last option is
+ used by a backup program reading the file */
+ ibool* success);/* out: TRUE if succeed, FALSE if error */
/********************************************************************
Opens an existing file or creates a new. */
os_file_t
os_file_create(
/*===========*/
- /* out, own: handle to the file, not defined if error,
- error number can be retrieved with
- os_file_get_last_error */
- char* name, /* in: name of the file or path as a null-terminated
- string */
- ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
- (if does not exist, error), or OS_FILE_CREATE if a new
- file is created (if exists, error), OS_FILE_OVERWRITE
- if a new file is created or an old overwritten;
- OS_FILE_OPEN_RAW, if a raw device or disk partition
- should be opened */
- ulint purpose,/* in: OS_FILE_AIO, if asynchronous, non-buffered i/o
- is desired, OS_FILE_NORMAL, if any normal file;
- NOTE that it also depends on type, os_aio_.. and srv_..
- variables whether we really use async i/o or
- unbuffered i/o: look in the function source code for
- the exact rules */
- ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */
- ibool* success);/* out: TRUE if succeed, FALSE if error */
+ /* out, own: handle to the file, not defined
+ if error, error number can be retrieved with
+ os_file_get_last_error */
+ const char* name, /* in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/* in: OS_FILE_OPEN if an existing file
+ is opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error),
+ OS_FILE_OVERWRITE if a new file is created
+ or an old overwritten;
+ OS_FILE_OPEN_RAW, if a raw device or disk
+ partition should be opened */
+ ulint purpose,/* in: OS_FILE_AIO, if asynchronous,
+ non-buffered i/o is desired,
+ OS_FILE_NORMAL, if any normal file;
+ NOTE that it also depends on type, os_aio_..
+ and srv_.. variables whether we really use
+ async i/o or unbuffered i/o: look in the
+ function source code for the exact rules */
+ ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */
+ ibool* success);/* out: TRUE if succeed, FALSE if error */
/***************************************************************************
Deletes a file. The file has to be closed before calling this. */
ibool
os_file_delete(
/*===========*/
- /* out: TRUE if success */
- char* name); /* in: file path as a null-terminated string */
+ /* out: TRUE if success */
+ const char* name); /* in: file path as a null-terminated string */
/***************************************************************************
Deletes a file if it exists. The file has to be closed before calling this. */
@@ -295,8 +305,8 @@ Deletes a file if it exists. The file has to be closed before calling this. */
ibool
os_file_delete_if_exists(
/*=====================*/
- /* out: TRUE if success */
- char* name); /* in: file path as a null-terminated string */
+ /* out: TRUE if success */
+ const char* name); /* in: file path as a null-terminated string */
/***************************************************************************
Renames a file (can also move it to another directory). It is safest that the
file is closed before calling this function. */
@@ -304,10 +314,10 @@ file is closed before calling this function. */
ibool
os_file_rename(
/*===========*/
- /* out: TRUE if success */
- char* oldpath, /* in: old file path as a null-terminated
- string */
- char* newpath); /* in: new file path */
+ /* out: TRUE if success */
+ const char* oldpath, /* in: old file path as a
+ null-terminated string */
+ const char* newpath); /* in: new file path */
/***************************************************************************
Closes a file handle. In case of error, error number can be retrieved with
os_file_get_last_error. */
@@ -351,7 +361,7 @@ ibool
os_file_set_size(
/*=============*/
/* out: TRUE if success */
- char* name, /* in: name of the file or path as a
+ const char* name, /* in: name of the file or path as a
null-terminated string */
os_file_t file, /* in: handle to a file */
ulint size, /* in: least significant 32 bits of file
@@ -426,10 +436,10 @@ os_file_write(
/*==========*/
/* out: TRUE if request was
successful, FALSE if fail */
- char* name, /* in: name of the file or path as a
+ const char* name, /* in: name of the file or path as a
null-terminated string */
os_file_t file, /* in: handle to a file */
- void* buf, /* in: buffer from which to write */
+ const void* buf, /* in: buffer from which to write */
ulint offset, /* in: least significant 32 bits of file
offset where to write */
ulint offset_high,/* in: most significant 32 bits of
@@ -442,8 +452,8 @@ ibool
os_file_status(
/*===========*/
/* out: TRUE if call succeeded */
- char * path, /* in: pathname of the file */
- ibool * exists, /* out: TRUE if file exists */
+ const char* path, /* in: pathname of the file */
+ ibool* exists, /* out: TRUE if file exists */
os_file_type_t* type); /* out: type of the file (if it exists) */
/********************************************************************
The function os_file_dirname returns a directory component of a
@@ -478,7 +488,7 @@ os_file_dirname(
/*============*/
/* out, own: directory component of the
pathname */
- char* path); /* in: pathname */
+ const char* path); /* in: pathname */
/********************************************************************
Creates all missing subdirectories along the given path. */
@@ -487,7 +497,7 @@ os_file_create_subdirs_if_needed(
/*=============================*/
/* out: TRUE if call succeeded
FALSE otherwise */
- char* path); /* in: path name */
+ const char* path); /* in: path name */
/****************************************************************************
Initializes the asynchronous io system. Creates separate aio array for
non-ibuf read and write, a third aio array for the ibuf i/o, with just one
@@ -527,7 +537,7 @@ os_aio(
because i/os are not actually handled until
all have been posted: use with great
caution! */
- char* name, /* in: name of the file or path as a
+ const char* name, /* in: name of the file or path as a
null-terminated string */
os_file_t file, /* in: handle to a file */
void* buf, /* in: buffer where to read or from which
diff --git a/innobase/include/os0sync.h b/innobase/include/os0sync.h
index e1cf263216e..d27b1676f1b 100644
--- a/innobase/include/os0sync.h
+++ b/innobase/include/os0sync.h
@@ -87,9 +87,9 @@ explicitly by calling sync_os_reset_event. */
os_event_t
os_event_create(
/*============*/
- /* out: the event handle */
- char* name); /* in: the name of the event, if NULL
- the event is created without a name */
+ /* out: the event handle */
+ const char* name); /* in: the name of the event, if NULL
+ the event is created without a name */
#ifdef __WIN__
/*************************************************************
Creates an auto-reset event semaphore, i.e., an event which is automatically
@@ -98,9 +98,9 @@ reset when a single thread is released. Works only in Windows. */
os_event_t
os_event_create_auto(
/*=================*/
- /* out: the event handle */
- char* name); /* in: the name of the event, if NULL
- the event is created without a name */
+ /* out: the event handle */
+ const char* name); /* in: the name of the event, if NULL
+ the event is created without a name */
#endif
/**************************************************************
Sets an event semaphore to the signaled state: lets waiting threads
@@ -171,9 +171,9 @@ mutex semaphore of InnoDB itself (mutex_t) should be used where possible. */
os_mutex_t
os_mutex_create(
/*============*/
- /* out: the mutex handle */
- char* name); /* in: the name of the mutex, if NULL
- the mutex is created without a name */
+ /* out: the mutex handle */
+ const char* name); /* in: the name of the mutex, if NULL
+ the mutex is created without a name */
/**************************************************************
Acquires ownership of a mutex semaphore. */
diff --git a/innobase/include/pars0pars.h b/innobase/include/pars0pars.h
index 2e86a7e5534..28985e2f9d0 100644
--- a/innobase/include/pars0pars.h
+++ b/innobase/include/pars0pars.h
@@ -74,8 +74,8 @@ Parses an SQL string returning the query graph. */
que_t*
pars_sql(
/*=====*/
- /* out, own: the query graph */
- char* str); /* in: SQL string */
+ /* out, own: the query graph */
+ const char* str); /* in: SQL string */
/*****************************************************************
Retrieves characters to the lexical analyzer. */
@@ -92,7 +92,7 @@ Called by yyparse on error. */
void
yyerror(
/*====*/
- char* s); /* in: error message string */
+ const char* s); /* in: error message string */
/*************************************************************************
Parses a variable declaration. */
diff --git a/innobase/include/pars0sym.h b/innobase/include/pars0sym.h
index 3060fd06c8f..a40523861dd 100644
--- a/innobase/include/pars0sym.h
+++ b/innobase/include/pars0sym.h
@@ -122,7 +122,7 @@ struct sym_node_struct{
SYM_IMPLICIT_VAR,
SYM_LIT, SYM_TABLE,
SYM_CURSOR, ... */
- char* name; /* name of an id */
+ const char* name; /* name of an id */
ulint name_len; /* id name length */
dict_table_t* table; /* table definition
if a table id or a
@@ -150,7 +150,7 @@ struct sym_tab_struct{
que_t* query_graph;
/* query graph generated by the
parser */
- char* sql_string;
+ const char* sql_string;
/* SQL string to parse */
int string_len;
/* SQL string length */
diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h
index 0b9f34dda1e..af6d8969cfc 100644
--- a/innobase/include/row0mysql.h
+++ b/innobase/include/row0mysql.h
@@ -316,15 +316,16 @@ fields than mentioned in the constraint. */
int
row_table_add_foreign_constraints(
/*==============================*/
- /* out: error code or DB_SUCCESS */
- trx_t* trx, /* in: transaction */
- char* sql_string, /* in: table create statement where
- foreign keys are declared like:
+ /* out: error code or DB_SUCCESS */
+ trx_t* trx, /* in: transaction */
+ const char* sql_string, /* in: table create statement where
+ foreign keys are declared like:
FOREIGN KEY (a, b) REFERENCES table2(c, d),
- table2 can be written also with the database
- name before it: test.table2 */
- char* name); /* in: table full name in the normalized form
- database_name/table_name */
+ table2 can be written also with the
+ database name before it: test.table2 */
+ const char* name); /* in: table full name in the
+ normalized form
+ database_name/table_name */
/*************************************************************************
The master thread in srv0srv.c calls this regularly to drop tables which
we must drop in background after queries to them have ended. Such lazy
@@ -351,10 +352,10 @@ output by the master thread. */
int
row_drop_table_for_mysql(
/*=====================*/
- /* out: error code or DB_SUCCESS */
- char* name, /* in: table name */
- trx_t* trx, /* in: transaction handle */
- ibool drop_db);/* in: TRUE=dropping whole database */
+ /* out: error code or DB_SUCCESS */
+ const char* name, /* in: table name */
+ trx_t* trx, /* in: transaction handle */
+ ibool drop_db);/* in: TRUE=dropping whole database */
/*************************************************************************
Discards the tablespace of a table which stored in an .ibd file. Discarding
@@ -382,9 +383,9 @@ discard ongoing operations. */
int
row_discard_tablespace_for_mysql(
/*=============================*/
- /* out: error code or DB_SUCCESS */
- char* name, /* in: table name */
- trx_t* trx); /* in: transaction handle */
+ /* out: error code or DB_SUCCESS */
+ const char* name, /* in: table name */
+ trx_t* trx); /* in: transaction handle */
/*********************************************************************
Imports a tablespace. The space id in the .ibd file must match the space id
of the table in the data dictionary. */
@@ -392,28 +393,28 @@ of the table in the data dictionary. */
int
row_import_tablespace_for_mysql(
/*============================*/
- /* out: error code or DB_SUCCESS */
- char* name, /* in: table name */
- trx_t* trx); /* in: transaction handle */
+ /* out: error code or DB_SUCCESS */
+ const char* name, /* in: table name */
+ trx_t* trx); /* in: transaction handle */
/*************************************************************************
Drops a database for MySQL. */
int
row_drop_database_for_mysql(
/*========================*/
- /* out: error code or DB_SUCCESS */
- char* name, /* in: database name which ends to '/' */
- trx_t* trx); /* in: transaction handle */
+ /* out: error code or DB_SUCCESS */
+ const char* name, /* in: database name which ends to '/' */
+ trx_t* trx); /* in: transaction handle */
/*************************************************************************
Renames a table for MySQL. */
int
row_rename_table_for_mysql(
/*=======================*/
- /* out: error code or DB_SUCCESS */
- char* old_name, /* in: old table name */
- char* new_name, /* in: new table name */
- trx_t* trx); /* in: transaction handle */
+ /* out: error code or DB_SUCCESS */
+ const char* old_name, /* in: old table name */
+ const char* new_name, /* in: new table name */
+ trx_t* trx); /* in: transaction handle */
/*************************************************************************
Checks a table for corruption. */
diff --git a/innobase/include/row0sel.h b/innobase/include/row0sel.h
index a35d588ad08..0be224eb255 100644
--- a/innobase/include/row0sel.h
+++ b/innobase/include/row0sel.h
@@ -144,11 +144,11 @@ consistent read result, or store it to the query cache. */
ibool
row_search_check_if_query_cache_permitted(
/*======================================*/
- /* out: TRUE if storing or retrieving from
- the query cache is permitted */
- trx_t* trx, /* in: transaction object */
- char* norm_name); /* in: concatenation of database name, '/'
- char, table name */
+ /* out: TRUE if storing or retrieving
+ from the query cache is permitted */
+ trx_t* trx, /* in: transaction object */
+ const char* norm_name); /* in: concatenation of database name,
+ '/' char, table name */
/* A structure for caching column values for prefetched rows */
diff --git a/innobase/include/sync0arr.h b/innobase/include/sync0arr.h
index 383d0c69fb2..e7d511f8137 100644
--- a/innobase/include/sync0arr.h
+++ b/innobase/include/sync0arr.h
@@ -51,7 +51,7 @@ sync_array_reserve_cell(
sync_array_t* arr, /* in: wait array */
void* object, /* in: pointer to the object to wait for */
ulint type, /* in: lock request type */
- char* file, /* in: file where requested */
+ const char* file, /* in: file where requested */
ulint line, /* in: line where requested */
ulint* index); /* out: index of the reserved cell */
/**********************************************************************
diff --git a/innobase/include/sync0ipm.ic b/innobase/include/sync0ipm.ic
index b8aa87ba6d6..126aceae1eb 100644
--- a/innobase/include/sync0ipm.ic
+++ b/innobase/include/sync0ipm.ic
@@ -92,7 +92,7 @@ loop:
loop_count++;
ut_ad(loop_count < 15);
- if (mutex_enter_nowait(mutex, IB__FILE__, __LINE__) == 0) {
+ if (mutex_enter_nowait(mutex, __FILE__, __LINE__) == 0) {
/* Succeeded! */
return(0);
@@ -105,7 +105,7 @@ loop:
/* Order is important here: FIRST reset event, then set waiters */
ip_mutex_set_waiters(ip_mutex, 1);
- if (mutex_enter_nowait(mutex, IB__FILE__, __LINE__) == 0) {
+ if (mutex_enter_nowait(mutex, __FILE__, __LINE__) == 0) {
/* Succeeded! */
return(0);
diff --git a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h
index 82123a529a3..63b01ffac80 100644
--- a/innobase/include/sync0rw.h
+++ b/innobase/include/sync0rw.h
@@ -62,7 +62,7 @@ location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
is necessary only if the memory block containing it is freed. */
-#define rw_lock_create(L) rw_lock_create_func((L), IB__FILE__, __LINE__)
+#define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__)
/*=====================*/
/**********************************************************************
Creates, or rather, initializes an rw-lock object in a specified memory
@@ -74,7 +74,7 @@ void
rw_lock_create_func(
/*================*/
rw_lock_t* lock, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline); /* in: file line where created */
/**********************************************************************
Calling this function is obligatory only if the memory buffer containing
@@ -100,19 +100,19 @@ NOTE! The following macros should be used in rw s-locking, not the
corresponding function. */
#define rw_lock_s_lock(M) rw_lock_s_lock_func(\
- (M), 0, IB__FILE__, __LINE__)
+ (M), 0, __FILE__, __LINE__)
/******************************************************************
NOTE! The following macros should be used in rw s-locking, not the
corresponding function. */
#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(\
- (M), (P), IB__FILE__, __LINE__)
+ (M), (P), __FILE__, __LINE__)
/******************************************************************
NOTE! The following macros should be used in rw s-locking, not the
corresponding function. */
#define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(\
- (M), IB__FILE__, __LINE__)
+ (M), __FILE__, __LINE__)
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function, except if
you supply the file name and line number. Lock an rw-lock in shared mode
@@ -127,7 +127,7 @@ rw_lock_s_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function, except if
@@ -139,7 +139,7 @@ rw_lock_s_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function! Lock an
@@ -151,7 +151,7 @@ rw_lock_x_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
Releases a shared mode lock. */
@@ -186,19 +186,19 @@ NOTE! The following macro should be used in rw x-locking, not the
corresponding function. */
#define rw_lock_x_lock(M) rw_lock_x_lock_func(\
- (M), 0, IB__FILE__, __LINE__)
+ (M), 0, __FILE__, __LINE__)
/******************************************************************
NOTE! The following macro should be used in rw x-locking, not the
corresponding function. */
#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(\
- (M), (P), IB__FILE__, __LINE__)
+ (M), (P), __FILE__, __LINE__)
/******************************************************************
NOTE! The following macros should be used in rw x-locking, not the
corresponding function. */
#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(\
- (M), IB__FILE__, __LINE__)
+ (M), __FILE__, __LINE__)
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function! Lock an
rw-lock in exclusive mode for the current thread. If the rw-lock is locked
@@ -215,7 +215,7 @@ rw_lock_x_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
Releases an exclusive mode lock. */
@@ -253,9 +253,9 @@ UNIV_INLINE
void
rw_lock_s_lock_direct(
/*==================*/
- rw_lock_t* lock /* in: pointer to rw-lock */
- ,char* file_name, /* in: file name where lock requested */
- ulint line /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line /* in: line where lock requested */
);
/**********************************************************************
Low-level function which locks an rw-lock in x-mode when we know that it
@@ -265,9 +265,9 @@ UNIV_INLINE
void
rw_lock_x_lock_direct(
/*==================*/
- rw_lock_t* lock /* in: pointer to rw-lock */
- ,char* file_name, /* in: file name where lock requested */
- ulint line /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line /* in: line where lock requested */
);
/**********************************************************************
This function is used in the insert buffer to move the ownership of an
@@ -451,10 +451,10 @@ struct rw_lock_struct {
#endif /* UNIV_SYNC_DEBUG */
ulint level; /* Level in the global latching
order; default SYNC_LEVEL_NONE */
- char* cfile_name; /* File name where lock created */
+ const char* cfile_name;/* File name where lock created */
ulint cline; /* Line where created */
- char* last_s_file_name;/* File name where last time s-locked */
- char* last_x_file_name;/* File name where last time x-locked */
+ const char* last_s_file_name;/* File name where last s-locked */
+ const char* last_x_file_name;/* File name where last x-locked */
ulint last_s_line; /* Line number where last time s-locked */
ulint last_x_line; /* Line number where last time x-locked */
ulint magic_n;
@@ -471,7 +471,7 @@ struct rw_lock_debug_struct {
ulint pass; /* Pass value given in the lock operation */
ulint lock_type; /* Type of the lock: RW_LOCK_EX,
RW_LOCK_SHARED, RW_LOCK_WAIT_EX */
- char* file_name; /* File name where the lock was obtained */
+ const char* file_name;/* File name where the lock was obtained */
ulint line; /* Line where the rw-lock was locked */
UT_LIST_NODE_T(rw_lock_debug_t) list;
/* Debug structs are linked in a two-way
diff --git a/innobase/include/sync0rw.ic b/innobase/include/sync0rw.ic
index 8fc93f4a9da..655bd7f6517 100644
--- a/innobase/include/sync0rw.ic
+++ b/innobase/include/sync0rw.ic
@@ -18,7 +18,7 @@ rw_lock_s_lock_spin(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
@@ -130,7 +130,7 @@ rw_lock_s_lock_low(
ulint pass __attribute__((unused)),
/* in: pass value; != 0, if the lock will be
passed to another thread to unlock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name, /* in: file name where lock requested */
ulint line) /* in: line where requested */
{
#ifdef UNIV_SYNC_DEBUG
@@ -163,9 +163,9 @@ UNIV_INLINE
void
rw_lock_s_lock_direct(
/*==================*/
- rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
- ulint line) /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line) /* in: line where lock requested */
{
ut_ad(lock->writer == RW_LOCK_NOT_LOCKED);
ut_ad(rw_lock_get_reader_count(lock) == 0);
@@ -189,9 +189,9 @@ UNIV_INLINE
void
rw_lock_x_lock_direct(
/*==================*/
- rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name, /* in: file name where lock requested */
- ulint line) /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line) /* in: line where lock requested */
{
ut_ad(rw_lock_validate(lock));
ut_ad(rw_lock_get_reader_count(lock) == 0);
@@ -223,7 +223,7 @@ rw_lock_s_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
/* NOTE: As we do not know the thread ids for threads which have
@@ -267,7 +267,7 @@ rw_lock_s_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ibool success = FALSE;
@@ -304,7 +304,7 @@ rw_lock_x_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ibool success = FALSE;
diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h
index 0cc48d5f299..4307ca5ba0c 100644
--- a/innobase/include/sync0sync.h
+++ b/innobase/include/sync0sync.h
@@ -36,7 +36,7 @@ in the reset state. Explicit freeing of the mutex with mutex_free is
necessary only if the memory block containing it is freed. */
-#define mutex_create(M) mutex_create_func((M), IB__FILE__, __LINE__)
+#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__)
/*===================*/
/**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory
@@ -48,7 +48,7 @@ void
mutex_create_func(
/*==============*/
mutex_t* mutex, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline); /* in: file line where created */
/**********************************************************************
Calling this function is obligatory only if the memory buffer containing
@@ -64,7 +64,7 @@ mutex_free(
NOTE! The following macro should be used in mutex locking, not the
corresponding function. */
-#define mutex_enter(M) mutex_enter_func((M), IB__FILE__, __LINE__)
+#define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
/**********************************************************************
A noninlined function that reserves a mutex. In ha_innodb.cc we have disabled
inlining of InnoDB functions, and no inlined functions should be called from
@@ -80,7 +80,7 @@ corresponding function. */
/* NOTE! currently same as mutex_enter! */
-#define mutex_enter_fast(M) mutex_enter_func((M), IB__FILE__, __LINE__)
+#define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__)
#define mutex_enter_fast_func mutex_enter_func;
/**********************************************************************
NOTE! Use the corresponding macro in the header file, not this function
@@ -92,7 +92,7 @@ void
mutex_enter_func(
/*=============*/
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name, /* in: file name where locked */
+ const char* file_name, /* in: file name where locked */
ulint line); /* in: line where locked */
/************************************************************************
Tries to lock the mutex for the current thread. If the lock is not acquired
@@ -103,9 +103,9 @@ mutex_enter_nowait(
/*===============*/
/* out: 0 if succeed, 1 if not */
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name, /* in: file name where mutex
+ const char* file_name, /* in: file name where mutex
requested */
- ulint line); /* in: line where requested */
+ ulint line); /* in: line where requested */
/**********************************************************************
Unlocks a mutex owned by the current thread. */
UNIV_INLINE
@@ -470,7 +470,7 @@ struct mutex_struct {
#endif /* UNIV_SYNC_DEBUG */
ulint level; /* Level in the global latching
order; default SYNC_LEVEL_NONE */
- char* cfile_name; /* File name where mutex created */
+ const char* cfile_name;/* File name where mutex created */
ulint cline; /* Line where created */
ulint magic_n;
};
diff --git a/innobase/include/sync0sync.ic b/innobase/include/sync0sync.ic
index 758c8524f66..ecb498918e2 100644
--- a/innobase/include/sync0sync.ic
+++ b/innobase/include/sync0sync.ic
@@ -23,7 +23,7 @@ void
mutex_spin_wait(
/*============*/
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name,/* in: file name where mutex requested */
+ const char* file_name,/* in: file name where mutex requested */
ulint line); /* in: line where requested */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
@@ -241,9 +241,9 @@ UNIV_INLINE
void
mutex_enter_func(
/*=============*/
- mutex_t* mutex, /* in: pointer to mutex */
- char* file_name,/* in: file name where locked */
- ulint line) /* in: line where locked */
+ mutex_t* mutex, /* in: pointer to mutex */
+ const char* file_name, /* in: file name where locked */
+ ulint line) /* in: line where locked */
{
ut_ad(mutex_validate(mutex));
diff --git a/innobase/include/trx0roll.h b/innobase/include/trx0roll.h
index 0d7126c9c57..6004551f456 100644
--- a/innobase/include/trx0roll.h
+++ b/innobase/include/trx0roll.h
@@ -193,7 +193,7 @@ trx_rollback_to_savepoint_for_mysql(
DB_NO_SAVEPOINT,
otherwise DB_SUCCESS */
trx_t* trx, /* in: transaction handle */
- char* savepoint_name, /* in: savepoint name */
+ const char* savepoint_name, /* in: savepoint name */
ib_longlong* mysql_binlog_cache_pos);/* out: the MySQL binlog cache
position corresponding to this
savepoint; MySQL needs this
@@ -211,7 +211,7 @@ trx_savepoint_for_mysql(
/*====================*/
/* out: always DB_SUCCESS */
trx_t* trx, /* in: transaction handle */
- char* savepoint_name, /* in: savepoint name */
+ const char* savepoint_name, /* in: savepoint name */
ib_longlong binlog_cache_pos); /* in: MySQL binlog cache
position corresponding to this
connection at the time of the
diff --git a/innobase/include/trx0sys.h b/innobase/include/trx0sys.h
index 9987955ec76..7d20455ffdf 100644
--- a/innobase/include/trx0sys.h
+++ b/innobase/include/trx0sys.h
@@ -258,7 +258,7 @@ replication has proceeded. */
void
trx_sys_update_mysql_binlog_offset(
/*===============================*/
- char* file_name,/* in: MySQL log file name */
+ const char* file_name,/* in: MySQL log file name */
ib_longlong offset, /* in: position in that log file */
ulint field, /* in: offset of the MySQL log info field in
the trx sys header */
diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h
index 71269cb1e4e..a8c1df534da 100644
--- a/innobase/include/trx0trx.h
+++ b/innobase/include/trx0trx.h
@@ -275,13 +275,15 @@ trx_commit_step(
que_thr_t* thr); /* in: query thread */
/**************************************************************************
Prints info about a transaction to the standard output. The caller must
-own the kernel mutex. */
+own the kernel mutex and must have called
+innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL or
+InnoDB cannot meanwhile change the info printed here. */
void
trx_print(
/*======*/
FILE* f, /* in: output stream */
- trx_t* trx); /* in: transaction */
+ trx_t* trx); /* in: transaction */
/* Signal to a transaction */
@@ -313,7 +315,7 @@ struct trx_struct{
ulint magic_n;
/* All the next fields are protected by the kernel mutex, except the
undo logs which are protected by undo_mutex */
- char* op_info; /* English text describing the
+ const char* op_info; /* English text describing the
current operation, or an empty
string */
ulint type; /* TRX_USER, TRX_PURGE */
@@ -356,7 +358,7 @@ struct trx_struct{
char** mysql_query_str;/* pointer to the field in mysqld_thd
which contains the pointer to the
current SQL query string */
- char* mysql_log_file_name;
+ const char* mysql_log_file_name;
/* if MySQL binlog is used, this field
contains a pointer to the latest file
name; this is NULL if binlog is not
@@ -364,7 +366,7 @@ struct trx_struct{
ib_longlong mysql_log_offset;/* if MySQL binlog is used, this field
contains the end offset of the binlog
entry */
- char* mysql_master_log_file_name;
+ const char* mysql_master_log_file_name;
/* if the database server is a MySQL
replication slave, we have here the
master binlog name up to which
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index cd471a89607..be71d4211b3 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -242,11 +242,6 @@ contains the sum of the following flag and the locally stored len. */
#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE)
-/* The following definition of __FILE__ removes compiler warnings
-associated with const char* / char* mismatches with __FILE__ */
-
-#define IB__FILE__ ((char*)__FILE__)
-
#include <stdio.h>
#include "ut0dbg.h"
#include "ut0ut.h"
diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h
index 085b4811a73..a155f68bd12 100644
--- a/innobase/include/ut0dbg.h
+++ b/innobase/include/ut0dbg.h
@@ -27,7 +27,7 @@ extern const char* ut_dbg_msg_stop;
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\
- os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__,\
(ulint)__LINE__);\
fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
fputs(ut_dbg_msg_trap, stderr);\
@@ -36,7 +36,7 @@ extern const char* ut_dbg_msg_stop;
}\
if (ut_dbg_stop_threads) {\
fprintf(stderr, ut_dbg_msg_stop,\
- os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
os_thread_sleep(1000000000);\
}\
} while (0)
@@ -44,7 +44,7 @@ extern const char* ut_dbg_msg_stop;
#define ut_error do {\
ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\
- os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
fprintf(stderr, ut_dbg_msg_trap);\
ut_dbg_stop_threads = TRUE;\
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
diff --git a/innobase/include/ut0mem.h b/innobase/include/ut0mem.h
index bfc937eb212..85b99efff68 100644
--- a/innobase/include/ut0mem.h
+++ b/innobase/include/ut0mem.h
@@ -18,15 +18,15 @@ extern ulint ut_total_allocated_memory;
UNIV_INLINE
void*
-ut_memcpy(void* dest, void* sour, ulint n);
+ut_memcpy(void* dest, const void* sour, ulint n);
UNIV_INLINE
void*
-ut_memmove(void* dest, void* sour, ulint n);
+ut_memmove(void* dest, const void* sour, ulint n);
UNIV_INLINE
int
-ut_memcmp(void* str1, void* str2, ulint n);
+ut_memcmp(const void* str1, const void* str2, ulint n);
/**************************************************************************
@@ -75,7 +75,7 @@ ut_free_all_mem(void);
UNIV_INLINE
char*
-ut_strcpy(char* dest, char* sour);
+ut_strcpy(char* dest, const char* sour);
UNIV_INLINE
ulint
@@ -83,7 +83,7 @@ ut_strlen(const char* str);
UNIV_INLINE
int
-ut_strcmp(void* str1, void* str2);
+ut_strcmp(const void* str1, const void* str2);
/**************************************************************************
Determine the length of a string when it is quoted with ut_strcpyq(). */
@@ -118,17 +118,6 @@ ut_memcpyq(
const char* src, /* in: string to be quoted */
ulint len); /* in: length of src */
-/**************************************************************************
-Catenates two strings into newly allocated memory. The memory must be freed
-using mem_free. */
-
-char*
-ut_str_catenate(
-/*============*/
- /* out, own: catenated null-terminated string */
- char* str1, /* in: null-terminated string */
- char* str2); /* in: null-terminated string */
-
#ifndef UNIV_NONINL
#include "ut0mem.ic"
#endif
diff --git a/innobase/include/ut0mem.ic b/innobase/include/ut0mem.ic
index 951d9538424..3bb30a80f22 100644
--- a/innobase/include/ut0mem.ic
+++ b/innobase/include/ut0mem.ic
@@ -8,28 +8,28 @@ Created 5/30/1994 Heikki Tuuri
UNIV_INLINE
void*
-ut_memcpy(void* dest, void* sour, ulint n)
+ut_memcpy(void* dest, const void* sour, ulint n)
{
return(memcpy(dest, sour, n));
}
UNIV_INLINE
void*
-ut_memmove(void* dest, void* sour, ulint n)
+ut_memmove(void* dest, const void* sour, ulint n)
{
return(memmove(dest, sour, n));
}
UNIV_INLINE
int
-ut_memcmp(void* str1, void* str2, ulint n)
+ut_memcmp(const void* str1, const void* str2, ulint n)
{
return(memcmp(str1, str2, n));
}
UNIV_INLINE
char*
-ut_strcpy(char* dest, char* sour)
+ut_strcpy(char* dest, const char* sour)
{
return(strcpy(dest, sour));
}
@@ -43,9 +43,9 @@ ut_strlen(const char* str)
UNIV_INLINE
int
-ut_strcmp(void* str1, void* str2)
+ut_strcmp(const void* str1, const void* str2)
{
- return(strcmp((char*)str1, (char*)str2));
+ return(strcmp((const char*)str1, (const char*)str2));
}
/**************************************************************************
diff --git a/innobase/include/ut0rnd.h b/innobase/include/ut0rnd.h
index c8ef0dd4001..aeec5d2f6eb 100644
--- a/innobase/include/ut0rnd.h
+++ b/innobase/include/ut0rnd.h
@@ -92,17 +92,17 @@ UNIV_INLINE
ulint
ut_fold_string(
/*===========*/
- /* out: folded value */
- char* str); /* in: null-terminated string */
+ /* out: folded value */
+ const char* str); /* in: null-terminated string */
/*****************************************************************
Folds a binary string. */
UNIV_INLINE
ulint
ut_fold_binary(
/*===========*/
- /* out: folded value */
- byte* str, /* in: string of bytes */
- ulint len); /* in: length */
+ /* out: folded value */
+ const byte* str, /* in: string of bytes */
+ ulint len); /* in: length */
/***************************************************************
Looks for a prime number slightly greater than the given argument.
The prime is chosen so that it is not near any power of 2. */
diff --git a/innobase/include/ut0rnd.ic b/innobase/include/ut0rnd.ic
index 5493c37404a..06d7012f60b 100644
--- a/innobase/include/ut0rnd.ic
+++ b/innobase/include/ut0rnd.ic
@@ -173,8 +173,8 @@ UNIV_INLINE
ulint
ut_fold_string(
/*===========*/
- /* out: folded value */
- char* str) /* in: null-terminated string */
+ /* out: folded value */
+ const char* str) /* in: null-terminated string */
{
#ifdef UNIV_DEBUG
ulint i = 0;
@@ -203,9 +203,9 @@ UNIV_INLINE
ulint
ut_fold_binary(
/*===========*/
- /* out: folded value */
- byte* str, /* in: string of bytes */
- ulint len) /* in: length */
+ /* out: folded value */
+ const byte* str, /* in: string of bytes */
+ ulint len) /* in: length */
{
ulint i;
ulint fold = 0;
diff --git a/innobase/include/ut0ut.h b/innobase/include/ut0ut.h
index 6c173f5cba9..04516535965 100644
--- a/innobase/include/ut0ut.h
+++ b/innobase/include/ut0ut.h
@@ -17,21 +17,6 @@ Created 1/20/1994 Heikki Tuuri
typedef time_t ib_time_t;
-
-/************************************************************
-On the 64-bit Windows we substitute the format string
-%l -> %I64
-because we define ulint as unsigned __int64 and lint as __int64 on Windows,
-and both the Microsoft and Intel C compilers require the format string
-%I64 in that case instead of %l. */
-
-int
-ut_printf(
-/*======*/
- /* out: the number of characters written, or
- negative in case of an error */
- const char* format, /* in: format of prints */
- ...); /* in: arguments to be printed */
/************************************************************
On the 64-bit Windows we substitute the format string
%l -> %I64
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 8805a22bb57..223d9af78d1 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -17,6 +17,32 @@ Created 5/7/1996 Heikki Tuuri
#include "dict0mem.h"
#include "trx0sys.h"
+
+/* 2 function prototypes copied from ha_innodb.cc: */
+
+/*****************************************************************
+If you want to print a thd that is not associated with the current thread,
+you must call this function before reserving the InnoDB kernel_mutex, to
+protect MySQL from setting thd->query NULL. If you print a thd of the current
+thread, we know that MySQL cannot modify thd->query, and it is not necessary
+to call this. Call innobase_mysql_end_print_arbitrary_thd() after you release
+the kernel_mutex.
+NOTE that /mysql/innobase/lock/lock0lock.c must contain the prototype for this
+function! */
+
+void
+innobase_mysql_prepare_print_arbitrary_thd(void);
+/*============================================*/
+
+/*****************************************************************
+Relases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd().
+NOTE that /mysql/innobase/lock/lock0lock.c must contain the prototype for this
+function! */
+
+void
+innobase_mysql_end_print_arbitrary_thd(void);
+/*========================================*/
+
/* Restricts the length of search we will do in the waits-for
graph of transactions */
#define LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK 1000000
@@ -1629,7 +1655,8 @@ lock_rec_enqueue_waiting(
" InnoDB: Error: a record lock wait happens in a dictionary operation!\n"
"InnoDB: Table name ", stderr);
ut_print_name(stderr, index->table_name);
- fputs(". Send a bug report to mysql@lists.mysql.com\n",
+ fputs(".\n"
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
stderr);
}
@@ -3269,7 +3296,8 @@ lock_table_enqueue_waiting(
" InnoDB: Error: a table lock wait happens in a dictionary operation!\n"
"InnoDB: Table name ", stderr);
ut_print_name(stderr, table->name);
- fputs(". Send a bug report to mysql@lists.mysql.com\n",
+ fputs(".\n"
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
stderr);
}
@@ -3889,7 +3917,7 @@ lock_rec_print(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH,
NULL, BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__, &mtr);
+ __FILE__, __LINE__, &mtr);
if (page) {
page = buf_page_get_nowait(space, page_no, RW_S_LATCH, &mtr);
@@ -3975,6 +4003,11 @@ lock_print_info(
ulint i;
mtr_t mtr;
+ /* We must protect the MySQL thd->query field with a MySQL mutex, and
+ because the MySQL mutex must be reserved before the kernel_mutex of
+ InnoDB, we call innobase_mysql_prepare_print_arbitrary_thd() here. */
+
+ innobase_mysql_prepare_print_arbitrary_thd();
lock_mutex_enter_kernel();
if (lock_deadlock_found) {
@@ -4038,6 +4071,7 @@ loop:
if (trx == NULL) {
lock_mutex_exit_kernel();
+ innobase_mysql_end_print_arbitrary_thd();
ut_ad(lock_validate());
@@ -4102,6 +4136,7 @@ loop:
if (load_page_first) {
lock_mutex_exit_kernel();
+ innobase_mysql_end_print_arbitrary_thd();
mtr_start(&mtr);
@@ -4111,6 +4146,7 @@ loop:
load_page_first = FALSE;
+ innobase_mysql_prepare_print_arbitrary_thd();
lock_mutex_enter_kernel();
goto loop;
diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c
index 4f4220962f0..65fb3466ad5 100644
--- a/innobase/log/log0recv.c
+++ b/innobase/log/log0recv.c
@@ -1080,7 +1080,7 @@ recv_recover_page(
success = buf_page_get_known_nowait(RW_X_LATCH, page,
BUF_KEEP_OLD,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
ut_a(success);
@@ -1664,7 +1664,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space1, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
if (frame) {
#ifdef UNIV_SYNC_DEBUG
@@ -1679,7 +1679,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space2, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
if (frame) {
#ifdef UNIV_SYNC_DEBUG
diff --git a/innobase/mem/mem0mem.c b/innobase/mem/mem0mem.c
index e1b9a762381..c090b25a632 100644
--- a/innobase/mem/mem0mem.c
+++ b/innobase/mem/mem0mem.c
@@ -92,11 +92,11 @@ with mem_free. */
void*
mem_alloc_func_noninline(
/*=====================*/
- /* out, own: free storage, NULL if did not
- succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
return(mem_alloc_func(n, file_name, line));
@@ -108,18 +108,18 @@ Creates a memory heap block where data can be allocated. */
mem_block_t*
mem_heap_create_block(
/*==================*/
- /* out, own: memory heap block, NULL if did not
- succeed */
- mem_heap_t* heap,/* in: memory heap or NULL if first block should
- be created */
- ulint n, /* in: number of bytes needed for user data, or
- if init_block is not NULL, its size in bytes */
- void* init_block, /* in: init block in fast create, type must be
- MEM_HEAP_DYNAMIC */
- ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC, or
- MEM_HEAP_BUFFER possibly ORed to MEM_HEAP_BTR_SEARCH */
- char* file_name,/* in: file name where created */
- ulint line) /* in: line where created */
+ /* out, own: memory heap block,
+ NULL if did not succeed */
+ mem_heap_t* heap, /* in: memory heap or NULL if first block
+ should be created */
+ ulint n, /* in: number of bytes needed for user data, or
+ if init_block is not NULL, its size in bytes */
+ void* init_block, /* in: init block in fast create,
+ type must be MEM_HEAP_DYNAMIC */
+ ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC or
+ MEM_HEAP_BUFFER */
+ const char* file_name,/* in: file name where created */
+ ulint line) /* in: line where created */
{
mem_block_t* block;
ulint len;
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index aad8a911fd5..5f5060c7464 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -70,7 +70,7 @@ struct os_aio_slot_struct{
bytes */
ulint offset_high; /* 32 high bits of file offset */
os_file_t file; /* file where to read or write */
- char* name; /* file name or path */
+ const char* name; /* file name or path */
ibool io_already_done;/* used only in simulated aio:
TRUE if the physical i/o already
made and only the slot message
@@ -369,7 +369,16 @@ os_file_handle_error(
return(FALSE);
}
-#if !defined(__WIN__) && !defined(UNIV_HOTBACKUP)
+#undef USE_FILE_LOCK
+#define USE_FILE_LOCK
+#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__FreeBSD__)
+/* InnoDB Hot Backup does not lock the data files.
+ * On Windows, mandatory locking is used.
+ * On FreeBSD with LinuxThreads, advisory locking does not work properly.
+ */
+# undef USE_FILE_LOCK
+#endif
+#ifdef USE_FILE_LOCK
/********************************************************************
Obtain an exclusive lock on a file. */
static
@@ -378,22 +387,24 @@ os_file_lock(
/*=========*/
/* out: 0 on success */
int fd, /* in: file descriptor */
- const char* name) /* in: file name */
+ const char* name, /* in: file name */
+ uint lock_type) /* in: lock_type */
{
struct flock lk;
- lk.l_type = F_WRLCK;
+ lk.l_type = lock_type;
lk.l_whence = SEEK_SET;
lk.l_start = lk.l_len = 0;
if (fcntl(fd, F_SETLK, &lk) == -1) {
fprintf(stderr,
- "InnoDB: Unable to lock %s", name);
+ "InnoDB: Unable to lock %s with lock %d, error: %d",
+ name, lock_type, errno);
perror (": fcntl");
close(fd);
return(-1);
}
return 0;
}
-#endif /* !defined(__WIN__) && !defined(UNIV_HOTBACKUP) */
+#endif /* USE_FILE_LOCK */
/********************************************************************
Does error handling when a file operation fails. */
@@ -404,7 +415,7 @@ os_file_handle_error_no_exit(
/* out: TRUE if we should retry the
operation */
os_file_t file, /* in: file pointer */
- char* name, /* in: name of a file or NULL */
+ const char* name, /* in: name of a file or NULL */
const char* operation)/* in: operation */
{
ulint err;
@@ -482,13 +493,15 @@ and '..' items at the start of the directory listing. */
os_file_dir_t
os_file_opendir(
/*============*/
- /* out: directory stream, NULL if error */
- char* dirname, /* in: directory name; it must not contain
- a trailing '\' or '/' */
- ibool error_is_fatal) /* in: TRUE if we should treat an error as a
- fatal error; if we try to open symlinks then
- we do not wish a fatal error if it happens
- not to be a directory */
+ /* out: directory stream, NULL if
+ error */
+ const char* dirname, /* in: directory name; it must not
+ contain a trailing '\' or '/' */
+ ibool error_is_fatal) /* in: TRUE if we should treat an
+ error as a fatal error; if we try to
+ open symlinks then we do not wish a
+ fatal error if it happens not to be
+ a directory */
{
os_file_dir_t dir;
#ifdef __WIN__
@@ -574,7 +587,7 @@ os_file_readdir_next_file(
/*======================*/
/* out: 0 if ok, -1 if error, 1 if at the end
of the directory */
- char* dirname,/* in: directory name or path */
+ const char* dirname,/* in: directory name or path */
os_file_dir_t dir, /* in: directory stream */
os_file_stat_t* info) /* in/out: buffer where the info is returned */
{
@@ -693,12 +706,12 @@ fail_if_exists arguments is true. */
ibool
os_file_create_directory(
/*=====================*/
- /* out: TRUE if call succeeds, FALSE on
- error */
- char* pathname, /* in: directory name as null-terminated
- string */
- ibool fail_if_exists) /* in: if TRUE, pre-existing directory is
- treated as an error. */
+ /* out: TRUE if call succeeds,
+ FALSE on error */
+ const char* pathname, /* in: directory name as
+ null-terminated string */
+ ibool fail_if_exists) /* in: if TRUE, pre-existing directory
+ is treated as an error. */
{
#ifdef __WIN__
BOOL rcode;
@@ -735,18 +748,21 @@ A simple function to open or create a file. */
os_file_t
os_file_create_simple(
/*==================*/
- /* out, own: handle to the file, not defined if error,
- error number can be retrieved with
- os_file_get_last_error */
- char* name, /* in: name of the file or path as a null-terminated
- string */
- ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
- (if does not exist, error), or OS_FILE_CREATE if a new
- file is created (if exists, error), or
- OS_FILE_CREATE_PATH if new file (if exists, error) and
- subdirectories along its path are created (if needed)*/
- ulint access_type,/* in: OS_FILE_READ_ONLY or OS_FILE_READ_WRITE */
- ibool* success)/* out: TRUE if succeed, FALSE if error */
+ /* out, own: handle to the file, not defined
+ if error, error number can be retrieved with
+ os_file_get_last_error */
+ const char* name, /* in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/* in: OS_FILE_OPEN if an existing file is
+ opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error), or
+ OS_FILE_CREATE_PATH if new file
+ (if exists, error) and subdirectories along
+ its path are created (if needed)*/
+ ulint access_type,/* in: OS_FILE_READ_ONLY or
+ OS_FILE_READ_WRITE */
+ ibool* success)/* out: TRUE if succeed, FALSE if error */
{
#ifdef __WIN__
os_file_t file;
@@ -852,8 +868,8 @@ try_again:
if (retry) {
goto try_again;
}
-#ifndef UNIV_HOTBACKUP
- } else if (os_file_lock(file, name)) {
+#ifdef USE_FILE_LOCK
+ } else if (os_file_lock(file, name, F_WRLCK)) {
*success = FALSE;
file = -1;
#endif
@@ -871,18 +887,20 @@ A simple function to open or create a file. */
os_file_t
os_file_create_simple_no_error_handling(
/*====================================*/
- /* out, own: handle to the file, not defined if error,
- error number can be retrieved with
- os_file_get_last_error */
- char* name, /* in: name of the file or path as a null-terminated
- string */
- ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
- (if does not exist, error), or OS_FILE_CREATE if a new
- file is created (if exists, error) */
- ulint access_type,/* in: OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or
- OS_FILE_READ_ALLOW_DELETE; the last option is used by
- a backup program reading the file */
- ibool* success)/* out: TRUE if succeed, FALSE if error */
+ /* out, own: handle to the file, not defined
+ if error, error number can be retrieved with
+ os_file_get_last_error */
+ const char* name, /* in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/* in: OS_FILE_OPEN if an existing file
+ is opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error) */
+ ulint access_type,/* in: OS_FILE_READ_ONLY,
+ OS_FILE_READ_WRITE, or
+ OS_FILE_READ_ALLOW_DELETE; the last option is
+ used by a backup program reading the file */
+ ibool* success)/* out: TRUE if succeed, FALSE if error */
{
#ifdef __WIN__
os_file_t file;
@@ -961,8 +979,8 @@ os_file_create_simple_no_error_handling(
if (file == -1) {
*success = FALSE;
-#ifndef UNIV_HOTBACKUP
- } else if (os_file_lock(file, name)) {
+#ifdef USE_FILE_LOCK
+ } else if (os_file_lock(file, name, F_WRLCK)) {
*success = FALSE;
file = -1;
#endif
@@ -980,25 +998,28 @@ Opens an existing file or creates a new. */
os_file_t
os_file_create(
/*===========*/
- /* out, own: handle to the file, not defined if error,
- error number can be retrieved with
- os_file_get_last_error */
- char* name, /* in: name of the file or path as a null-terminated
- string */
- ulint create_mode, /* in: OS_FILE_OPEN if an existing file is opened
- (if does not exist, error), or OS_FILE_CREATE if a new
- file is created (if exists, error), OS_FILE_OVERWRITE
- if a new is created or an old overwritten,
- OS_FILE_OPEN_RAW, if a raw device or disk partition
- should be opened */
- ulint purpose,/* in: OS_FILE_AIO, if asynchronous, non-buffered i/o
- is desired, OS_FILE_NORMAL, if any normal file;
- NOTE that it also depends on type, os_aio_.. and srv_..
- variables whether we really use async i/o or
- unbuffered i/o: look in the function source code for
- the exact rules */
- ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */
- ibool* success)/* out: TRUE if succeed, FALSE if error */
+ /* out, own: handle to the file, not defined
+ if error, error number can be retrieved with
+ os_file_get_last_error */
+ const char* name, /* in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/* in: OS_FILE_OPEN if an existing file
+ is opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error),
+ OS_FILE_OVERWRITE if a new file is created
+ or an old overwritten;
+ OS_FILE_OPEN_RAW, if a raw device or disk
+ partition should be opened */
+ ulint purpose,/* in: OS_FILE_AIO, if asynchronous,
+ non-buffered i/o is desired,
+ OS_FILE_NORMAL, if any normal file;
+ NOTE that it also depends on type, os_aio_..
+ and srv_.. variables whether we really use
+ async i/o or unbuffered i/o: look in the
+ function source code for the exact rules */
+ ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */
+ ibool* success)/* out: TRUE if succeed, FALSE if error */
{
#ifdef __WIN__
os_file_t file;
@@ -1172,8 +1193,8 @@ try_again:
if (retry) {
goto try_again;
}
-#ifndef UNIV_HOTBACKUP
- } else if (os_file_lock(file, name)) {
+#ifdef USE_FILE_LOCK
+ } else if (os_file_lock(file, name, F_WRLCK)) {
*success = FALSE;
file = -1;
#endif
@@ -1191,8 +1212,8 @@ Deletes a file if it exists. The file has to be closed before calling this. */
ibool
os_file_delete_if_exists(
/*=====================*/
- /* out: TRUE if success */
- char* name) /* in: file path as a null-terminated string */
+ /* out: TRUE if success */
+ const char* name) /* in: file path as a null-terminated string */
{
#ifdef __WIN__
BOOL ret;
@@ -1252,8 +1273,8 @@ Deletes a file. The file has to be closed before calling this. */
ibool
os_file_delete(
/*===========*/
- /* out: TRUE if success */
- char* name) /* in: file path as a null-terminated string */
+ /* out: TRUE if success */
+ const char* name) /* in: file path as a null-terminated string */
{
#ifdef __WIN__
BOOL ret;
@@ -1316,9 +1337,9 @@ ibool
os_file_rename(
/*===========*/
/* out: TRUE if success */
- char* oldpath, /* in: old file path as a null-terminated
+ const char* oldpath,/* in: old file path as a null-terminated
string */
- char* newpath) /* in: new file path */
+ const char* newpath)/* in: new file path */
{
#ifdef __WIN__
BOOL ret;
@@ -1329,7 +1350,7 @@ os_file_rename(
return(TRUE);
}
- os_file_handle_error(NULL, oldpath, "delete");
+ os_file_handle_error(NULL, oldpath, "rename");
return(FALSE);
#else
@@ -1374,6 +1395,9 @@ os_file_close(
#else
int ret;
+#ifdef USE_FILE_LOCK
+ (void) os_file_lock(file, "unknown", F_UNLCK);
+#endif
ret = close(file);
if (ret == -1) {
@@ -1410,6 +1434,9 @@ os_file_close_no_error_handling(
#else
int ret;
+#ifdef USE_FILE_LOCK
+ (void) os_file_lock(file, "unknown", F_UNLCK);
+#endif
ret = close(file);
if (ret == -1) {
@@ -1499,7 +1526,7 @@ ibool
os_file_set_size(
/*=============*/
/* out: TRUE if success */
- char* name, /* in: name of the file or path as a
+ const char* name, /* in: name of the file or path as a
null-terminated string */
os_file_t file, /* in: handle to a file */
ulint size, /* in: least significant 32 bits of file
@@ -1760,7 +1787,7 @@ os_file_pwrite(
/*===========*/
/* out: number of bytes written, -1 if error */
os_file_t file, /* in: handle to a file */
- void* buf, /* in: buffer from where to write */
+ const void* buf, /* in: buffer from where to write */
ulint n, /* in: number of bytes to write */
ulint offset, /* in: least significant 32 bits of file
offset where to write */
@@ -2040,10 +2067,10 @@ os_file_write(
/*==========*/
/* out: TRUE if request was
successful, FALSE if fail */
- char* name, /* in: name of the file or path as a
+ const char* name, /* in: name of the file or path as a
null-terminated string */
os_file_t file, /* in: handle to a file */
- void* buf, /* in: buffer from which to write */
+ const void* buf, /* in: buffer from which to write */
ulint offset, /* in: least significant 32 bits of file
offset where to write */
ulint offset_high, /* in: most significant 32 bits of
@@ -2197,7 +2224,7 @@ ibool
os_file_status(
/*===========*/
/* out: TRUE if call succeeded */
- char* path, /* in: pathname of the file */
+ const char* path, /* in: pathname of the file */
ibool* exists, /* out: TRUE if file exists */
os_file_type_t* type) /* out: type of the file (if it exists) */
{
@@ -2302,7 +2329,7 @@ os_file_dirname(
/*============*/
/* out, own: directory component of the
pathname */
- char* path) /* in: pathname */
+ const char* path) /* in: pathname */
{
char* dir;
int i, length, last_slash;
@@ -2339,7 +2366,7 @@ os_file_create_subdirs_if_needed(
/*=============================*/
/* out: TRUE if call succeeded
FALSE otherwise */
- char* path) /* in: path name */
+ const char* path) /* in: path name */
{
char* subdir;
static char rootdir[2] = { OS_FILE_PATH_SEPARATOR, 0 };
@@ -2736,7 +2763,7 @@ os_aio_array_reserve_slot(
void* message2,/* in: message to be passed along with
the aio operation */
os_file_t file, /* in: file handle */
- char* name, /* in: name of the file or path as a
+ const char* name, /* in: name of the file or path as a
null-terminated string */
void* buf, /* in: buffer where to read or from which
to write */
@@ -2983,7 +3010,7 @@ os_aio(
because i/os are not actually handled until
all have been posted: use with great
caution! */
- char* name, /* in: name of the file or path as a
+ const char* name, /* in: name of the file or path as a
null-terminated string */
os_file_t file, /* in: handle to a file */
void* buf, /* in: buffer where to read or from which
@@ -3526,6 +3553,7 @@ consecutive_loop:
if (n_consecutive == 1) {
/* We can use the buffer of the i/o request */
combined_buf = slot->buf;
+ combined_buf2 = NULL;
} else {
combined_buf2 = ut_malloc(total_len + UNIV_PAGE_SIZE);
@@ -3621,7 +3649,7 @@ consecutive_loop:
}
}
- if (n_consecutive > 1) {
+ if (combined_buf2) {
ut_free(combined_buf2);
}
diff --git a/innobase/os/os0sync.c b/innobase/os/os0sync.c
index 7cbaf1f5123..c48c44a4c70 100644
--- a/innobase/os/os0sync.c
+++ b/innobase/os/os0sync.c
@@ -109,9 +109,9 @@ must be reset explicitly by calling sync_os_reset_event. */
os_event_t
os_event_create(
/*============*/
- /* out: the event handle */
- char* name) /* in: the name of the event, if NULL
- the event is created without a name */
+ /* out: the event handle */
+ const char* name) /* in: the name of the event, if NULL
+ the event is created without a name */
{
#ifdef __WIN__
os_event_t event;
@@ -166,9 +166,9 @@ reset when a single thread is released. Works only in Windows. */
os_event_t
os_event_create_auto(
/*=================*/
- /* out: the event handle */
- char* name) /* in: the name of the event, if NULL
- the event is created without a name */
+ /* out: the event handle */
+ const char* name) /* in: the name of the event, if NULL
+ the event is created without a name */
{
os_event_t event;
@@ -430,9 +430,9 @@ mutex semaphore of InnoDB itself (mutex_t) should be used where possible. */
os_mutex_t
os_mutex_create(
/*============*/
- /* out: the mutex handle */
- char* name) /* in: the name of the mutex, if NULL
- the mutex is created without a name */
+ /* out: the mutex handle */
+ const char* name) /* in: the name of the mutex, if NULL
+ the mutex is created without a name */
{
#ifdef __WIN__
HANDLE mutex;
diff --git a/innobase/pars/pars0pars.c b/innobase/pars/pars0pars.c
index a4124672df0..12451b4d94d 100644
--- a/innobase/pars/pars0pars.c
+++ b/innobase/pars/pars0pars.c
@@ -1713,7 +1713,8 @@ Called by yyparse on error. */
void
yyerror(
/*====*/
- char* s __attribute__((unused))) /* in: error message string */
+ const char* s __attribute__((unused)))
+ /* in: error message string */
{
ut_ad(s);
@@ -1728,8 +1729,8 @@ Parses an SQL string returning the query graph. */
que_t*
pars_sql(
/*=====*/
- /* out, own: the query graph */
- char* str) /* in: SQL string */
+ /* out, own: the query graph */
+ const char* str) /* in: SQL string */
{
sym_node_t* sym_node;
mem_heap_t* heap;
diff --git a/innobase/pars/pars0sym.c b/innobase/pars/pars0sym.c
index 1a0608ed142..194e6677183 100644
--- a/innobase/pars/pars0sym.c
+++ b/innobase/pars/pars0sym.c
@@ -217,13 +217,10 @@ sym_tab_add_id(
node->common.type = QUE_NODE_SYMBOL;
- node->name = mem_heap_alloc(sym_tab->heap, len + 1);
node->resolved = FALSE;
node->indirection = NULL;
- ut_memcpy(node->name, name, len);
- node->name[len] = '\0';
-
+ node->name = mem_heap_strdupl(sym_tab->heap, name, len + 1);
node->name_len = len;
UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node);
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index a3f883b49c6..062f21369a7 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -803,8 +803,7 @@ row_ins_foreign_check_on_constraint(
"InnoDB: clustered record ", stderr);
rec_print(stderr, clust_rec);
fputs("\n"
- "InnoDB: Make a detailed bug report and send it\n"
- "InnoDB: to mysql@lists.mysql.com\n", stderr);
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
err = DB_SUCCESS;
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 5432add37f7..61be3a7248e 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -714,7 +714,7 @@ run_again:
trx_start_if_not_started(trx);
- err = lock_table(0, prebuilt->table, prebuilt->select_lock_type, thr);
+ err = lock_table(0, prebuilt->table, LOCK_AUTO_INC, thr);
trx->error_state = err;
@@ -1686,15 +1686,16 @@ constraints which reference this table are ok. */
int
row_table_add_foreign_constraints(
/*==============================*/
- /* out: error code or DB_SUCCESS */
- trx_t* trx, /* in: transaction */
- char* sql_string, /* in: table create statement where
- foreign keys are declared like:
+ /* out: error code or DB_SUCCESS */
+ trx_t* trx, /* in: transaction */
+ const char* sql_string, /* in: table create statement where
+ foreign keys are declared like:
FOREIGN KEY (a, b) REFERENCES table2(c, d),
- table2 can be written also with the database
- name before it: test.table2 */
- char* name) /* in: table full name in the normalized form
- database_name/table_name */
+ table2 can be written also with the
+ database name before it: test.table2 */
+ const char* name) /* in: table full name in the
+ normalized form
+ database_name/table_name */
{
ulint err;
@@ -1940,9 +1941,9 @@ discard ongoing operations. */
int
row_discard_tablespace_for_mysql(
/*=============================*/
- /* out: error code or DB_SUCCESS */
- char* name, /* in: table name */
- trx_t* trx) /* in: transaction handle */
+ /* out: error code or DB_SUCCESS */
+ const char* name, /* in: table name */
+ trx_t* trx) /* in: transaction handle */
{
dulint new_id;
dict_table_t* table;
@@ -2071,9 +2072,9 @@ of the table in the data dictionary. */
int
row_import_tablespace_for_mysql(
/*============================*/
- /* out: error code or DB_SUCCESS */
- char* name, /* in: table name */
- trx_t* trx) /* in: transaction handle */
+ /* out: error code or DB_SUCCESS */
+ const char* name, /* in: table name */
+ trx_t* trx) /* in: transaction handle */
{
dict_table_t* table;
ibool success;
@@ -2177,10 +2178,10 @@ the corresponding monitor output by the master thread. */
int
row_drop_table_for_mysql(
/*=====================*/
- /* out: error code or DB_SUCCESS */
- char* name, /* in: table name */
- trx_t* trx, /* in: transaction handle */
- ibool drop_db)/* in: TRUE=dropping whole database */
+ /* out: error code or DB_SUCCESS */
+ const char* name, /* in: table name */
+ trx_t* trx, /* in: transaction handle */
+ ibool drop_db)/* in: TRUE=dropping whole database */
{
dict_foreign_t* foreign;
dict_table_t* table;
@@ -2519,17 +2520,18 @@ Drops a database for MySQL. */
int
row_drop_database_for_mysql(
/*========================*/
- /* out: error code or DB_SUCCESS */
- char* name, /* in: database name which ends to '/' */
- trx_t* trx) /* in: transaction handle */
+ /* out: error code or DB_SUCCESS */
+ const char* name, /* in: database name which ends to '/' */
+ trx_t* trx) /* in: transaction handle */
{
dict_table_t* table;
char* table_name;
int err = DB_SUCCESS;
+ ulint namelen = strlen(name);
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_a(name != NULL);
- ut_a(name[strlen(name) - 1] == '/');
+ ut_a(name[namelen - 1] == '/');
trx->op_info = (char *) "dropping database";
@@ -2538,7 +2540,7 @@ loop:
row_mysql_lock_data_dictionary(trx);
while ((table_name = dict_get_first_table_name_in_db(name))) {
- ut_a(strcmp(table_name, name) == 0);
+ ut_a(memcmp(table_name, name, namelen) == 0);
table = dict_table_get_low(table_name);
@@ -2610,10 +2612,10 @@ Renames a table for MySQL. */
int
row_rename_table_for_mysql(
/*=======================*/
- /* out: error code or DB_SUCCESS */
- char* old_name, /* in: old table name */
- char* new_name, /* in: new table name */
- trx_t* trx) /* in: transaction handle */
+ /* out: error code or DB_SUCCESS */
+ const char* old_name, /* in: old table name */
+ const char* new_name, /* in: new table name */
+ trx_t* trx) /* in: transaction handle */
{
dict_table_t* table;
que_thr_t* thr;
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index 4c43f75125c..ff9b697c02f 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -2410,8 +2410,7 @@ row_sel_get_clust_rec_for_mysql(
trx_print(stderr, thr_get_trx(thr));
fputs("\n"
- "InnoDB: Make a detailed bug report and send it\n"
- "InnoDB: to mysql@lists.mysql.com\n", stderr);
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
}
clust_rec = NULL;
@@ -3586,11 +3585,11 @@ consistent read result, or store it to the query cache. */
ibool
row_search_check_if_query_cache_permitted(
/*======================================*/
- /* out: TRUE if storing or retrieving from
- the query cache is permitted */
- trx_t* trx, /* in: transaction object */
- char* norm_name) /* in: concatenation of database name, '/'
- char, table name */
+ /* out: TRUE if storing or retrieving
+ from the query cache is permitted */
+ trx_t* trx, /* in: transaction object */
+ const char* norm_name) /* in: concatenation of database name,
+ '/' char, table name */
{
dict_table_t* table;
ibool ret = FALSE;
diff --git a/innobase/row/row0umod.c b/innobase/row/row0umod.c
index 3c181ed5493..d47227166f3 100644
--- a/innobase/row/row0umod.c
+++ b/innobase/row/row0umod.c
@@ -441,8 +441,7 @@ row_undo_mod_del_unmark_sec_and_undo_update(
putc('\n', stderr);
trx_print(stderr, thr_get_trx(thr));
fputs("\n"
- "InnoDB: Make a detailed bug report and send it\n"
- "InnoDB: to mysql@lists.mysql.com\n", stderr);
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
} else {
btr_cur_t* btr_cur = btr_pcur_get_btr_cur(&pcur);
diff --git a/innobase/row/row0upd.c b/innobase/row/row0upd.c
index 82eb112fc77..724e7bf91e7 100644
--- a/innobase/row/row0upd.c
+++ b/innobase/row/row0upd.c
@@ -1236,8 +1236,7 @@ row_upd_sec_index_entry(
trx_print(stderr, thr_get_trx(thr));
fputs("\n"
- "InnoDB: Make a detailed bug report and send it\n"
- "InnoDB: to mysql@lists.mysql.com\n", stderr);
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
} else {
/* Delete mark the old index record; it can already be
delete marked if we return after a lock wait in
diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c
index 426d7ff9f92..02a9771be35 100644
--- a/innobase/sync/sync0arr.c
+++ b/innobase/sync/sync0arr.c
@@ -53,7 +53,7 @@ struct sync_cell_struct {
rw_lock_t* old_wait_rw_lock;/* the latest wait rw-lock in cell */
ulint request_type; /* lock type requested on the
object */
- char* file; /* in debug version file where
+ const char* file; /* in debug version file where
requested */
ulint line; /* in debug version line where
requested */
@@ -329,7 +329,7 @@ sync_array_reserve_cell(
sync_array_t* arr, /* in: wait array */
void* object, /* in: pointer to the object to wait for */
ulint type, /* in: lock request type */
- char* file, /* in: file where requested */
+ const char* file, /* in: file where requested */
ulint line, /* in: line where requested */
ulint* index) /* out: index of the reserved cell */
{
diff --git a/innobase/sync/sync0rw.c b/innobase/sync/sync0rw.c
index 43f8d646eaa..769eb326ce2 100644
--- a/innobase/sync/sync0rw.c
+++ b/innobase/sync/sync0rw.c
@@ -89,7 +89,7 @@ void
rw_lock_create_func(
/*================*/
rw_lock_t* lock, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline) /* in: file line where created */
{
/* If this is the very first time a synchronization
@@ -213,7 +213,7 @@ rw_lock_s_lock_spin(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock
will be passed to another thread to unlock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name, /* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ulint index; /* index of the reserved wait cell */
@@ -324,7 +324,7 @@ rw_lock_x_lock_low(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
#ifdef UNIV_SYNC_DEBUG
@@ -429,7 +429,7 @@ rw_lock_x_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ulint index; /* index of the reserved wait cell */
@@ -551,7 +551,7 @@ rw_lock_debug_mutex_enter(void)
{
loop:
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
- IB__FILE__, __LINE__)) {
+ __FILE__, __LINE__)) {
return;
}
@@ -560,7 +560,7 @@ loop:
rw_lock_debug_waiters = TRUE;
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
- IB__FILE__, __LINE__)) {
+ __FILE__, __LINE__)) {
return;
}
diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c
index c1fb31bc966..31f287b6341 100644
--- a/innobase/sync/sync0sync.c
+++ b/innobase/sync/sync0sync.c
@@ -201,7 +201,7 @@ void
mutex_create_func(
/*==============*/
mutex_t* mutex, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline) /* in: file line where created */
{
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
@@ -294,10 +294,10 @@ mutex_enter_nowait(
/*===============*/
/* out: 0 if succeed, 1 if not */
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name __attribute__((unused)),
+ const char* file_name __attribute__((unused)),
/* in: file name where mutex
requested */
- ulint line __attribute__((unused)))
+ ulint line __attribute__((unused)))
/* in: line where requested */
{
ut_ad(mutex_validate(mutex));
@@ -357,9 +357,10 @@ for the mutex before suspending the thread. */
void
mutex_spin_wait(
/*============*/
- mutex_t* mutex, /* in: pointer to mutex */
- char* file_name, /* in: file name where mutex requested */
- ulint line) /* in: line where requested */
+ mutex_t* mutex, /* in: pointer to mutex */
+ const char* file_name, /* in: file name where
+ mutex requested */
+ ulint line) /* in: line where requested */
{
ulint index; /* index of the reserved wait cell */
ulint i; /* spin round count */
diff --git a/innobase/trx/trx0rec.c b/innobase/trx/trx0rec.c
index 7963bec7f33..382f723a05c 100644
--- a/innobase/trx/trx0rec.c
+++ b/innobase/trx/trx0rec.c
@@ -823,17 +823,16 @@ trx_undo_update_rec_get_update(
if (field_no >= dict_index_get_n_fields(index)) {
fprintf(stderr,
- "InnoDB: Error: trying to access"
- " update undo rec field %lu in ", (ulong) field_no);
+"InnoDB: Error: trying to access update undo rec field %lu in ", (ulong) field_no);
dict_index_name_print(stderr, index);
fprintf(stderr, "\n"
- "InnoDB: but index has only %lu fields\n"
- "InnoDB: Send a detailed bug report to mysql@lists.mysql.com\n"
- "InnoDB: Run also CHECK TABLE ",
+"InnoDB: but index has only %lu fields\n"
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
+"InnoDB: Run also CHECK TABLE ",
(ulong) dict_index_get_n_fields(index));
ut_print_name(stderr, index->table_name);
fprintf(stderr, "\n"
- "InnoDB: n_fields = %lu, i = %lu, ptr %p\n",
+"InnoDB: n_fields = %lu, i = %lu, ptr %p\n",
(ulong) n_fields, (ulong) i, ptr);
return(NULL);
}
@@ -1067,7 +1066,7 @@ trx_undo_report_row_operation(
undo_page = buf_page_get_gen(undo->space, page_no,
RW_X_LATCH, undo->guess_page,
BUF_GET,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
#ifdef UNIV_SYNC_DEBUG
@@ -1271,8 +1270,7 @@ trx_undo_prev_version_build(
" update undo rec for non-clustered ", stderr);
dict_index_name_print(stderr, index);
fputs("\n"
- "InnoDB: Send a detailed bug report to"
- " mysql@lists.mysql.com\n"
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
"InnoDB: index record ", stderr);
rec_print(stderr, index_rec);
fputs("\n"
@@ -1320,11 +1318,9 @@ trx_undo_prev_version_build(
" update undo rec for table ", stderr);
ut_print_name(stderr, index->table_name);
fputs("\n"
- "InnoDB: but the table id in the"
- " undo record is wrong\n"
- "InnoDB: Send a detailed bug report to "
- "mysql@lists.mysql.com\n"
- "InnoDB: Run also CHECK TABLE ", stderr);
+"InnoDB: but the table id in the undo record is wrong\n"
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
+"InnoDB: Run also CHECK TABLE ", stderr);
ut_print_name(stderr, index->table_name);
putc('\n', stderr);
}
diff --git a/innobase/trx/trx0roll.c b/innobase/trx/trx0roll.c
index 5c01a5371aa..e2e4f24b82e 100644
--- a/innobase/trx/trx0roll.c
+++ b/innobase/trx/trx0roll.c
@@ -200,7 +200,7 @@ trx_rollback_to_savepoint_for_mysql(
DB_NO_SAVEPOINT,
otherwise DB_SUCCESS */
trx_t* trx, /* in: transaction handle */
- char* savepoint_name, /* in: savepoint name */
+ const char* savepoint_name, /* in: savepoint name */
ib_longlong* mysql_binlog_cache_pos) /* out: the MySQL binlog cache
position corresponding to this
savepoint; MySQL needs this
@@ -265,7 +265,7 @@ trx_savepoint_for_mysql(
/*====================*/
/* out: always DB_SUCCESS */
trx_t* trx, /* in: transaction handle */
- char* savepoint_name, /* in: savepoint name */
+ const char* savepoint_name, /* in: savepoint name */
ib_longlong binlog_cache_pos) /* in: MySQL binlog cache
position corresponding to this
connection at the time of the
diff --git a/innobase/trx/trx0sys.c b/innobase/trx/trx0sys.c
index ef068d8d523..87abcbefa52 100644
--- a/innobase/trx/trx0sys.c
+++ b/innobase/trx/trx0sys.c
@@ -569,7 +569,7 @@ replication has proceeded. */
void
trx_sys_update_mysql_binlog_offset(
/*===============================*/
- char* file_name,/* in: MySQL log file name */
+ const char* file_name,/* in: MySQL log file name */
ib_longlong offset, /* in: position in that log file */
ulint field, /* in: offset of the MySQL log info field in
the trx sys header */
diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c
index fc0a67278d2..8128c8de13e 100644
--- a/innobase/trx/trx0trx.c
+++ b/innobase/trx/trx0trx.c
@@ -1564,7 +1564,9 @@ trx_mark_sql_stat_end(
/**************************************************************************
Prints info about a transaction to the standard output. The caller must
-own the kernel mutex. */
+own the kernel mutex and must have called
+innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL or
+InnoDB cannot meanwhile change the info printed here. */
void
trx_print(
diff --git a/innobase/ut/ut0dbg.c b/innobase/ut/ut0dbg.c
index 3697e31050f..65703ec1c86 100644
--- a/innobase/ut/ut0dbg.c
+++ b/innobase/ut/ut0dbg.c
@@ -23,7 +23,7 @@ const char* ut_dbg_msg_assert_fail =
"InnoDB: Assertion failure in thread %lu in file %s line %lu\n";
const char* ut_dbg_msg_trap =
"InnoDB: We intentionally generate a memory trap.\n"
-"InnoDB: Send a detailed bug report to mysql@lists.mysql.com.\n"
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com.\n"
"InnoDB: If you get repeated assertion failures or crashes, even\n"
"InnoDB: immediately after the mysqld startup, there may be\n"
"InnoDB: corruption in the InnoDB tablespace. See section 6.1 of\n"
diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c
index f21bb752fac..47b612d757e 100644
--- a/innobase/ut/ut0mem.c
+++ b/innobase/ut/ut0mem.c
@@ -273,29 +273,3 @@ ut_memcpyq(
return(dest);
}
-
-/**************************************************************************
-Catenates two strings into newly allocated memory. The memory must be freed
-using mem_free. */
-
-char*
-ut_str_catenate(
-/*============*/
- /* out, own: catenated null-terminated string */
- char* str1, /* in: null-terminated string */
- char* str2) /* in: null-terminated string */
-{
- ulint len1;
- ulint len2;
- char* str;
-
- len1 = ut_strlen(str1);
- len2 = ut_strlen(str2);
-
- str = mem_alloc(len1 + len2 + 1);
-
- ut_memcpy(str, str1, len1);
- ut_memcpy(str + len1, str2, len2 + 1);
-
- return(str);
-}
diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c
index 21677e98318..cce98cf5644 100644
--- a/innobase/ut/ut0ut.c
+++ b/innobase/ut/ut0ut.c
@@ -37,79 +37,6 @@ and both the Microsoft and Intel C compilers require the format string
%I64 in that case instead of %l. */
int
-ut_printf(
-/*======*/
- /* out: the number of characters written, or
- negative in case of an error */
- const char* format, /* in: format of prints */
- ...) /* in: arguments to be printed */
-{
- va_list args;
- ulint len;
- char* format_end;
- char* newformat;
- char* ptr;
- char* newptr;
- int ret;
- char format_buf_in_stack[500];
-
- len = strlen(format);
-
- if (len > 250) {
- newformat = malloc(2 * len);
- } else {
- newformat = format_buf_in_stack;
- }
-
- format_end = (char*)format + len;
-
- ptr = (char*)format;
- newptr = newformat;
-
-#if defined(__WIN__) && (defined(WIN64) || defined(_WIN64))
- /* Replace %l with %I64 if it is not preceded with '\' */
-
- while (ptr < format_end) {
- if (*ptr == '%' && *(ptr + 1) == 'l'
- && (ptr == format || *(ptr - 1) != '\\')) {
-
- memcpy(newptr, "%I64", 4);
- ptr += 2;
- newptr += 4;
- } else {
- *newptr = *ptr;
- ptr++;
- newptr++;
- }
- }
-
- *newptr = '\0';
-
- ut_a(newptr < newformat + 2 * len);
-#else
- strcpy(newformat, format);
-#endif
- va_start(args, format);
-
- ret = vprintf((const char*)newformat, args);
-
- va_end(args);
-
- if (newformat != format_buf_in_stack) {
- free(newformat);
- }
-
- return(ret);
-}
-
-/************************************************************
-On the 64-bit Windows we substitute the format string
-%l -> %I64
-because we define ulint as unsigned __int64 and lint as __int64 on Windows,
-and both the Microsoft and Intel C compilers require the format string
-%I64 in that case instead of %l. */
-
-int
ut_sprintf(
/*=======*/
/* out: the number of characters written, or
diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am
index b11db65baf6..b3db54d305a 100644
--- a/libmysqld/examples/Makefile.am
+++ b/libmysqld/examples/Makefile.am
@@ -26,6 +26,7 @@ mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \
my_readline.h sql_string.h completion_hash.h
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD)
+client_test_LINK = $(CXXLINK)
client_test_SOURCES = client_test.c
clean:
diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c
index 30a4762abe0..f64e774810d 100644
--- a/myisam/mi_dynrec.c
+++ b/myisam/mi_dynrec.c
@@ -311,7 +311,7 @@ static int update_backward_delete_link(MI_INFO *info, my_off_t delete_block,
DBUG_RETURN(1); /* Wrong delete link */
}
}
- return 0;
+ DBUG_RETURN(0);
}
/* Delete datarecord from database */
diff --git a/myisam/mi_range.c b/myisam/mi_range.c
index caa57ce6187..db01ada16dd 100644
--- a/myisam/mi_range.c
+++ b/myisam/mi_range.c
@@ -30,15 +30,27 @@ static uint _mi_keynr(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *page,
uchar *keypos,uint *ret_max_key);
- /* If start_key = 0 assume read from start */
- /* If end_key = 0 assume read to end */
- /* Returns HA_POS_ERROR on error */
-
-ha_rows mi_records_in_range(MI_INFO *info, int inx, const byte *start_key,
- uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key, uint end_key_len,
- enum ha_rkey_function end_search_flag)
+/*
+ Estimate how many records there is in a given range
+
+ SYNOPSIS
+ mi_records_in_range()
+ info MyISAM handler
+ inx Index to use
+ min_key Min key. Is = 0 if no min range
+ max_key Max key. Is = 0 if no max range
+
+ NOTES
+ We should ONLY return 0 if there is no rows in range
+
+ RETURN
+ HA_POS_ERROR error (or we can't estimate number of rows)
+ number Estimated number of rows
+*/
+
+
+ha_rows mi_records_in_range(MI_INFO *info, int inx, key_range *min_key,
+ key_range *max_key)
{
ha_rows start_pos,end_pos,res;
DBUG_ENTER("mi_records_in_range");
@@ -54,27 +66,31 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, const byte *start_key,
switch(info->s->keyinfo[inx].key_alg){
case HA_KEY_ALG_RTREE:
- {
- uchar * key_buff;
- if (start_key_len == 0)
- start_key_len=USE_WHOLE_KEY;
- key_buff=info->lastkey+info->s->base.max_key_length;
- start_key_len= _mi_pack_key(info,inx,key_buff,(uchar*) start_key,
- start_key_len, (HA_KEYSEG**) 0);
- res=rtree_estimate(info, inx, key_buff, start_key_len, myisam_read_vec[start_search_flag]);
- res=res?res:1;
- break;
- }
+ {
+ uchar * key_buff;
+ uint start_key_len;
+
+ key_buff= info->lastkey+info->s->base.max_key_length;
+ start_key_len= _mi_pack_key(info,inx, key_buff,
+ (uchar*) min_key->key, min_key->length,
+ (HA_KEYSEG**) 0);
+ res= rtree_estimate(info, inx, key_buff, start_key_len,
+ myisam_read_vec[min_key->flag]);
+ res= res ? res : 1; /* Don't return 0 */
+ break;
+ }
case HA_KEY_ALG_BTREE:
default:
- start_pos= (start_key ?
- _mi_record_pos(info,start_key,start_key_len,start_search_flag) :
- (ha_rows) 0);
- end_pos= (end_key ?
- _mi_record_pos(info,end_key,end_key_len,end_search_flag) :
- info->state->records+ (ha_rows) 1);
- res=end_pos < start_pos ? (ha_rows) 0 :
- (end_pos == start_pos ? (ha_rows) 1 : end_pos-start_pos);
+ start_pos= (min_key ?
+ _mi_record_pos(info, min_key->key, min_key->length,
+ min_key->flag) :
+ (ha_rows) 0);
+ end_pos= (max_key ?
+ _mi_record_pos(info, max_key->key, max_key->length,
+ max_key->flag) :
+ info->state->records+ (ha_rows) 1);
+ res= (end_pos < start_pos ? (ha_rows) 0 :
+ (end_pos == start_pos ? (ha_rows) 1 : end_pos-start_pos));
if (start_pos == HA_POS_ERROR || end_pos == HA_POS_ERROR)
res=HA_POS_ERROR;
}
diff --git a/myisam/mi_test2.c b/myisam/mi_test2.c
index d3c3cc2c492..56d8357536a 100644
--- a/myisam/mi_test2.c
+++ b/myisam/mi_test2.c
@@ -606,13 +606,20 @@ int main(int argc, char *argv[])
mi_status(file,&info,HA_STATUS_VARIABLE);
for (i=0 ; i < info.keys ; i++)
{
+ key_range min_key, max_key;
if (mi_rfirst(file,read_record,(int) i) ||
mi_rlast(file,read_record2,(int) i))
goto err;
copy_key(file,(uint) i,(uchar*) read_record,(uchar*) key);
copy_key(file,(uint) i,(uchar*) read_record2,(uchar*) key2);
- range_records=mi_records_in_range(file,(int) i,key,0,HA_READ_KEY_EXACT,
- key2,0,HA_READ_AFTER_KEY);
+ min_key.key= key;
+ min_key.length= USE_WHOLE_KEY;
+ min_key.flag= HA_READ_KEY_EXACT;
+ max_key.key= key2;
+ max_key.length= USE_WHOLE_KEY;
+ max_key.flag= HA_READ_AFTER_KEY;
+
+ range_records= mi_records_in_range(file,(int) i, &min_key, &max_key);
if (range_records < info.records*8/10 ||
range_records > info.records*12/10)
{
@@ -634,12 +641,19 @@ int main(int argc, char *argv[])
for (k=rnd(1000)+1 ; k>0 && key1[k] == 0 ; k--) ;
if (j != 0 && k != 0)
{
+ key_range min_key, max_key;
if (j > k)
swap(int,j,k);
sprintf(key,"%6d",j);
sprintf(key2,"%6d",k);
- range_records=mi_records_in_range(file,0,key,0,HA_READ_AFTER_KEY,
- key2,0,HA_READ_BEFORE_KEY);
+
+ min_key.key= key;
+ min_key.length= USE_WHOLE_KEY;
+ min_key.flag= HA_READ_AFTER_KEY;
+ max_key.key= key2;
+ max_key.length= USE_WHOLE_KEY;
+ max_key.flag= HA_READ_BEFORE_KEY;
+ range_records= mi_records_in_range(file, 0, &min_key, &max_key);
records=0;
for (j++ ; j < k ; j++)
records+=key1[j];
diff --git a/myisam/rt_test.c b/myisam/rt_test.c
index bbeb8fce2d1..c1126c1939a 100644
--- a/myisam/rt_test.c
+++ b/myisam/rt_test.c
@@ -39,7 +39,6 @@ int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
}
-
int run_test(const char *filename)
{
MI_INFO *file;
@@ -48,6 +47,7 @@ int run_test(const char *filename)
MI_COLUMNDEF recinfo[20];
MI_KEYDEF keyinfo[20];
HA_KEYSEG keyseg[20];
+ key_range range;
int silent=0;
int opt_unique=0;
@@ -66,15 +66,12 @@ int run_test(const char *filename)
int upd= 10;
ha_rows hrows;
-
-
/* Define a column for NULLs and DEL markers*/
recinfo[0].type=FIELD_NORMAL;
recinfo[0].length=1; /* For NULL bits */
rec_length=1;
-
/* Define 2*ndims columns for coordinates*/
for (i=1; i<=2*ndims ;i++){
@@ -83,7 +80,6 @@ int run_test(const char *filename)
rec_length+=key_length;
}
-
/* Define a key with 2*ndims segments */
keyinfo[0].seg=keyseg;
@@ -101,8 +97,7 @@ int run_test(const char *filename)
keyinfo[0].seg[i].language=default_charset_info->number;
}
-
- if(!silent)
+ if (!silent)
printf("- Creating isam-file\n");
bzero((char*) &create_info,sizeof(create_info));
@@ -115,15 +110,11 @@ int run_test(const char *filename)
recinfo,uniques,&uniquedef,&create_info,create_flag))
goto err;
-
-
-
- if(!silent)
+ if (!silent)
printf("- Open isam-file\n");
if (!(file=mi_open(filename,2,HA_OPEN_ABORT_IF_LOCKED)))
goto err;
-
if (!silent)
printf("- Writing key:s\n");
@@ -144,11 +135,9 @@ int run_test(const char *filename)
}
}
-
- if((error=read_with_pos(file,silent)))
+ if ((error=read_with_pos(file,silent)))
goto err;
-
if (!silent)
printf("- Reading rows with key\n");
@@ -160,12 +149,12 @@ int run_test(const char *filename)
bzero((char*) read_record,MAX_REC_LENGTH);
error=mi_rkey(file,read_record,0,record+1,0,HA_READ_MBR_EQUAL);
- if(error && error!=HA_ERR_KEY_NOT_FOUND)
+ if (error && error!=HA_ERR_KEY_NOT_FOUND)
{
printf(" mi_rkey: %3d errno: %3d\n",error,my_errno);
goto err;
}
- if(error == HA_ERR_KEY_NOT_FOUND)
+ if (error == HA_ERR_KEY_NOT_FOUND)
{
print_record(record,mi_position(file)," NOT FOUND\n");
continue;
@@ -173,10 +162,6 @@ int run_test(const char *filename)
print_record(read_record,mi_position(file),"\n");
}
-
-
-
-
if (!silent)
printf("- Deleting rows\n");
for (i=0; i < nrecords/4; i++)
@@ -184,7 +169,7 @@ int run_test(const char *filename)
my_errno=0;
bzero((char*) read_record,MAX_REC_LENGTH);
error=mi_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR);
- if(error)
+ if (error)
{
printf("pos: %2d mi_rrnd: %3d errno: %3d\n",i,error,my_errno);
goto err;
@@ -192,14 +177,13 @@ int run_test(const char *filename)
print_record(read_record,mi_position(file),"\n");
error=mi_delete(file,read_record);
- if(error)
+ if (error)
{
printf("pos: %2d mi_delete: %3d errno: %3d\n",i,error,my_errno);
goto err;
}
}
-
if (!silent)
printf("- Updating rows with position\n");
for (i=0; i < (nrecords - nrecords/4) ; i++)
@@ -207,9 +191,9 @@ int run_test(const char *filename)
my_errno=0;
bzero((char*) read_record,MAX_REC_LENGTH);
error=mi_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR);
- if(error)
+ if (error)
{
- if(error==HA_ERR_RECORD_DELETED)
+ if (error==HA_ERR_RECORD_DELETED)
continue;
printf("pos: %2d mi_rrnd: %3d errno: %3d\n",i,error,my_errno);
goto err;
@@ -219,19 +203,16 @@ int run_test(const char *filename)
printf("\t-> ");
print_record(record,mi_position(file),"\n");
error=mi_update(file,read_record,record);
- if(error)
+ if (error)
{
printf("pos: %2d mi_update: %3d errno: %3d\n",i,error,my_errno);
goto err;
}
}
-
- if((error=read_with_pos(file,silent)))
+ if ((error=read_with_pos(file,silent)))
goto err;
-
-
if (!silent)
printf("- Test mi_rkey then a sequence of mi_rnext_same\n");
@@ -246,25 +227,20 @@ int run_test(const char *filename)
print_record(read_record,mi_position(file)," mi_rkey\n");
row_count=1;
-
- do {
- if((error=mi_rnext_same(file,read_record)))
+ for (;;)
+ {
+ if ((error=mi_rnext_same(file,read_record)))
{
- if(error==HA_ERR_END_OF_FILE)
+ if (error==HA_ERR_END_OF_FILE)
break;
printf("mi_next: %3d errno: %3d\n",error,my_errno);
goto err;
}
print_record(read_record,mi_position(file)," mi_rnext_same\n");
row_count++;
- }while(1);
+ }
printf(" %d rows\n",row_count);
-
-
-
-
-
if (!silent)
printf("- Test mi_rfirst then a sequence of mi_rnext\n");
@@ -277,10 +253,11 @@ int run_test(const char *filename)
row_count=1;
print_record(read_record,mi_position(file)," mi_frirst\n");
- for(i=0;i<nrecords;i++) {
- if((error=mi_rnext(file,read_record,0)))
+ for (i=0;i<nrecords;i++)
+ {
+ if ((error=mi_rnext(file,read_record,0)))
{
- if(error==HA_ERR_END_OF_FILE)
+ if (error==HA_ERR_END_OF_FILE)
break;
printf("mi_next: %3d errno: %3d\n",error,my_errno);
goto err;
@@ -290,16 +267,18 @@ int run_test(const char *filename)
}
printf(" %d rows\n",row_count);
-
if (!silent)
printf("- Test mi_records_in_range()\n");
create_record1(record, nrecords*4/5);
print_record(record,0,"\n");
- hrows=mi_records_in_range(file,0,record+1,0,HA_READ_MBR_INTERSECT,record+1,0,0);
+
+ range.key= record+1;
+ range.length= 1000; /* Big enough */
+ range.flag= HA_READ_MBR_INTERSECT;
+ hrows= mi_records_in_range(file,0, &range, (key_range*) 0);
printf(" %ld rows\n", (long) hrows);
-
if (mi_close(file)) goto err;
my_end(MY_CHECK_ERROR);
@@ -325,11 +304,11 @@ static int read_with_pos (MI_INFO * file,int silent)
my_errno=0;
bzero((char*) read_record,MAX_REC_LENGTH);
error=mi_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR);
- if(error)
+ if (error)
{
- if(error==HA_ERR_END_OF_FILE)
+ if (error==HA_ERR_END_OF_FILE)
break;
- if(error==HA_ERR_RECORD_DELETED)
+ if (error==HA_ERR_RECORD_DELETED)
continue;
printf("pos: %2d mi_rrnd: %3d errno: %3d\n",i,error,my_errno);
return error;
diff --git a/myisam/sp_test.c b/myisam/sp_test.c
index 5cbf5e87579..29c5f47471a 100644
--- a/myisam/sp_test.c
+++ b/myisam/sp_test.c
@@ -32,10 +32,10 @@ static void print_key(const char *key,const char * tail);
static int run_test(const char *filename);
static int read_with_pos(MI_INFO * file, int silent);
-static int rtree_CreateLineStringWKB(double *ords, uint n_dims, uint n_points, uchar *wkb);
+static int rtree_CreateLineStringWKB(double *ords, uint n_dims, uint n_points,
+ uchar *wkb);
static void rtree_PrintWKB(uchar *wkb, uint n_dims);
-
static char blob_key[MAX_REC_LENGTH];
@@ -46,7 +46,6 @@ int main(int argc __attribute__((unused)),char *argv[])
}
-
int run_test(const char *filename)
{
MI_INFO *file;
@@ -55,7 +54,7 @@ int run_test(const char *filename)
MI_COLUMNDEF recinfo[20];
MI_KEYDEF keyinfo[20];
HA_KEYSEG keyseg[20];
-
+ key_range min_range, max_range;
int silent=0;
int create_flag=0;
int null_fields=0;
@@ -100,7 +99,7 @@ int run_test(const char *filename)
keyinfo[0].seg[0].bit_start=4; /* Long BLOB */
- if(!silent)
+ if (!silent)
printf("- Creating isam-file\n");
bzero((char*) &create_info,sizeof(create_info));
@@ -113,17 +112,12 @@ int run_test(const char *filename)
recinfo,uniques,&uniquedef,&create_info,create_flag))
goto err;
-
-
-
- if(!silent)
+ if (!silent)
printf("- Open isam-file\n");
if (!(file=mi_open(filename,2,HA_OPEN_ABORT_IF_LOCKED)))
goto err;
-
-
if (!silent)
printf("- Writing key:s\n");
@@ -143,11 +137,9 @@ int run_test(const char *filename)
}
}
-
- if((error=read_with_pos(file,silent)))
+ if ((error=read_with_pos(file,silent)))
goto err;
-
if (!silent)
printf("- Deleting rows with position\n");
for (i=0; i < nrecords/4; i++)
@@ -155,23 +147,20 @@ int run_test(const char *filename)
my_errno=0;
bzero((char*) read_record,MAX_REC_LENGTH);
error=mi_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR);
- if(error)
+ if (error)
{
printf("pos: %2d mi_rrnd: %3d errno: %3d\n",i,error,my_errno);
goto err;
}
print_record(read_record,mi_position(file),"\n");
error=mi_delete(file,read_record);
- if(error)
+ if (error)
{
printf("pos: %2d mi_delete: %3d errno: %3d\n",i,error,my_errno);
goto err;
}
}
-
-
-
if (!silent)
printf("- Updating rows with position\n");
for (i=0; i < nrecords/2 ; i++)
@@ -179,9 +168,9 @@ int run_test(const char *filename)
my_errno=0;
bzero((char*) read_record,MAX_REC_LENGTH);
error=mi_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR);
- if(error)
+ if (error)
{
- if(error==HA_ERR_RECORD_DELETED)
+ if (error==HA_ERR_RECORD_DELETED)
continue;
printf("pos: %2d mi_rrnd: %3d errno: %3d\n",i,error,my_errno);
goto err;
@@ -191,20 +180,16 @@ int run_test(const char *filename)
printf("\t-> ");
print_record(record,mi_position(file),"\n");
error=mi_update(file,read_record,record);
- if(error)
+ if (error)
{
printf("pos: %2d mi_update: %3d errno: %3d\n",i,error,my_errno);
goto err;
}
}
-
-
- if((error=read_with_pos(file,silent)))
+ if ((error=read_with_pos(file,silent)))
goto err;
-
-
if (!silent)
printf("- Test mi_rkey then a sequence of mi_rnext_same\n");
@@ -219,25 +204,20 @@ int run_test(const char *filename)
print_record(read_record,mi_position(file)," mi_rkey\n");
row_count=1;
-
- do {
- if((error=mi_rnext_same(file,read_record)))
+ for (;;)
+ {
+ if ((error=mi_rnext_same(file,read_record)))
{
- if(error==HA_ERR_END_OF_FILE)
+ if (error==HA_ERR_END_OF_FILE)
break;
printf("mi_next: %3d errno: %3d\n",error,my_errno);
goto err;
}
print_record(read_record,mi_position(file)," mi_rnext_same\n");
row_count++;
- }while(1);
+ }
printf(" %d rows\n",row_count);
-
-
-
-
-
if (!silent)
printf("- Test mi_rfirst then a sequence of mi_rnext\n");
@@ -251,9 +231,9 @@ int run_test(const char *filename)
print_record(read_record,mi_position(file)," mi_frirst\n");
for(i=0;i<nrecords;i++) {
- if((error=mi_rnext(file,read_record,0)))
+ if ((error=mi_rnext(file,read_record,0)))
{
- if(error==HA_ERR_END_OF_FILE)
+ if (error==HA_ERR_END_OF_FILE)
break;
printf("mi_next: %3d errno: %3d\n",error,my_errno);
goto err;
@@ -263,22 +243,22 @@ int run_test(const char *filename)
}
printf(" %d rows\n",row_count);
-
-
-
if (!silent)
printf("- Test mi_records_in_range()\n");
create_key(key, nrecords*upd);
print_key(key," INTERSECT\n");
- hrows=mi_records_in_range(file,0,key,0,HA_READ_MBR_INTERSECT,record+1,0,
- HA_READ_KEY_EXACT);
+ min_range.key= key;
+ min_range.length= 1000; /* Big enough */
+ min_range.flag= HA_READ_MBR_INTERSECT;
+ max_range.key= record+1;
+ max_range.length= 1000; /* Big enough */
+ max_range.flag= HA_READ_KEY_EXACT;
+ hrows= mi_records_in_range(file,0, &min_range, &max_range);
printf(" %ld rows\n", (long) hrows);
-
if (mi_close(file)) goto err;
my_end(MY_CHECK_ERROR);
-
return 0;
err:
@@ -287,7 +267,6 @@ err:
}
-
static int read_with_pos (MI_INFO * file,int silent)
{
int error;
@@ -302,11 +281,11 @@ static int read_with_pos (MI_INFO * file,int silent)
my_errno=0;
bzero((char*) read_record,MAX_REC_LENGTH);
error=mi_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR);
- if(error)
+ if (error)
{
- if(error==HA_ERR_END_OF_FILE)
+ if (error==HA_ERR_END_OF_FILE)
break;
- if(error==HA_ERR_RECORD_DELETED)
+ if (error==HA_ERR_RECORD_DELETED)
continue;
printf("pos: %2d mi_rrnd: %3d errno: %3d\n",i,error,my_errno);
return error;
@@ -351,7 +330,7 @@ static void print_record(char * record, my_off_t offs,const char * tail)
pos+=4;
printf(" len=%d ",len);
memcpy_fixed(&ptr,pos,sizeof(char*));
- if(ptr)
+ if (ptr)
rtree_PrintWKB((uchar*) ptr,SPDIMS);
else
printf("<NULL> ");
@@ -360,7 +339,6 @@ static void print_record(char * record, my_off_t offs,const char * tail)
}
-
#ifdef NOT_USED
static void create_point(char *record,uint rownr)
{
@@ -447,7 +425,6 @@ static void print_key(const char *key,const char * tail)
}
-
#ifdef NOT_USED
static int rtree_CreatePointWKB(double *ords, uint n_dims, uchar *wkb)
@@ -489,6 +466,7 @@ static int rtree_CreateLineStringWKB(double *ords, uint n_dims, uint n_points,
return 9 + n_points * n_dims * 8;
}
+
static void rtree_PrintWKB(uchar *wkb, uint n_dims)
{
uint wkb_type;
diff --git a/myisammrg/myrg_range.c b/myisammrg/myrg_range.c
index 7644ae40c7b..aafdf70525c 100644
--- a/myisammrg/myrg_range.c
+++ b/myisammrg/myrg_range.c
@@ -16,20 +16,15 @@
#include "myrg_def.h"
-ha_rows myrg_records_in_range(MYRG_INFO *info, int inx, const byte *start_key,
- uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key, uint end_key_len,
- enum ha_rkey_function end_search_flag)
+ha_rows myrg_records_in_range(MYRG_INFO *info, int inx,
+ key_range *min_key, key_range *max_key)
{
ha_rows records=0, res;
MYRG_TABLE *table;
for (table=info->open_tables ; table != info->end_table ; table++)
{
- res=mi_records_in_range(table->table, inx,
- start_key, start_key_len, start_search_flag,
- end_key, end_key_len, end_search_flag);
+ res= mi_records_in_range(table->table, inx, min_key, max_key);
if (res == HA_POS_ERROR)
return HA_POS_ERROR;
if (records > HA_POS_ERROR - res)
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 9541fa6d355..66b24248cf9 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -142,7 +142,7 @@ explain extended select last_insert_id();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache last_insert_id() AS `last_insert_id()`
+Note 1003 select sql_no_cache last_insert_id() AS `last_insert_id()`
insert into t1 set i = 254;
ERROR 23000: Duplicate entry '254' for key 1
select last_insert_id();
diff --git a/mysql-test/r/bench_count_distinct.result b/mysql-test/r/bench_count_distinct.result
index 2b4701389db..fcc0c0948b3 100644
--- a/mysql-test/r/bench_count_distinct.result
+++ b/mysql-test/r/bench_count_distinct.result
@@ -7,5 +7,5 @@ explain extended select count(distinct n) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL n 4 NULL 200 Using index
Warnings:
-Note 1003 select high_priority count(distinct test.t1.n) AS `count(distinct n)` from test.t1
+Note 1003 select count(distinct test.t1.n) AS `count(distinct n)` from test.t1
drop table t1;
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index 14b1788ddd6..1aa838140fd 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -27,7 +27,7 @@ explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" E
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (case 1 when 1 then _latin1'one' when 2 then _latin1'two' else _latin1'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
+Note 1003 select (case 1 when 1 then _latin1'one' when 2 then _latin1'two' else _latin1'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END
two
@@ -66,7 +66,7 @@ explain extended select case a when 1 then 2 when 2 then 3 else 0 end as fcase,
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
Warnings:
-Note 1003 select high_priority (case test.t1.a when 1 then 2 when 2 then 3 else 0 end) AS `fcase`,count(0) AS `count(*)` from test.t1 group by (case test.t1.a when 1 then 2 when 2 then 3 else 0 end)
+Note 1003 select (case test.t1.a when 1 then 2 when 2 then 3 else 0 end) AS `fcase`,count(0) AS `count(*)` from test.t1 group by (case test.t1.a when 1 then 2 when 2 then 3 else 0 end)
select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase;
fcase count(*)
nothing 2
@@ -141,7 +141,7 @@ COALESCE('a' COLLATE latin1_bin,'b');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce(_latin1'a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,_latin1'1') AS `COALESCE(1,'1')`,coalesce(1.1,_latin1'1') AS `COALESCE(1.1,'1')`,coalesce((_latin1'a' collate _latin1'latin1_bin'),_latin1'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
+Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce(_latin1'a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,_latin1'1') AS `COALESCE(1,'1')`,coalesce(1.1,_latin1'1') AS `COALESCE(1.1,'1')`,coalesce((_latin1'a' collate _latin1'latin1_bin'),_latin1'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index cdeb5b3dc21..6564a3e392b 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -20,7 +20,7 @@ explain extended select ~5, cast(~5 as signed);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as signed)`
+Note 1003 select ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as signed)`
select cast(5 as unsigned) -6.0;
cast(5 as unsigned) -6.0
-1.0
diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result
index 8f4ddedbfcf..d4a8beda185 100644
--- a/mysql-test/r/ctype_collate.result
+++ b/mysql-test/r/ctype_collate.result
@@ -519,7 +519,7 @@ explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority charset(_latin1'a') AS `charset('a')`,collation(_latin1'a') AS `collation('a')`,coercibility(_latin1'a') AS `coercibility('a')`,(_latin1'a' = _latin1'A') AS `'a'='A'`
+Note 1003 select charset(_latin1'a') AS `charset('a')`,collation(_latin1'a') AS `collation('a')`,coercibility(_latin1'a') AS `coercibility('a')`,(_latin1'a' = _latin1'A') AS `'a'='A'`
SET CHARACTER SET koi8r;
SHOW VARIABLES LIKE 'collation_client';
Variable_name Value
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index fba1d9f47e3..b73953823ca 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -331,7 +331,7 @@ explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM",
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
+Note 1003 select makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
create table t1 (d date);
insert into t1 values ('2004-07-14'),('2005-07-14');
select date_format(d,"%d") from t1 order by 1;
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index 02e1ace71e1..d66dec741bd 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -44,3 +44,12 @@ explain select count(*) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1;
+set names koi8r;
+create table ÔÁÂ (ËÏÌ0 int, ËÏÌ1 int, key ÉÎÄ0 (ËÏÌ0), key ÉÎÄ01 (ËÏÌ0,ËÏÌ1));
+insert into ÔÁÂ (ËÏÌ0) values (1);
+insert into ÔÁÂ (ËÏÌ0) values (2);
+explain select ËÏÌ0 from ÔÁÂ where ËÏÌ0=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE ÔÁÂ ref ÉÎÄ0,ÉÎÄ01 ÉÎÄ0 5 const 1 Using where; Using index
+drop table ÔÁÂ;
+set names latin1;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 02850e4d902..3106602e718 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -17,7 +17,7 @@ explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'collections'))
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'collections'))
select * from t1 where MATCH(a,b) AGAINST ("indexes");
a b
Full-text indexes are called collections
@@ -78,7 +78,7 @@ explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'support -collections' in boolean mode))
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'support -collections' in boolean mode))
select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE);
a b
MySQL has now support for full-text search
@@ -142,6 +142,8 @@ a b
MySQL has now support for full-text search
select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE);
a b
+select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
+a b
select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN BOOLEAN MODE);
a b
select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 61aa1c0a497..ef03ec71c69 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -11,7 +11,7 @@ explain extended select uncompress(compress(@test_compress_string));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
+Note 1003 select sql_no_cache uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
1
@@ -19,7 +19,7 @@ explain extended select uncompressed_length(compress(@test_compress_string))=len
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
+Note 1003 select sql_no_cache (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
select uncompressed_length(compress(@test_compress_string));
uncompressed_length(compress(@test_compress_string))
117
diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result
index 70ebcf216fb..2ee3e770a2e 100644
--- a/mysql-test/r/func_crypt.result
+++ b/mysql-test/r/func_crypt.result
@@ -91,4 +91,4 @@ explain extended select password('idkfa '), old_password('idkfa');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')`
+Note 1003 select password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')`
diff --git a/mysql-test/r/func_default.result b/mysql-test/r/func_default.result
index fe3f5b9473a..2993d79a870 100644
--- a/mysql-test/r/func_default.result
+++ b/mysql-test/r/func_default.result
@@ -8,7 +8,7 @@ explain extended select default(str), default(strnull), default(intg), default(r
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
Warnings:
-Note 1003 select high_priority default(test.t1.str) AS `default(str)`,default(test.t1.strnull) AS `default(strnull)`,default(test.t1.intg) AS `default(intg)`,default(test.t1.rel) AS `default(rel)` from test.t1
+Note 1003 select default(test.t1.str) AS `default(str)`,default(test.t1.strnull) AS `default(strnull)`,default(test.t1.intg) AS `default(intg)`,default(test.t1.rel) AS `default(rel)` from test.t1
select * from t1 where str <> default(str);
str strnull intg rel
0 0
diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result
index abdfda0423f..d32e67fe7d5 100644
--- a/mysql-test/r/func_encrypt.result
+++ b/mysql-test/r/func_encrypt.result
@@ -138,4 +138,4 @@ explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_dec
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority des_decrypt(des_encrypt(_latin1'hello',4),_latin1'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt(_latin1'hello',_latin1'hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
+Note 1003 select des_decrypt(des_encrypt(_latin1'hello',4),_latin1'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt(_latin1'hello',_latin1'hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index dccd87e3d75..60a28e5018f 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -18,7 +18,7 @@ explain extended select grp,group_concat(c) from t1 group by grp;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
Warnings:
-Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(test.t1.c seperator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp
+Note 1003 select test.t1.grp AS `grp`,group_concat(test.t1.c seperator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp
select grp,group_concat(a,c) from t1 group by grp;
grp group_concat(a,c)
1 1a
@@ -93,7 +93,7 @@ explain extended select grp,group_concat(distinct c order by c desc) from t1 gro
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
Warnings:
-Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp
+Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp
select grp,group_concat(c order by c separator ",") from t1 group by grp;
grp group_concat(c order by c separator ",")
1 a
@@ -113,7 +113,7 @@ explain extended select grp,group_concat(distinct c order by c separator ",") fr
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
Warnings:
-Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp
+Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp
select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp;
grp group_concat(distinct c order by c desc separator ",")
1 a
@@ -301,3 +301,12 @@ a c grp
2 4 4
1 2 5
drop table t1,t2;
+CREATE TABLE t1 ( a int );
+CREATE TABLE t2 ( a int );
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+SELECT GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a) FROM t1, t2 GROUP BY t1.a;
+GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a)
+1,2
+2,4
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 57b109e1ee6..bd5646f4068 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -265,7 +265,7 @@ explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
Warnings:
-Note 1003 select high_priority big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
+Note 1003 select sql_big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
drop table t1;
create table t1 (col int);
insert into t1 values (-1), (-2), (-3);
diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result
index 0a04585d77d..ce26a0bf30a 100644
--- a/mysql-test/r/func_if.result
+++ b/mysql-test/r/func_if.result
@@ -43,7 +43,7 @@ explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using filesort
Warnings:
-Note 1003 select high_priority if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY')) AS `s` from test.t1 where (test.t1.st like _latin1'%a%') order by if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY'))
+Note 1003 select if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY')) AS `s` from test.t1 where (test.t1.st like _latin1'%a%') order by if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY'))
select nullif(u=0, 'test') from t1;
nullif(u=0, 'test')
NULL
@@ -57,7 +57,7 @@ explain extended select nullif(u=0, 'test') from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7
Warnings:
-Note 1003 select high_priority nullif((test.t1.u = 0),_latin1'test') AS `nullif(u=0, 'test')` from test.t1
+Note 1003 select nullif((test.t1.u = 0),_latin1'test') AS `nullif(u=0, 'test')` from test.t1
drop table t1;
select NULLIF(NULL,NULL), NULLIF(NULL,1), NULLIF(NULL,1.0), NULLIF(NULL,"test");
NULLIF(NULL,NULL) NULLIF(NULL,1) NULLIF(NULL,1.0) NULLIF(NULL,"test")
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index 04b6fc038b0..f66b3dea94b 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -146,7 +146,7 @@ explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1 where (_latin1'a' in (test.t1.a,test.t1.b,(test.t1.c collate _latin1'latin1_bin')))
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1 where (_latin1'a' in (test.t1.a,test.t1.b,(test.t1.c collate _latin1'latin1_bin')))
drop table t1;
select '1.0' in (1,2);
'1.0' in (1,2)
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 9085849e582..12eef4aa881 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -5,7 +5,7 @@ explain extended select floor(5.5),floor(-5.5);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`
+Note 1003 select floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`
select ceiling(5.5),ceiling(-5.5);
ceiling(5.5) ceiling(-5.5)
6 -5
@@ -13,7 +13,7 @@ explain extended select ceiling(5.5),ceiling(-5.5);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`
+Note 1003 select ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1)
52.6 52.64 50 0 -52.6 -50
@@ -21,7 +21,7 @@ explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),t
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`
+Note 1003 select truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`
select round(5.5),round(-5.5);
round(5.5) round(-5.5)
6 -6
@@ -29,7 +29,7 @@ explain extended select round(5.5),round(-5.5);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
+Note 1003 select round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
round(5.64,1) round(5.64,2) round(5.64,-1) round(5.64,-2)
5.6 5.64 10 0
@@ -40,7 +40,7 @@ explain extended select abs(-10), sign(-5), sign(5), sign(0);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
+Note 1003 select abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
log(exp(10)) exp(log(sqrt(10))*2) log(-1) log(NULL) log(1,1) log(3,9) log(-1,2) log(NULL,2)
10.000000 10.000000 NULL NULL NULL 2.000000 NULL NULL
@@ -48,7 +48,7 @@ explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
+Note 1003 select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL)
10.000000 10.000000 NULL NULL NULL
@@ -56,7 +56,7 @@ explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
+Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
3.000000 3.906891 NULL NULL NULL
@@ -64,7 +64,7 @@ explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
+Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
2.000000 1.255273 NULL NULL NULL
@@ -72,7 +72,7 @@ explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
+Note 1003 select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
select pow(10,log10(10)),power(2,4);
pow(10,log10(10)) power(2,4)
10.000000 16.000000
@@ -80,7 +80,7 @@ explain extended select pow(10,log10(10)),power(2,4);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4)`
+Note 1003 select pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4)`
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select rand(999999),rand();
rand(999999) rand()
@@ -89,7 +89,7 @@ explain extended select rand(999999),rand();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache rand(999999) AS `rand(999999)`,rand() AS `rand()`
+Note 1003 select sql_no_cache rand(999999) AS `rand(999999)`,rand() AS `rand()`
select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1);
pi() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1)
3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398
@@ -97,7 +97,7 @@ explain extended select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority pi() AS `pi()`,sin((pi() / 2)) AS `sin(pi()/2)`,cos((pi() / 2)) AS `cos(pi()/2)`,abs(tan(pi())) AS `abs(tan(pi()))`,(1 / tan(1)) AS `cot(1)`,asin(1) AS `asin(1)`,acos(0) AS `acos(0)`,atan(1) AS `atan(1)`
+Note 1003 select pi() AS `pi()`,sin((pi() / 2)) AS `sin(pi()/2)`,cos((pi() / 2)) AS `cos(pi()/2)`,abs(tan(pi())) AS `abs(tan(pi()))`,(1 / tan(1)) AS `cot(1)`,asin(1) AS `asin(1)`,acos(0) AS `acos(0)`,atan(1) AS `atan(1)`
select degrees(pi()),radians(360);
degrees(pi()) radians(360)
180 6.2831853071796
@@ -123,4 +123,4 @@ explain extended select degrees(pi()),radians(360);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
+Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
diff --git a/mysql-test/r/func_op.result b/mysql-test/r/func_op.result
index fb1e715ac3b..6cd975b0911 100644
--- a/mysql-test/r/func_op.result
+++ b/mysql-test/r/func_op.result
@@ -5,7 +5,7 @@ explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -(2)) AS `-(1+1)*-2`
+Note 1003 select (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -(2)) AS `-(1+1)*-2`
select 1 | (1+1),5 & 3,bit_count(7) ;
1 | (1+1) 5 & 3 bit_count(7)
3 1 3
@@ -13,7 +13,7 @@ explain extended select 1 | (1+1),5 & 3,bit_count(7) ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (1 | (1 + 1)) AS `1 | (1+1)`,(5 & 3) AS `5 & 3`,bit_count(7) AS `bit_count(7)`
+Note 1003 select (1 | (1 + 1)) AS `1 | (1+1)`,(5 & 3) AS `5 & 3`,bit_count(7) AS `bit_count(7)`
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
1 << 32 1 << 63 1 << 64 4 >> 2 4 >> 63 1<< 63 >> 60
4294967296 9223372036854775808 0 1 0 8
diff --git a/mysql-test/r/func_regexp.result b/mysql-test/r/func_regexp.result
index 323642cab8c..7f977e2782b 100644
--- a/mysql-test/r/func_regexp.result
+++ b/mysql-test/r/func_regexp.result
@@ -40,7 +40,7 @@ explain extended select * from t1 where xxx regexp('is a test of some long text
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
Warnings:
-Note 1003 select high_priority test.t1.xxx AS `xxx` from test.t1 where (test.t1.xxx regexp _latin1'is a test of some long text to')
+Note 1003 select test.t1.xxx AS `xxx` from test.t1 where (test.t1.xxx regexp _latin1'is a test of some long text to')
select * from t1 where xxx regexp('is a test of some long text to ');
xxx
this is a test of some long text to see what happens
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index b101c18f505..4918617f85f 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -5,7 +5,7 @@ explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field(_latin1'IBM',_latin1'NCA',_latin1'ICL',_latin1'SUN',_latin1'IBM',_latin1'DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field(_latin1'A',_latin1'B',_latin1'C') AS `field("A","B","C")`,elt(2,_latin1'ONE',_latin1'TWO',_latin1'THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
+Note 1003 select interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field(_latin1'IBM',_latin1'NCA',_latin1'ICL',_latin1'SUN',_latin1'IBM',_latin1'DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field(_latin1'A',_latin1'B',_latin1'C') AS `field("A","B","C")`,elt(2,_latin1'ONE',_latin1'TWO',_latin1'THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56);
INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56)
1
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 216e2ed26f2..4e7df9edefa 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -622,7 +622,7 @@ explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'moo
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,(_latin1'HE' collate _latin1'BINARY') AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
+Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,(_latin1'HE' collate _latin1'BINARY') AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
SELECT lpad(12345, 5, "#");
lpad(12345, 5, "#")
12345
diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result
index 338902e3f3a..671132428c5 100644
--- a/mysql-test/r/func_system.result
+++ b/mysql-test/r/func_system.result
@@ -41,7 +41,7 @@ explain extended select database(), user();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache database() AS `database()`,user() AS `user()`
+Note 1003 select sql_no_cache database() AS `database()`,user() AS `user()`
create table t1 (version char(40)) select database(), user(), version() as 'version';
show create table t1;
Table Create Table
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 3a945c0826f..c3fe1de15db 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -48,7 +48,7 @@ explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (3 ^ 11) AS `3 ^ 11`,(1 ^ 1) AS `1 ^ 1`,(1 ^ 0) AS `1 ^ 0`,(1 ^ NULL) AS `1 ^ NULL`,(NULL ^ 1) AS `NULL ^ 1`
+Note 1003 select (3 ^ 11) AS `3 ^ 11`,(1 ^ 1) AS `1 ^ 1`,(1 ^ 0) AS `1 ^ 0`,(1 ^ NULL) AS `1 ^ NULL`,(NULL ^ 1) AS `NULL ^ 1`
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
0 1 1 0 NULL NULL NULL
@@ -62,7 +62,7 @@ explain extended select 10 % 7, 10 mod 7, 10 div 3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3`
+Note 1003 select (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3`
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
(1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2
18446744073709551615 18446744073709551615 9223372036854775807
@@ -70,7 +70,7 @@ explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority ((1 << 64) - 1) AS `(1 << 64)-1`,(((1 << 64) - 1) DIV 1) AS `((1 << 64)-1) DIV 1`,(((1 << 64) - 1) DIV 2) AS `((1 << 64)-1) DIV 2`
+Note 1003 select ((1 << 64) - 1) AS `(1 << 64)-1`,(((1 << 64) - 1) DIV 1) AS `((1 << 64)-1) DIV 1`,(((1 << 64) - 1) DIV 2) AS `((1 << 64)-1) DIV 2`
create table t1 (a int);
insert t1 values (1);
select * from t1 where 1 xor 1;
@@ -79,7 +79,7 @@ explain extended select * from t1 where 1 xor 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select high_priority test.t1.a AS `a` from test.t1 where (1 xor 1)
+Note 1003 select test.t1.a AS `a` from test.t1 where (1 xor 1)
select - a from t1;
- a
-1
@@ -87,7 +87,7 @@ explain extended select - a from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
Warnings:
-Note 1003 select high_priority -(test.t1.a) AS `- a` from test.t1
+Note 1003 select -(test.t1.a) AS `- a` from test.t1
drop table t1;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
@@ -108,7 +108,7 @@ explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (_koi8r'a' = (_koi8r'A' collate _latin1'koi8r_general_ci')) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
+Note 1003 select (_koi8r'a' = (_koi8r'A' collate _latin1'koi8r_general_ci')) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
_koi8r'a' = _koi8r'A' COLLATE koi8r_bin
0
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index b37df0aef2c..6f1b4af5d3c 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -584,7 +584,7 @@ explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_d
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(to_days(curdate())) - weekday(to_days(now()))) AS `weekday(curdate())-weekday(now())`,dayname(to_days(_latin1'1962-03-03')) AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
+Note 1003 select sql_no_cache period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(to_days(curdate())) - weekday(to_days(now()))) AS `weekday(curdate())-weekday(now())`,dayname(to_days(_latin1'1962-03-03')) AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
SET @TMP=NOW();
CREATE TABLE t1 (d DATETIME);
INSERT INTO t1 VALUES (NOW());
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index be33c05c578..c2fd7855c85 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -228,7 +228,7 @@ explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelo
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21
Warnings:
-Note 1003 select high_priority dimension(test.gis_geometry.g) AS `Dimension(g)`,geometrytype(test.gis_geometry.g) AS `GeometryType(g)`,isempty(test.gis_geometry.g) AS `IsEmpty(g)`,astext(envelope(test.gis_geometry.g)) AS `AsText(Envelope(g))` from test.gis_geometry
+Note 1003 select dimension(test.gis_geometry.g) AS `Dimension(g)`,geometrytype(test.gis_geometry.g) AS `GeometryType(g)`,isempty(test.gis_geometry.g) AS `IsEmpty(g)`,astext(envelope(test.gis_geometry.g)) AS `AsText(Envelope(g))` from test.gis_geometry
SELECT fid, X(g) FROM gis_point;
fid X(g)
101 10
@@ -245,7 +245,7 @@ explain extended select X(g),Y(g) FROM gis_point;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4
Warnings:
-Note 1003 select high_priority x(test.gis_point.g) AS `X(g)`,y(test.gis_point.g) AS `Y(g)` from test.gis_point
+Note 1003 select x(test.gis_point.g) AS `X(g)`,y(test.gis_point.g) AS `Y(g)` from test.gis_point
SELECT fid, AsText(StartPoint(g)) FROM gis_line;
fid AsText(StartPoint(g))
105 POINT(0 0)
@@ -280,7 +280,7 @@ explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),Num
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority astext(startpoint(test.gis_line.g)) AS `AsText(StartPoint(g))`,astext(endpoint(test.gis_line.g)) AS `AsText(EndPoint(g))`,glength(test.gis_line.g) AS `GLength(g)`,numpoints(test.gis_line.g) AS `NumPoints(g)`,astext(pointn(test.gis_line.g,2)) AS `AsText(PointN(g, 2))`,isclosed(test.gis_line.g) AS `IsClosed(g)` from test.gis_line
+Note 1003 select astext(startpoint(test.gis_line.g)) AS `AsText(StartPoint(g))`,astext(endpoint(test.gis_line.g)) AS `AsText(EndPoint(g))`,glength(test.gis_line.g) AS `GLength(g)`,numpoints(test.gis_line.g) AS `NumPoints(g)`,astext(pointn(test.gis_line.g,2)) AS `AsText(PointN(g, 2))`,isclosed(test.gis_line.g) AS `IsClosed(g)` from test.gis_line
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
fid AsText(Centroid(g))
108 POINT(15 15)
@@ -310,7 +310,7 @@ explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumI
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority astext(centroid(test.gis_polygon.g)) AS `AsText(Centroid(g))`,area(test.gis_polygon.g) AS `Area(g)`,astext(exteriorring(test.gis_polygon.g)) AS `AsText(ExteriorRing(g))`,numinteriorrings(test.gis_polygon.g) AS `NumInteriorRings(g)`,astext(interiorringn(test.gis_polygon.g,1)) AS `AsText(InteriorRingN(g, 1))` from test.gis_polygon
+Note 1003 select astext(centroid(test.gis_polygon.g)) AS `AsText(Centroid(g))`,area(test.gis_polygon.g) AS `Area(g)`,astext(exteriorring(test.gis_polygon.g)) AS `AsText(ExteriorRing(g))`,numinteriorrings(test.gis_polygon.g) AS `NumInteriorRings(g)`,astext(interiorringn(test.gis_polygon.g,1)) AS `AsText(InteriorRingN(g, 1))` from test.gis_polygon
SELECT fid, IsClosed(g) FROM gis_multi_line;
fid IsClosed(g)
114 0
@@ -349,7 +349,7 @@ explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority test.gis_multi_point.fid AS `fid`,numgeometries(test.gis_multi_point.g) AS `NumGeometries(g)` from test.gis_multi_point
+Note 1003 select test.gis_multi_point.fid AS `fid`,numgeometries(test.gis_multi_point.g) AS `NumGeometries(g)` from test.gis_multi_point
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
fid AsText(GeometryN(g, 2))
111 POINT(10 10)
@@ -377,7 +377,7 @@ explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority test.gis_multi_point.fid AS `fid`,astext(geometryn(test.gis_multi_point.g,2)) AS `AsText(GeometryN(g, 2))` from test.gis_multi_point
+Note 1003 select test.gis_multi_point.fid AS `fid`,astext(geometryn(test.gis_multi_point.g,2)) AS `AsText(GeometryN(g, 2))` from test.gis_multi_point
SELECT g1.fid as first, g2.fid as second,
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
@@ -397,7 +397,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
1 SIMPLE g2 ALL NULL NULL NULL NULL 2
Warnings:
-Note 1003 select high_priority test.g1.fid AS `first`,test.g2.fid AS `second`,within(test.g1.g,test.g2.g) AS `w`,contains(test.g1.g,test.g2.g) AS `c`,overlaps(test.g1.g,test.g2.g) AS `o`,equals(test.g1.g,test.g2.g) AS `e`,disjoint(test.g1.g,test.g2.g) AS `d`,touches(test.g1.g,test.g2.g) AS `t`,intersects(test.g1.g,test.g2.g) AS `i`,crosses(test.g1.g,test.g2.g) AS `r` from test.gis_geometrycollection g1 join test.gis_geometrycollection g2 order by test.g1.fid,test.g2.fid
+Note 1003 select test.g1.fid AS `first`,test.g2.fid AS `second`,within(test.g1.g,test.g2.g) AS `w`,contains(test.g1.g,test.g2.g) AS `c`,overlaps(test.g1.g,test.g2.g) AS `o`,equals(test.g1.g,test.g2.g) AS `e`,disjoint(test.g1.g,test.g2.g) AS `d`,touches(test.g1.g,test.g2.g) AS `t`,intersects(test.g1.g,test.g2.g) AS `i`,crosses(test.g1.g,test.g2.g) AS `r` from test.gis_geometrycollection g1 join test.gis_geometrycollection g2 order by test.g1.fid,test.g2.fid
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE t1 (
gp point,
@@ -439,12 +439,12 @@ explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
+Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
+Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
SRID(GeomFromText('LineString(1 1,2 2)',101))
101
@@ -452,12 +452,12 @@ explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
+Note 1003 select srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`
+Note 1003 select issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`
create table t1 (a geometry not null);
insert into t1 values (GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage');
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 8b3948e093f..c47530cdc46 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -204,3 +204,27 @@ show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'
drop user mysqltest_1@localhost;
+SET NAMES koi8r;
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ int);
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.* TO 'ÀÚÅÒ'@'localhost'
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+DROP DATABASE ÂÄ;
+SET NAMES latin1;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index bbe3326fd34..9af7304c167 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -288,7 +288,7 @@ explain extended select sql_big_result spid,sum(userid) from t1 group by spid de
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
Warnings:
-Note 1003 select high_priority big_result test.t1.spID AS `spid`,sum(test.t1.userID) AS `sum(userid)` from test.t1 group by test.t1.spID desc
+Note 1003 select sql_big_result test.t1.spID AS `spid`,sum(test.t1.userID) AS `sum(userid)` from test.t1 group by test.t1.spID desc
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index 7c88776579b..010e86273a2 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -12,7 +12,7 @@ explain extended select count(a) as b from t1 where a=0 having b >=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select high_priority count(test.t1.a) AS `b` from test.t1 where (test.t1.a = 0) having (count(test.t1.a) >= 0)
+Note 1003 select count(test.t1.a) AS `b` from test.t1 where (test.t1.a = 0) having (count(test.t1.a) >= 0)
drop table t1;
CREATE TABLE t1 (
raw_id int(10) NOT NULL default '0',
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 60280715911..981ef23c779 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -467,7 +467,7 @@ ERROR 23000: Duplicate entry 'test2' for key 2
select * from t1;
id ggid email passwd
1 this will work
-4 test2 this will work
+3 test2 this will work
select * from t1 where id=1;
id ggid email passwd
1 this will work
@@ -1538,6 +1538,60 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t2 add index id_test (id), add index id_test2 (id,id2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ KEY `id_test` (`id`),
+ KEY `id_test2` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
ERROR HY000: Can't create table './test/t2.frm' (errno: 150)
-drop table t1;
+create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `b_2` (`b`),
+ KEY `b` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `b` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`),
+ CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2, t1;
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
index 53867bf4546..303d7186015 100644
--- a/mysql-test/r/insert_update.result
+++ b/mysql-test/r/insert_update.result
@@ -60,12 +60,12 @@ explain extended SELECT *, VALUES(a) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c`,values(test.t1.a) AS `VALUES(a)` from test.t1
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c`,values(test.t1.a) AS `VALUES(a)` from test.t1
explain extended select * from t1 where values(a);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1
DROP TABLE t1;
create table t1(a int primary key, b int);
insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5);
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index cbd949d6e72..7391f4192bf 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -6,7 +6,7 @@ explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnu
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,_latin1'TRUE') AS `ifnull(null,"TRUE")`,ifnull(_latin1'TRUE',_latin1'ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null`
+Note 1003 select NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,_latin1'TRUE') AS `ifnull(null,"TRUE")`,ifnull(_latin1'TRUE',_latin1'ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null`
select 1 | NULL,1 & NULL,1+NULL,1-NULL;
1 | NULL 1 & NULL 1+NULL 1-NULL
NULL NULL NULL NULL
@@ -32,7 +32,7 @@ explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (2 between NULL and 1) AS `2 between null and 1`,(2 between 3 and NULL) AS `2 between 3 AND NULL`,(NULL between 1 and 2) AS `NULL between 1 and 2`,(2 between NULL and 3) AS `2 between NULL and 3`,(2 between 1 and NULL) AS `2 between 1 AND null`
+Note 1003 select (2 between NULL and 1) AS `2 between null and 1`,(2 between 3 and NULL) AS `2 between 3 AND NULL`,(NULL between 1 and 2) AS `NULL between 1 and 2`,(2 between NULL and 3) AS `2 between NULL and 3`,(2 between 1 and NULL) AS `2 between 1 AND null`
SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
NULL AND NULL 1 AND NULL NULL AND 1 NULL OR NULL 0 OR NULL NULL OR 0
NULL NULL NULL NULL NULL NULL
@@ -49,7 +49,7 @@ explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),ine
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton(_latin1'122.256') AS `inet_aton("122.256")`,inet_aton(_latin1'122.226.') AS `inet_aton("122.226.")`,inet_aton(_latin1'') AS `inet_aton("")`
+Note 1003 select inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton(_latin1'122.256') AS `inet_aton("122.256")`,inet_aton(_latin1'122.226.') AS `inet_aton("122.226.")`,inet_aton(_latin1'') AS `inet_aton("")`
create table t1 (x int);
insert into t1 values (null);
select * from t1 where x != 0;
diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result
index 37e68d8b13e..50048808c39 100644
--- a/mysql-test/r/olap.result
+++ b/mysql-test/r/olap.result
@@ -85,7 +85,7 @@ explain extended select product, country_id , year, sum(profit) from t1 group by
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort
Warnings:
-Note 1003 select high_priority test.t1.product AS `product`,test.t1.country_id AS `country_id`,test.t1.year AS `year`,sum(test.t1.profit) AS `sum(profit)` from test.t1 group by test.t1.product,test.t1.country_id,test.t1.year with rollup
+Note 1003 select test.t1.product AS `product`,test.t1.country_id AS `country_id`,test.t1.year AS `year`,sum(test.t1.profit) AS `sum(profit)` from test.t1 group by test.t1.product,test.t1.country_id,test.t1.year with rollup
select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup;
product country_id sum(profit)
TV 1 400
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 1a10c9c6ce9..694dc26bcde 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -85,6 +85,15 @@ i
1
3
drop table t1;
+create table t1 ( pk int primary key, name varchar(255) not null, number varchar(255) not null);
+insert into t1 values (1, 'Gamma', '123'), (2, 'Gamma Ext', '123a'), (3, 'Alpha', '001'), (4, 'Beta', '200c');
+select distinct t1.name as 'Building Name',t1.number as 'Building Number' from t1 order by t1.name asc;
+Building Name Building Number
+Alpha 001
+Beta 200c
+Gamma 123
+Gamma Ext 123a
+drop table t1;
create table t1 (id int not null,col1 int not null,col2 int not null,index(col1));
insert into t1 values(1,2,2),(2,2,1),(3,1,2),(4,1,1),(5,1,4),(6,2,3),(7,3,1),(8,2,4);
select * from t1 order by col1,col2;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 8d03a7bbcf0..185961c53ff 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -305,7 +305,7 @@ explain extended select benchmark(1,1) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
Warnings:
-Note 1003 select high_priority no_cache benchmark(1,1) AS `benchmark(1,1)` from test.t1
+Note 1003 select sql_no_cache benchmark(1,1) AS `benchmark(1,1)` from test.t1
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index 37d4f1d9b26..76d6fa13766 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -44,7 +44,7 @@ explain extended select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,N
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority ((1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL)))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))`
+Note 1003 select ((1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL)))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))`
SELECT (1,2,3)=(0,NULL,3);
(1,2,3)=(0,NULL,3)
0
diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result
index b8071b16c2e..b60cad18c54 100644
--- a/mysql-test/r/rpl000001.result
+++ b/mysql-test/r/rpl000001.result
@@ -44,7 +44,7 @@ explain extended select get_lock("hold_slave",10);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache get_lock(_latin1'hold_slave',10) AS `get_lock("hold_slave",10)`
+Note 1003 select sql_no_cache get_lock(_latin1'hold_slave',10) AS `get_lock("hold_slave",10)`
start slave;
select release_lock("hold_slave");
release_lock("hold_slave")
@@ -53,7 +53,7 @@ explain extended select release_lock("hold_slave");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache release_lock(_latin1'hold_slave') AS `release_lock("hold_slave")`
+Note 1003 select sql_no_cache release_lock(_latin1'hold_slave') AS `release_lock("hold_slave")`
unlock tables;
create table t2(id int);
insert into t2 values(connection_id());
diff --git a/mysql-test/r/rpl_get_lock.result b/mysql-test/r/rpl_get_lock.result
index 8e3e335b2d0..2c57069e91a 100644
--- a/mysql-test/r/rpl_get_lock.result
+++ b/mysql-test/r/rpl_get_lock.result
@@ -25,7 +25,7 @@ explain extended select is_free_lock("lock"), is_used_lock("lock");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache is_free_lock(_latin1'lock') AS `is_free_lock("lock")`,is_used_lock(_latin1'lock') AS `is_used_lock("lock")`
+Note 1003 select sql_no_cache is_free_lock(_latin1'lock') AS `is_free_lock("lock")`,is_used_lock(_latin1'lock') AS `is_used_lock("lock")`
select is_free_lock("lock2");
is_free_lock("lock2")
1
diff --git a/mysql-test/r/rpl_master_pos_wait.result b/mysql-test/r/rpl_master_pos_wait.result
index ea917805560..e92d1ffa361 100644
--- a/mysql-test/r/rpl_master_pos_wait.result
+++ b/mysql-test/r/rpl_master_pos_wait.result
@@ -11,7 +11,7 @@ explain extended select master_pos_wait('master-bin.999999',0,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
+Note 1003 select sql_no_cache master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
select master_pos_wait('master-bin.999999',0);
stop slave sql_thread;
master_pos_wait('master-bin.999999',0)
diff --git a/mysql-test/r/rpl_server_id2.result b/mysql-test/r/rpl_server_id2.result
index fde7251497a..82ab1ff85a7 100644
--- a/mysql-test/r/rpl_server_id2.result
+++ b/mysql-test/r/rpl_server_id2.result
@@ -4,9 +4,6 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-drop table if exists t1;
-Warnings:
-Note 1051 Unknown table 't1'
create table t1 (n int);
reset master;
stop slave;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 43c41378f30..8c783445127 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -1470,7 +1470,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
Warnings:
-Note 1003 select high_priority count(0) AS `count(*)`,min(test.t2.fld4) AS `min(fld4)`,max(test.t2.fld4) AS `max(fld4)`,sum(test.t2.fld1) AS `sum(fld1)`,avg(test.t2.fld1) AS `avg(fld1)`,std(test.t2.fld1) AS `std(fld1)`,variance(test.t2.fld1) AS `variance(fld1)` from test.t2 where ((test.t2.companynr = 34) and (test.t2.fld4 <> _latin1''))
+Note 1003 select count(0) AS `count(*)`,min(test.t2.fld4) AS `min(fld4)`,max(test.t2.fld4) AS `max(fld4)`,sum(test.t2.fld1) AS `sum(fld1)`,avg(test.t2.fld1) AS `avg(fld1)`,std(test.t2.fld1) AS `std(fld1)`,variance(test.t2.fld1) AS `variance(fld1)` from test.t2 where ((test.t2.companynr = 34) and (test.t2.fld4 <> _latin1''))
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index a2210fde222..8fe447c59fd 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -7,7 +7,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1249 Select 2 was reduced during optimisation
-Note 1003 select high_priority 2 AS `(select 2)`
+Note 1003 select 2 AS `(select 2)`
SELECT (SELECT 1) UNION SELECT (SELECT 2);
(SELECT 1)
1
@@ -19,7 +19,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1249 Select 2 was reduced during optimisation
Note 1249 Select 4 was reduced during optimisation
-Note 1003 select high_priority 1 AS `(SELECT 1)` union select 2 AS `(SELECT 2)`
+Note 1003 select 1 AS `(SELECT 1)` union select 2 AS `(SELECT 2)`
SELECT (SELECT (SELECT 0 UNION SELECT 0));
(SELECT (SELECT 0 UNION SELECT 0))
0
@@ -30,7 +30,7 @@ id select_type table type possible_keys key key_len ref rows Extra
4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1249 Select 2 was reduced during optimisation
-Note 1003 select high_priority (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
+Note 1003 select (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
ERROR 42S22: Reference 'a' not supported (forward reference in item list)
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
@@ -48,7 +48,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select high_priority 1 AS `1` from (select 1 AS `a`) b having ((select b.a AS `a`) = 1)
+Note 1003 select 1 AS `1` from (select 1 AS `a`) b having ((select b.a AS `a`) = 1)
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -183,7 +183,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 UNION t4 ALL NULL NULL NULL NULL 3 Using where; Using filesort
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
Warnings:
-Note 1003 (select high_priority test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.b = (select test.t3.a AS `a` from test.t3 order by test.t3.a desc limit 1))) union (select test.t4.a AS `a`,test.t4.b AS `b` from test.t4 where (test.t4.b = (select (max(test.t2.a) * 4) AS `max(t2.a)*4` from test.t2)) order by test.t4.a)
+Note 1003 (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.b = (select test.t3.a AS `a` from test.t3 order by test.t3.a desc limit 1))) union (select test.t4.a AS `a`,test.t4.b AS `b` from test.t4 where (test.t4.b = (select (max(test.t2.a) * 4) AS `max(t2.a)*4` from test.t2)) order by test.t4.a)
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
3 1
@@ -199,7 +199,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort
Warnings:
-Note 1003 select high_priority (select test.t3.a AS `a` from test.t3 where (test.t3.a < 8) order by test.t3.a desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,tt.a AS `a` from (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a > 1)) tt
+Note 1003 select (select test.t3.a AS `a` from test.t3 where (test.t3.a < 8) order by test.t3.a desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,tt.a AS `a` from (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a > 1)) tt
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
a
2
@@ -220,7 +220,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where
Warnings:
Note 1276 Field or reference 't4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select high_priority test.t4.b AS `b`,(select avg((test.t2.a + (select min(test.t3.a) AS `min(t3.a)` from test.t3 where (test.t3.a >= test.t4.a)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from test.t2) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from test.t4
+Note 1003 select test.t4.b AS `b`,(select avg((test.t2.a + (select min(test.t3.a) AS `min(t3.a)` from test.t3 where (test.t3.a >= test.t4.a)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from test.t2) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from test.t4
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -266,7 +266,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority test.t3.a AS `a` from test.t3 where (test.t3.a >= (select min(test.t2.b) from test.t2))
+Note 1003 select test.t3.a AS `a` from test.t3 where (test.t3.a >= (select min(test.t2.b) from test.t2))
select * from t3 where a >= all (select b from t2);
a
7
@@ -309,7 +309,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1276 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select high_priority (select test.t1.a AS `a` from test.t1 where (test.t1.a = test.t2.a) union select test.t5.a AS `a` from test.t5 where (test.t5.a = test.t2.a)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,test.t2.a AS `a` from test.t2
+Note 1003 select (select test.t1.a AS `a` from test.t1 where (test.t1.a = test.t2.a) union select test.t5.a AS `a` from test.t5 where (test.t5.a = test.t2.a)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,test.t2.a AS `a` from test.t2
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -327,7 +327,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1
Warnings:
Note 1276 Field or reference 'clinic_uq' of SELECT #2 was resolved in SELECT #1
-Note 1003 select high_priority test.t6.patient_uq AS `patient_uq`,test.t6.clinic_uq AS `clinic_uq` from test.t6 where exists(select test.t7.uq AS `uq`,test.t7.name AS `name` from test.t7 where (test.t7.uq = test.t6.clinic_uq))
+Note 1003 select test.t6.patient_uq AS `patient_uq`,test.t6.clinic_uq AS `clinic_uq` from test.t6 where exists(select test.t7.uq AS `uq`,test.t7.name AS `name` from test.t7 where (test.t7.uq = test.t6.clinic_uq))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column: 'a' in field list is ambiguous
drop table if exists t1,t2,t3;
@@ -362,7 +362,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t8 const PRIMARY PRIMARY 35 const 1
3 SUBQUERY t8 const PRIMARY PRIMARY 35 1 Using index
Warnings:
-Note 1003 select high_priority test.t8.pseudo AS `pseudo`,(select test.t8.email AS `email` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))
+Note 1003 select test.t8.pseudo AS `pseudo`,(select test.t8.email AS `email` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
@@ -388,13 +388,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 41 NULL 2 Using where; Using index
Warnings:
-Note 1003 select high_priority distinct test.t1.date AS `date` from test.t1 where (test.t1.date = 20020803)
+Note 1003 select distinct test.t1.date AS `date` from test.t1 where (test.t1.date = 20020803)
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY t1 index NULL PRIMARY 41 NULL 2 Using where; Using index
Warnings:
-Note 1003 select high_priority (select distinct test.t1.date AS `date` from test.t1 where (test.t1.date = 20020803)) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
+Note 1003 select (select distinct test.t1.date AS `date` from test.t1 where (test.t1.date = 20020803)) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
date
2002-08-03
@@ -414,7 +414,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority 1 AS `1` from test.t1
+Note 1003 select 1 AS `1` from test.t1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -534,13 +534,13 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select high_priority max(test.t1.numreponse) AS `MAX(numreponse)` from test.t1 where (test.t1.numeropost = _latin1'1')
+Note 1003 select max(test.t1.numreponse) AS `MAX(numreponse)` from test.t1 where (test.t1.numeropost = _latin1'1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select high_priority test.t1.numreponse AS `numreponse` from test.t1 where ((test.t1.numeropost = _latin1'1') and (test.t1.numreponse = 3))
+Note 1003 select test.t1.numreponse AS `numreponse` from test.t1 where ((test.t1.numeropost = _latin1'1') and (test.t1.numreponse = 3))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -708,7 +708,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ref id id 5 const 1 Using where; Using index
Warnings:
Note 1249 Select 2 was reduced during optimisation
-Note 1003 select high_priority test.t2.id AS `id` from test.t2 where (test.t2.id = 1)
+Note 1003 select test.t2.id AS `id` from test.t2 where (test.t2.id = 1)
SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id
1
@@ -721,14 +721,14 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1249 Select 3 was reduced during optimisation
Note 1249 Select 2 was reduced during optimisation
-Note 1003 select high_priority test.t2.id AS `id` from test.t2 where (test.t2.id = (1 + 1))
+Note 1003 select test.t2.id AS `id` from test.t2 where (test.t2.id = (1 + 1))
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL id 5 NULL 2 Using where; Using index
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority test.t2.id AS `id` from test.t2 where <in_optimizer>(test.t2.id,<exists>(select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(1)) union select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(3))))
+Note 1003 select test.t2.id AS `id` from test.t2 where <in_optimizer>(test.t2.id,<exists>(select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(1)) union select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(3))))
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
id
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
@@ -854,7 +854,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1276 Field or reference 'a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimisation
-Note 1003 select high_priority (test.t1.a + 1) AS `(select a+1)` from test.t1
+Note 1003 select (test.t1.a + 1) AS `(select a+1)` from test.t1
select (select a+1) from t1;
(select a+1)
2.5
@@ -876,7 +876,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 Using index
2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 Using index
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(<index_lookup>(<cache>(test.t1.a) in t2 on a chicking NULL))) AS `t1.a in (select t2.a from t2)` from test.t1
+Note 1003 select test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(<index_lookup>(<cache>(test.t1.a) in t2 on a chicking NULL))) AS `t1.a in (select t2.a from t2)` from test.t1
CREATE TABLE t3 (a int(11) default '0');
INSERT INTO t3 VALUES (1),(2),(3);
SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
@@ -891,7 +891,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 Using where; Using index
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(select 1 AS `Not_used` from test.t2 join test.t3 where ((test.t3.a = test.t2.a) and ((<cache>(test.t1.a) = test.t2.a) or isnull(test.t2.a))) having <is_not_null_test>(test.t2.a))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from test.t1
+Note 1003 select test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(select 1 AS `Not_used` from test.t2 join test.t3 where ((test.t3.a = test.t2.a) and ((<cache>(test.t1.a) = test.t2.a) or isnull(test.t2.a))) having <is_not_null_test>(test.t2.a))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from test.t1
drop table t1,t2,t3;
create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1);
@@ -1001,19 +1001,19 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
Warnings:
-Note 1003 select high_priority no_cache (select no_cache rand() AS `RAND()` from test.t1) AS `(SELECT RAND() FROM t1)` from test.t1
+Note 1003 select sql_no_cache (select sql_no_cache rand() AS `RAND()` from test.t1) AS `(SELECT RAND() FROM t1)` from test.t1
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
Warnings:
-Note 1003 select high_priority no_cache (select no_cache ecrypt(_latin1'test') AS `ENCRYPT('test')` from test.t1) AS `(SELECT ENCRYPT('test') FROM t1)` from test.t1
+Note 1003 select sql_no_cache (select sql_no_cache ecrypt(_latin1'test') AS `ENCRYPT('test')` from test.t1) AS `(SELECT ENCRYPT('test') FROM t1)` from test.t1
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
Warnings:
-Note 1003 select high_priority no_cache (select no_cache benchmark(1,1) AS `BENCHMARK(1,1)` from test.t1) AS `(SELECT BENCHMARK(1,1) FROM t1)` from test.t1
+Note 1003 select sql_no_cache (select sql_no_cache benchmark(1,1) AS `BENCHMARK(1,1)` from test.t1) AS `(SELECT BENCHMARK(1,1) FROM t1)` from test.t1
drop table t1;
CREATE TABLE `t1` (
`mot` varchar(30) character set latin1 NOT NULL default '',
@@ -1108,7 +1108,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3
3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority no_cache test.t1.a AS `a`,(select no_cache (select no_cache rand() AS `rand()` from test.t1 limit 1) AS `(select rand() from t1 limit 1)` from test.t1 limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from test.t1
+Note 1003 select sql_no_cache test.t1.a AS `a`,(select sql_no_cache (select sql_no_cache rand() AS `rand()` from test.t1 limit 1) AS `(select rand() from t1 limit 1)` from test.t1 limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from test.t1
drop table t1;
select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
ERROR 42S02: Table 'test.t1' doesn't exist
@@ -1162,7 +1162,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
-Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 0 IN (SELECT 1 FROM t1 a);
0 IN (SELECT 1 FROM t1 a)
@@ -1172,7 +1172,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
-Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
drop table t1;
CREATE TABLE `t1` (
`i` int(11) NOT NULL default '0',
@@ -1216,7 +1216,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ref salary salary 5 const 1 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select high_priority test.t1.id AS `id` from test.t1 where (test.t1.salary = (select max(test.t1.salary) AS `MAX(salary)` from test.t1))
+Note 1003 select test.t1.id AS `id` from test.t1 where (test.t1.salary = (select max(test.t1.salary) AS `MAX(salary)` from test.t1))
drop table t1;
CREATE TABLE t1 (
ID int(10) unsigned NOT NULL auto_increment,
@@ -1283,7 +1283,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<primary_index_lookup>(<cache>(test.t2.a) in t1 on PRIMARY)))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<primary_index_lookup>(<cache>(test.t2.a) in t1 on PRIMARY)))
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1293,7 +1293,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<primary_index_lookup>(<cache>(test.t2.a) in t1 on PRIMARY where (test.t1.b <> 30))))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<primary_index_lookup>(<cache>(test.t2.a) in t1 on PRIMARY where (test.t1.b <> 30))))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1304,7 +1304,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 Using where
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where; Using index
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
drop table t1, t2, t3;
create table t1 (a int, b int, index a (a,b));
create table t2 (a int, index a (a));
@@ -1322,7 +1322,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a)))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a)))
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1332,7 +1332,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a where (test.t1.b <> 30))))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a where (test.t1.b <> 30))))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1343,7 +1343,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 Using where; Using index
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using where; Using index
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
insert into t1 values (3,31);
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
@@ -1359,7 +1359,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a where (test.t1.b <> 30))))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a where (test.t1.b <> 30))))
drop table t1, t2, t3;
create table t1 (a int, b int);
create table t2 (a int, b int);
@@ -1416,7 +1416,7 @@ explain extended (select * from t1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
Warnings:
-Note 1003 (select high_priority test.t1.s1 AS `s1` from test.t1)
+Note 1003 (select test.t1.s1 AS `s1` from test.t1)
(select * from t1);
s1
tttt
@@ -1450,25 +1450,25 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
Warnings:
-Note 1003 select high_priority test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from test.t1
+Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from test.t1
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
Warnings:
-Note 1003 select high_priority test.t1.s1 AS `s1`,<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL))) AS `s1 = ANY (SELECT s1 FROM t2)` from test.t1
+Note 1003 select test.t1.s1 AS `s1`,<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL))) AS `s1 = ANY (SELECT s1 FROM t2)` from test.t1
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
Warnings:
-Note 1003 select high_priority test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from test.t1
+Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from test.t1
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 1 Using index; Using where
Warnings:
-Note 1003 select high_priority test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL where (test.t2.s1 < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from test.t1
+Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL where (test.t2.s1 < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from test.t1
drop table t1,t2;
create table t2 (a int, b int);
create table t3 (a int);
@@ -1483,7 +1483,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
Warnings:
-Note 1003 select high_priority test.t3.a AS `a` from test.t3 where <not>((test.t3.a < (select max(test.t2.b) from test.t2)))
+Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a < (select max(test.t2.b) from test.t2)))
insert into t2 values (2,2), (2,1), (3,3), (3,1);
select * from t3 where a > all (select max(b) from t2 group by a);
a
@@ -1494,7 +1494,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
Warnings:
-Note 1003 select high_priority test.t3.a AS `a` from test.t3 where <not>((test.t3.a <= <max>(select max(test.t2.b) AS `max(b)` from test.t2 group by test.t2.a)))
+Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a <= <max>(select max(test.t2.b) AS `max(b)` from test.t2 group by test.t2.a)))
drop table t2, t3;
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
@@ -1659,14 +1659,14 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 Using where
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where
Warnings:
-Note 1003 select high_priority test.t1.id AS `id`,test.t1.text AS `text` from test.t1 where not(<in_optimizer>(test.t1.id,<exists>(<primary_index_lookup>(<cache>(test.t1.id) in t1 on PRIMARY where (test.t1.id < 8)))))
+Note 1003 select test.t1.id AS `id`,test.t1.text AS `text` from test.t1 where not(<in_optimizer>(test.t1.id,<exists>(<primary_index_lookup>(<cache>(test.t1.id) in t1 on PRIMARY where (test.t1.id < 8)))))
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 Using where
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 7 Using where; Using index
Warnings:
Note 1276 Field or reference 'tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 select high_priority test.tt.id AS `id`,test.tt.text AS `text` from test.t1 tt where not(exists(select test.t1.id AS `id` from test.t1 where ((test.t1.id < 8) and ((test.t1.id = test.tt.id) or isnull(test.t1.id))) having (test.t1.id is not null)))
+Note 1003 select test.tt.id AS `id`,test.tt.text AS `text` from test.t1 tt where not(exists(select test.t1.id AS `id` from test.t1 where ((test.t1.id < 8) and ((test.t1.id = test.tt.id) or isnull(test.t1.id))) having (test.t1.id is not null)))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@@ -1692,7 +1692,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 Using where
Warnings:
-Note 1003 select high_priority test.a.id AS `id`,test.a.text AS `text`,test.b.id AS `id`,test.b.text AS `text`,test.c.id AS `id`,test.c.text AS `text` from test.t1 a left join test.t2 b on(((test.a.id = test.b.id) or isnull(test.b.id))) join test.t1 c where (if(isnull(test.b.id),1000,test.b.id) = test.c.id)
+Note 1003 select test.a.id AS `id`,test.a.text AS `text`,test.b.id AS `id`,test.b.text AS `text`,test.c.id AS `id`,test.c.text AS `text` from test.t1 a left join test.t2 b on(((test.a.id = test.b.id) or isnull(test.b.id))) join test.t1 c where (if(isnull(test.b.id),1000,test.b.id) = test.c.id)
drop table t1,t2;
create table t1 (a int);
insert into t1 values (1);
@@ -1719,3 +1719,92 @@ SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t
id c
1 1
2 0
+DROP TABLE t1,t2;
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+ALTER TABLE t1 ADD INDEX (a);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+DROP TABLE t1;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index e9861266b78..6792f2f4c2c 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -507,7 +507,7 @@ coercibility(load_file('../../std_data/words.dat'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache charset(load_file(_latin1'../../std_data/words.dat')) AS `charset(load_file('../../std_data/words.dat'))`,collation(load_file(_latin1'../../std_data/words.dat')) AS `collation(load_file('../../std_data/words.dat'))`,coercibility(load_file(_latin1'../../std_data/words.dat')) AS `coercibility(load_file('../../std_data/words.dat'))`
+Note 1003 select sql_no_cache charset(load_file(_latin1'../../std_data/words.dat')) AS `charset(load_file('../../std_data/words.dat'))`,collation(load_file(_latin1'../../std_data/words.dat')) AS `collation(load_file('../../std_data/words.dat'))`,coercibility(load_file(_latin1'../../std_data/words.dat')) AS `coercibility(load_file('../../std_data/words.dat'))`
update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
if(imagem is null, "ERROR", "OK") length(imagem)
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 71ac229601d..f044ced2342 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -70,6 +70,21 @@ select min(a) from t1;
min(a)
-0.010
drop table t1;
+create table t1 (c1 double, c2 varchar(20));
+insert t1 values (121,"16");
+select c1 + c1 * (c2 / 100) as col from t1;
+col
+140.36
+create table t2 select c1 + c1 * (c2 / 100) as col from t1;
+select * from t2;
+col
+140.36
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `col` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2;
create table t1 (a float);
insert into t1 values (1);
select max(a),min(a),avg(a) from t1;
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index bf8b8df7c65..c85b59be38c 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -87,7 +87,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort
Warnings:
-Note 1003 (select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 limit 2) union all (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 order by test.t2.a limit 1) order by b desc
+Note 1003 (select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 limit 2) union all (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 order by test.t2.a limit 1) order by b desc
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
a b
1 a
@@ -476,7 +476,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
2 UNION t2 const PRIMARY PRIMARY 4 const 1
Warnings:
-Note 1003 (select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (test.t1.a = 1)) union (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a = 1))
+Note 1003 (select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (test.t1.a = 1)) union (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a = 1))
(select * from t1 where a=5) union (select * from t2 where a=1);
a b
1 10
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index cf001158ae2..26ce91286da 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -15,7 +15,7 @@ explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const UNIQ UNIQ 8 const 1
Warnings:
-Note 1003 select high_priority test.t1.ID AS `ID`,test.t1.UNIQ AS `UNIQ` from test.t1 where (test.t1.UNIQ = 4084688022709641610)
+Note 1003 select test.t1.ID AS `ID`,test.t1.UNIQ AS `UNIQ` from test.t1 where (test.t1.UNIQ = 4084688022709641610)
drop table t1;
select x'hello';
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'x'hello'' at line 1
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index aaf977efe50..290b1fa41cf 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -26,7 +26,7 @@ explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@t1) AS `@t1`,(@t2) AS `@t2`,(@t3) AS `@t3`
+Note 1003 select sql_no_cache (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@t1) AS `@t1`,(@t2) AS `@t2`,(@t3) AS `@t3`
select @t5;
@t5
1.23456
@@ -85,7 +85,7 @@ explain extended select last_insert_id(345);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache last_insert_id(345) AS `last_insert_id(345)`
+Note 1003 select sql_no_cache last_insert_id(345) AS `last_insert_id(345)`
select @@IDENTITY,last_insert_id(), @@identity;
@@IDENTITY last_insert_id() @@identity
345 345 345
@@ -93,7 +93,7 @@ explain extended select @@IDENTITY,last_insert_id(), @@identity;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache 345 AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,345 AS `@@identity`
+Note 1003 select sql_no_cache 345 AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,345 AS `@@identity`
set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
set global concurrent_insert=ON;
show variables like 'concurrent_insert';
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index ff1803368b9..050939e5ad2 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -30,3 +30,14 @@ explain select count(*) from t1;
insert into t1 values(1);
explain select count(*) from t1;
drop table t1;
+
+#
+# Bug #3403 Wrong encoding in EXPLAIN SELECT output
+#
+set names koi8r;
+create table ÔÁÂ (ËÏÌ0 int, ËÏÌ1 int, key ÉÎÄ0 (ËÏÌ0), key ÉÎÄ01 (ËÏÌ0,ËÏÌ1));
+insert into ÔÁÂ (ËÏÌ0) values (1);
+insert into ÔÁÂ (ËÏÌ0) values (2);
+explain select ËÏÌ0 from ÔÁÂ where ËÏÌ0=1;
+drop table ÔÁÂ;
+set names latin1;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 50a3d522e3d..ac88125965a 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -63,6 +63,7 @@ select * from t1 where MATCH a,b AGAINST ('"text search" "now support"' IN BOOL
select * from t1 where MATCH a,b AGAINST ('"text search" -"now support"' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 9d99a57afe5..aede2220466 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -179,3 +179,13 @@ select group_concat(c order by (select mid(group_concat(c order by a),1,5) from
select a,c,(select group_concat(c order by a) from t2 where a=t1.a) as grp from t1 order by grp;
drop table t1,t2;
+
+#
+# group_concat of expression with GROUP BY and external GROUP BY
+#
+CREATE TABLE t1 ( a int );
+CREATE TABLE t2 ( a int );
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+SELECT GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a) FROM t1, t2 GROUP BY t1.a;
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 832541b0f86..6bd2fa0c703 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -148,3 +148,26 @@ grant usage on *.* to mysqltest_1@localhost identified by "password";
grant select, update, insert on test.* to mysqltest@localhost;
show grants for mysqltest_1@localhost;
drop user mysqltest_1@localhost;
+
+#
+# Bug #3403 Wrong encodin in SHOW GRANTS output
+#
+SET NAMES koi8r;
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ int);
+
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
+
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+
+DROP DATABASE ÂÄ;
+SET NAMES latin1;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index a260ab1263d..47e82db2dc4 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1082,8 +1082,28 @@ create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),cons
show create table t2;
drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
+show create table t2;
+alter table t2 add index id_test (id), add index id_test2 (id,id2);
+show create table t2;
+drop table t2;
+
# Test error handling
--error 1005
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
-drop table t1;
+# bug#3749
+
+create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+drop table t2;
+create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+drop table t2, t1;
+
+
+
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 9ae9c1b5e12..465920deaed 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -80,6 +80,16 @@ select distinct i from t1 order by mod(i,2),i;
drop table t1;
#
+# bug#3681
+#
+
+create table t1 ( pk int primary key, name varchar(255) not null, number varchar(255) not null);
+insert into t1 values (1, 'Gamma', '123'), (2, 'Gamma Ext', '123a'), (3, 'Alpha', '001'), (4, 'Beta', '200c');
+select distinct t1.name as 'Building Name',t1.number as 'Building Number' from t1 order by t1.name asc;
+drop table t1;
+
+
+#
# Order by on first index part
#
diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test
index 38e0d1bff6c..b0119526deb 100644
--- a/mysql-test/t/rpl000015.test
+++ b/mysql-test/t/rpl000015.test
@@ -12,7 +12,7 @@ show slave status;
change master to master_host='127.0.0.1';
# The following needs to be cleaned up when change master is fixed
---replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT
--replace_column 1 # 33 #
show slave status;
--replace_result $MASTER_MYPORT MASTER_PORT
diff --git a/mysql-test/t/rpl_error_ignored_table.test b/mysql-test/t/rpl_error_ignored_table.test
index 4e4e79adf67..0062a67ff1a 100644
--- a/mysql-test/t/rpl_error_ignored_table.test
+++ b/mysql-test/t/rpl_error_ignored_table.test
@@ -14,7 +14,7 @@ connection slave;
sync_with_master;
# The port number is different when doing the release build with
# Do-compile, hence we have to replace the port number here accordingly
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
# check that the table has been ignored, because otherwise the test is nonsense
diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test
index 7ae0a4dc3c2..8fdccdd068d 100644
--- a/mysql-test/t/rpl_log.test
+++ b/mysql-test/t/rpl_log.test
@@ -89,11 +89,11 @@ connection slave;
start slave;
sync_with_master;
show binary logs;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
+--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
show binlog events in 'slave-bin.000001' from 4;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
+--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
show binlog events in 'slave-bin.000002' from 4;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test
index 2e54c98c014..a40736577c8 100644
--- a/mysql-test/t/rpl_log_pos.test
+++ b/mysql-test/t/rpl_log_pos.test
@@ -4,7 +4,7 @@
source include/master-slave.inc;
show master status;
sync_slave_with_master;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
stop slave;
@@ -14,19 +14,19 @@ sleep 5;
stop slave;
change master to master_log_pos=73;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
start slave;
sleep 5;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
stop slave;
change master to master_log_pos=173;
start slave;
sleep 2;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
connection master;
diff --git a/mysql-test/t/rpl_max_relay_size.test b/mysql-test/t/rpl_max_relay_size.test
index a28aed52ec8..cbcc115a942 100644
--- a/mysql-test/t/rpl_max_relay_size.test
+++ b/mysql-test/t/rpl_max_relay_size.test
@@ -28,7 +28,7 @@ set global max_relay_log_size=8192-1; # mapped to 4096
select @@global.max_relay_log_size;
start slave;
sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
stop slave;
@@ -37,7 +37,7 @@ set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size;
start slave;
sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
stop slave;
@@ -46,7 +46,7 @@ set global max_relay_log_size=0;
select @@global.max_relay_log_size;
start slave;
sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
@@ -57,7 +57,7 @@ reset slave;
# test of relay log rotation when the slave is stopped
# (to make sure it does not crash).
flush logs;
---replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
@@ -73,7 +73,7 @@ create table t1 (a int);
save_master_pos;
connection slave;
sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
# one more rotation, to be sure Relay_Log_Space is correctly updated
@@ -83,7 +83,7 @@ drop table t1;
save_master_pos;
connection slave;
sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index 0d447b8d1a3..da4d5f0bce1 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -31,14 +31,14 @@ system chmod 600 var/slave-data/master.info;
# init_strvar_from_file() in init_master_info()).
--error 1201
start slave;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
# CHANGE MASTER will fail because it first parses master.info before changing
# it (so when master.info is bad, people have to use RESET SLAVE first).
--error 1201
eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
reset slave;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
connection master;
reset master;
@@ -54,7 +54,7 @@ insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
sync_slave_with_master;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
select * from t1;
@@ -107,7 +107,7 @@ purge master logs before now();
show binary logs;
insert into t2 values (65);
sync_slave_with_master;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
select * from t2;
@@ -139,7 +139,7 @@ connection slave;
sync_with_master;
select * from t4;
---replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 #
show slave status;
# because of concurrent insert, the table may not be up to date
diff --git a/mysql-test/t/rpl_server_id2.test b/mysql-test/t/rpl_server_id2.test
index dc8f733b7ed..7bbac358ada 100644
--- a/mysql-test/t/rpl_server_id2.test
+++ b/mysql-test/t/rpl_server_id2.test
@@ -3,7 +3,6 @@
source include/master-slave.inc;
connection slave;
-drop table if exists t1;
create table t1 (n int);
reset master;
# replicate ourselves
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 1b5bb807b97..94389963ae6 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1125,4 +1125,36 @@ INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES (1);
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY t1.id;
-DROP TABLE t1,t2
+DROP TABLE t1,t2;
+
+#
+# ALL/ANY test
+#
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+ALTER TABLE t1 ADD INDEX (a);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+DROP TABLE t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 7d3b90aabeb..d3ddecfc314 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -31,6 +31,14 @@ select a from t1 order by a;
select min(a) from t1;
drop table t1;
+create table t1 (c1 double, c2 varchar(20));
+insert t1 values (121,"16");
+select c1 + c1 * (c2 / 100) as col from t1;
+create table t2 select c1 + c1 * (c2 / 100) as col from t1;
+select * from t2;
+show create table t2;
+drop table t1,t2;
+
# Bug #1022: When a table contains a 'float' field,
# and one of the functions MAX, MIN, or AVG is used on that field,
# the system crashes.
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index da16457c299..0f8984e6b3d 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -104,7 +104,7 @@ void bitmap_set_bit(MY_BITMAP *map, uint bitmap_bit)
{
DBUG_ASSERT(map->bitmap && bitmap_bit < map->bitmap_size*8);
bitmap_lock(map);
- map->bitmap[bitmap_bit / 8] |= (1 << (bitmap_bit & 7));
+ bitmap_fast_set_bit(map, bitmap_bit);
bitmap_unlock(map);
}
@@ -144,7 +144,7 @@ void bitmap_clear_bit(MY_BITMAP *map, uint bitmap_bit)
{
DBUG_ASSERT(map->bitmap && bitmap_bit < map->bitmap_size*8);
bitmap_lock(map);
- map->bitmap[bitmap_bit / 8] &= ~ (1 << (bitmap_bit & 7));
+ bitmap_fast_clear_bit(map, bitmap_bit);
bitmap_unlock(map);
}
@@ -220,7 +220,7 @@ my_bool bitmap_is_set_all(const MY_BITMAP *map)
my_bool bitmap_is_set(const MY_BITMAP *map, uint bitmap_bit)
{
DBUG_ASSERT(map->bitmap && bitmap_bit < map->bitmap_size*8);
- return map->bitmap[bitmap_bit / 8] & (1 << (bitmap_bit & 7));
+ return bitmap_fast_is_set(map, bitmap_bit);
}
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 3261ec309d4..da83e195943 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -224,6 +224,7 @@ $CP mysql-test/t/*test mysql-test/t/*.opt mysql-test/t/*.slave-mi mysql-test/t/*
$CP mysql-test/r/*result mysql-test/r/*.require $BASE/mysql-test/r
if [ $BASE_SYSTEM != "netware" ] ; then
+ chmod a+x $BASE/bin/*
$CP scripts/* $BASE/bin
$BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ @HOSTNAME@ \@pkgdatadir\@ ./support-files < $SOURCE/scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
$BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \@MYSQLD_USER\@ root \@localstatedir\@ /usr/local/mysql/data \@HOSTNAME\@ @HOSTNAME@ < $SOURCE/support-files/mysql.server.sh > $BASE/support-files/mysql.server
diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc
index b8ae5967475..2d17caf1a83 100644
--- a/sql/examples/ha_example.cc
+++ b/sql/examples/ha_example.cc
@@ -625,14 +625,11 @@ int ha_example::rename_table(const char * from, const char * to)
Called from opt_range.cc by check_quick_keys().
*/
-ha_rows ha_example::records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag)
+ha_rows ha_example::records_in_range(uint inx, key_range *min_key,
+ key_range *max_key)
{
- DBUG_ENTER("ha_example::records_in_range ");
- DBUG_RETURN(records);
+ DBUG_ENTER("ha_example::records_in_range");
+ DBUG_RETURN(10); // low number to force index usage
}
diff --git a/sql/field.cc b/sql/field.cc
index edaa29dbaa0..1ad7e039363 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4252,12 +4252,13 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
like in latin_de 'ae' and 0xe4
*/
return field_charset->coll->strnncollsp(field_charset,
- (const uchar*) a_ptr, field_length,
- (const uchar*) b_ptr, field_length);
+ (const uchar*) a_ptr, field_length,
+ (const uchar*) b_ptr,
+ field_length);
}
return field_charset->coll->strnncoll(field_charset,
- (const uchar*) a_ptr, field_length,
- (const uchar*) b_ptr, field_length);
+ (const uchar*) a_ptr, field_length,
+ (const uchar*) b_ptr, field_length);
}
void Field_string::sort_string(char *to,uint length)
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 593b9575fb6..4dde893116f 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -1542,7 +1542,7 @@ int ha_berkeley::index_next_same(byte * buf, const byte *key, uint keylen)
{
error=read_row(cursor->c_get(cursor, &last_key, &row, DB_NEXT),
(char*) buf, active_index, &row, &last_key, 1);
- if (!error && ::key_cmp(table, key, active_index, keylen))
+ if (!error && ::key_cmp_if_same(table, key, active_index, keylen))
error=HA_ERR_END_OF_FILE;
}
DBUG_RETURN(error);
@@ -1987,11 +1987,8 @@ double ha_berkeley::scan_time()
return rows2double(records/3);
}
-ha_rows ha_berkeley::records_in_range(int keynr,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag)
+ha_rows ha_berkeley::records_in_range(uint keynr, key_range *start_key,
+ key_range *end_key)
{
DBT key;
DB_KEY_RANGE start_range, end_range;
@@ -2000,25 +1997,27 @@ ha_rows ha_berkeley::records_in_range(int keynr,
DBUG_ENTER("records_in_range");
if ((start_key && kfile->key_range(kfile,transaction,
- pack_key(&key, keynr, key_buff, start_key,
- start_key_len),
- &start_range,0)) ||
+ pack_key(&key, keynr, key_buff,
+ start_key->key,
+ start_key->length),
+ &start_range,0)) ||
(end_key && kfile->key_range(kfile,transaction,
- pack_key(&key, keynr, key_buff, end_key,
- end_key_len),
+ pack_key(&key, keynr, key_buff,
+ end_key->key,
+ end_key->length),
&end_range,0)))
DBUG_RETURN(HA_BERKELEY_RANGE_COUNT); // Better than returning an error /* purecov: inspected */
if (!start_key)
- start_pos=0.0;
- else if (start_search_flag == HA_READ_KEY_EXACT)
+ start_pos= 0.0;
+ else if (start_key->flag == HA_READ_KEY_EXACT)
start_pos=start_range.less;
else
start_pos=start_range.less+start_range.equal;
if (!end_key)
- end_pos=1.0;
- else if (end_search_flag == HA_READ_BEFORE_KEY)
+ end_pos= 1.0;
+ else if (end_key->flag == HA_READ_BEFORE_KEY)
end_pos=end_range.less;
else
end_pos=end_range.less+end_range.equal;
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index 88af2326eac..4bc8e3a5777 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -143,12 +143,7 @@ class ha_berkeley: public handler
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
int check(THD* thd, HA_CHECK_OPT* check_opt);
- ha_rows records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
-
+ ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
int create(const char *name, register TABLE *form,
HA_CREATE_INFO *create_info);
int delete_table(const char *name);
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index 12b922e6fc0..c375614ac95 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -363,28 +363,20 @@ int ha_heap::rename_table(const char * from, const char * to)
return heap_rename(from,to);
}
-ha_rows ha_heap::records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag)
+
+ha_rows ha_heap::records_in_range(uint inx, key_range *min_key,
+ key_range *max_key)
{
- KEY *pos=table->key_info+inx;
- if (pos->algorithm == HA_KEY_ALG_BTREE)
- {
- return hp_rb_records_in_range(file, inx, start_key, start_key_len,
- start_search_flag, end_key, end_key_len,
- end_search_flag);
- }
- else
- {
- if (start_key_len != end_key_len ||
- start_key_len != pos->key_length ||
- start_search_flag != HA_READ_KEY_EXACT ||
- end_search_flag != HA_READ_AFTER_KEY)
- return HA_POS_ERROR; // Can't only use exact keys
- return 10; // Good guess
- }
+ KEY *key=table->key_info+inx;
+ if (key->algorithm == HA_KEY_ALG_BTREE)
+ return hp_rb_records_in_range(file, inx, min_key, max_key);
+
+ if (min_key->length != max_key->length ||
+ min_key->length != key->key_length ||
+ min_key->flag != HA_READ_KEY_EXACT ||
+ max_key->flag != HA_READ_AFTER_KEY)
+ return HA_POS_ERROR; // Can only use exact keys
+ return 10; // Good guess
}
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index 2f849d2574b..f55eda91149 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -86,10 +86,7 @@ class ha_heap: public handler
int disable_indexes(uint mode);
int enable_indexes(uint mode);
int indexes_are_disabled(void);
- ha_rows records_in_range(int inx, const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
+ ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
int delete_table(const char *from);
int rename_table(const char * from, const char * to);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 201ec8f183f..8a40af90541 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -325,6 +325,35 @@ convert_error_code_to_mysql(
}
/*****************************************************************
+If you want to print a thd that is not associated with the current thread,
+you must call this function before reserving the InnoDB kernel_mutex, to
+protect MySQL from setting thd->query NULL. If you print a thd of the current
+thread, we know that MySQL cannot modify thd->query, and it is not necessary
+to call this. Call innobase_mysql_end_print_arbitrary_thd() after you release
+the kernel_mutex.
+NOTE that /mysql/innobase/lock/lock0lock.c must contain the prototype for this
+function! */
+extern "C"
+void
+innobase_mysql_prepare_print_arbitrary_thd(void)
+/*============================================*/
+{
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
+}
+
+/*****************************************************************
+Relases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd().
+NOTE that /mysql/innobase/lock/lock0lock.c must contain the prototype for this
+function! */
+extern "C"
+void
+innobase_mysql_end_print_arbitrary_thd(void)
+/*========================================*/
+{
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
+}
+
+/*****************************************************************
Prints info of a THD object (== user session thread) to the
standard output. NOTE that /mysql/innobase/trx/trx0trx.c must contain
the prototype for this function! */
@@ -335,9 +364,11 @@ innobase_mysql_print_thd(
FILE* f, /* in: output stream */
void* input_thd)/* in: pointer to a MySQL THD object */
{
- THD* thd;
+ const THD* thd;
+ const char* s;
+ char buf[301];
- thd = (THD*) input_thd;
+ thd = (const THD*) input_thd;
fprintf(f, "MySQL thread id %lu, query id %lu",
thd->thread_id, thd->query_id);
@@ -356,14 +387,31 @@ innobase_mysql_print_thd(
fputs(thd->user, f);
}
- if (thd->proc_info) {
+ if ((s = thd->proc_info)) {
putc(' ', f);
- fputs(thd->proc_info, f);
+ fputs(s, f);
}
- if (thd->query) {
- putc(' ', f);
- fputs(thd->query, f);
+ if ((s = thd->query)) {
+ /* determine the length of the query string */
+ uint32 i, len;
+
+ len = thd->query_length;
+
+ if (len > 300) {
+ len = 300; /* ADDITIONAL SAFETY: print at most
+ 300 chars to reduce the probability of
+ a seg fault if there is a race in
+ thd->query_length in MySQL; after
+ May 14, 2004 probably no race any more,
+ but better be safe */
+ }
+
+ /* Use strmake to reduce the timeframe
+ for a race, compared to fwrite() */
+ i= (uint) (strmake(buf, s, len) - buf);
+ putc('\n', f);
+ fwrite(buf, 1, i, f);
}
putc('\n', f);
@@ -3925,18 +3973,11 @@ ha_innobase::records_in_range(
/*==========================*/
/* out: estimated number of
rows */
- int keynr, /* in: index number */
- const mysql_byte* start_key, /* in: start key value of the
- range, may also be empty */
- uint start_key_len, /* in: start key val len, may
- also be 0 */
- enum ha_rkey_function start_search_flag,/* in: start search condition
- e.g., 'greater than' */
- const mysql_byte* end_key, /* in: range end key val, may
- also be empty */
- uint end_key_len, /* in: range end key val len,
- may also be 0 */
- enum ha_rkey_function end_search_flag)/* in: range end search cond */
+ uint keynr, /* in: index number */
+ key_range *min_key, /* in: start key value of the
+ range, may also be 0 */
+ key_range *max_key) /* in: range end key val, may
+ also be 0 */
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
KEY* key;
@@ -3957,12 +3998,6 @@ ha_innobase::records_in_range(
DBUG_ENTER("records_in_range");
- /* We do not know if MySQL can call this function before calling
- external_lock(). To be safe, update the thd of the current table
- handle. */
-
- update_thd(current_thd);
-
prebuilt->trx->op_info = (char*)"estimating records in index range";
/* In case MySQL calls this in the middle of a SELECT query, release
@@ -3986,17 +4021,21 @@ ha_innobase::records_in_range(
range_start, (byte*) key_val_buff,
(ulint)upd_and_key_val_buff_len,
index,
- (byte*) start_key,
- (ulint) start_key_len);
+ (byte*) (min_key ? min_key->key :
+ (const mysql_byte*) 0),
+ (ulint) (min_key ? min_key->length : 0));
row_sel_convert_mysql_key_to_innobase(
range_end, (byte*) key_val_buff2,
buff2_len, index,
- (byte*) end_key,
- (ulint) end_key_len);
-
- mode1 = convert_search_mode_to_innobase(start_search_flag);
- mode2 = convert_search_mode_to_innobase(end_search_flag);
+ (byte*) (max_key ? max_key->key :
+ (const mysql_byte*) 0),
+ (ulint) (max_key ? max_key->length : 0));
+
+ mode1 = convert_search_mode_to_innobase(min_key ? min_key->flag :
+ HA_READ_KEY_EXACT);
+ mode2 = convert_search_mode_to_innobase(max_key ? max_key->flag :
+ HA_READ_KEY_EXACT);
n_rows = btr_estimate_n_rows_in_range(index, range_start,
mode1, range_end, mode2);
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index 83a3edc4126..c585fd9c463 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -166,11 +166,7 @@ class ha_innobase: public handler
int start_stmt(THD *thd);
void position(byte *record);
- ha_rows records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
+ ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
ha_rows estimate_number_of_rows();
int create(const char *name, register TABLE *form,
diff --git a/sql/ha_isam.cc b/sql/ha_isam.cc
index 09c2aeceafc..85ab25a31d9 100644
--- a/sql/ha_isam.cc
+++ b/sql/ha_isam.cc
@@ -382,18 +382,21 @@ int ha_isam::create(const char *name, register TABLE *form,
}
+static key_range no_range= { (byte*) 0, 0, HA_READ_KEY_EXACT };
-ha_rows ha_isam::records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag)
+ha_rows ha_isam::records_in_range(uint inx, key_range *min_key,
+ key_range *max_key)
{
+ /* ISAM checks if 'key' pointer <> 0 to know if there is no range */
+ if (!min_key)
+ min_key= &no_range;
+ if (!max_key)
+ max_key= &no_range;
return (ha_rows) nisam_records_in_range(file,
- inx,
- start_key,start_key_len,
- start_search_flag,
- end_key,end_key_len,
- end_search_flag);
+ (int) inx,
+ min_key->key, min_key->length,
+ min_key->flag,
+ max_key->key, max_key->length,
+ max_key->flag);
}
#endif /* HAVE_ISAM */
diff --git a/sql/ha_isam.h b/sql/ha_isam.h
index 2c8ec274145..8a887ababde 100644
--- a/sql/ha_isam.h
+++ b/sql/ha_isam.h
@@ -70,11 +70,7 @@ class ha_isam: public handler
void info(uint);
int extra(enum ha_extra_function operation);
int external_lock(THD *thd, int lock_type);
- ha_rows records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
+ ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 1b24633953d..feac5c51dce 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -1515,19 +1515,15 @@ longlong ha_myisam::get_auto_increment()
SYNOPSIS
records_in_range()
inx Index to use
- start_key Start of range. Null pointer if from first key
- start_key_len Length of start key
- start_search_flag Flag if start key should be included or not
- end_key End of range. Null pointer if to last key
- end_key_len Length of end key
- end_search_flag Flag if start key should be included or not
+ min_key Start of range. Null pointer if from first key
+ max_key End of range. Null pointer if to last key
NOTES
- start_search_flag can have one of the following values:
+ min_key.flag can have one of the following values:
HA_READ_KEY_EXACT Include the key in the range
HA_READ_AFTER_KEY Don't include key in range
- end_search_flag can have one of the following values:
+ max_key.flag can have one of the following values:
HA_READ_BEFORE_KEY Don't include key in range
HA_READ_AFTER_KEY Include all 'end_key' values in the range
@@ -1538,18 +1534,10 @@ longlong ha_myisam::get_auto_increment()
the range.
*/
-ha_rows ha_myisam::records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag)
+ha_rows ha_myisam::records_in_range(uint inx, key_range *min_key,
+ key_range *max_key)
{
- return (ha_rows) mi_records_in_range(file,
- inx,
- start_key,start_key_len,
- start_search_flag,
- end_key,end_key_len,
- end_search_flag);
+ return (ha_rows) mi_records_in_range(file, (int) inx, min_key, max_key);
}
diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h
index 206a1c62a2f..77887220903 100644
--- a/sql/ha_myisam.h
+++ b/sql/ha_myisam.h
@@ -110,11 +110,7 @@ class ha_myisam: public handler
int indexes_are_disabled(void);
void start_bulk_insert(ha_rows rows);
int end_bulk_insert();
- ha_rows records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
+ ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
void update_create_info(HA_CREATE_INFO *create_info);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index 041d9eaead3..9aa6d039efb 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -199,20 +199,14 @@ void ha_myisammrg::position(const byte *record)
ha_store_ptr(ref, ref_length, (my_off_t) position);
}
-ha_rows ha_myisammrg::records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag)
+
+ha_rows ha_myisammrg::records_in_range(uint inx, key_range *min_key,
+ key_range *max_key)
{
- return (ha_rows) myrg_records_in_range(file,
- inx,
- start_key,start_key_len,
- start_search_flag,
- end_key,end_key_len,
- end_search_flag);
+ return (ha_rows) myrg_records_in_range(file, (int) inx, min_key, max_key);
}
+
void ha_myisammrg::info(uint flag)
{
MYMERGE_INFO info;
diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h
index c0f81a77a1e..fd36c78202d 100644
--- a/sql/ha_myisammrg.h
+++ b/sql/ha_myisammrg.h
@@ -70,11 +70,7 @@ class ha_myisammrg: public handler
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
void position(const byte *record);
- ha_rows records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
+ ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
my_off_t row_position() { return myrg_position(file); }
void info(uint);
int extra(enum ha_extra_function operation);
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 3bc322878d1..21056ef4a8f 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -2748,22 +2748,19 @@ void ha_ndbcluster::set_dbname(const char *path_name)
ha_rows
-ha_ndbcluster::records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag)
-{
- ha_rows records= 10;
- KEY* key_info= table->key_info + inx;
+ha_ndbcluster::records_in_range(uint inx, key_range *min_key,
+ key_range *max_key)
+{
+ ha_rows records= 10; /* Good guess when you don't know anything */
+ KEY *key_info= table->key_info + inx;
uint key_length= key_info->key_length;
DBUG_ENTER("records_in_range");
- DBUG_PRINT("enter", ("inx: %d", inx));
- DBUG_PRINT("enter", ("start_key: %x, start_key_len: %d", start_key, start_key_len));
- DBUG_PRINT("enter", ("start_search_flag: %d", start_search_flag));
- DBUG_PRINT("enter", ("end_key: %x, end_key_len: %d", end_key, end_key_len));
- DBUG_PRINT("enter", ("end_search_flag: %d", end_search_flag));
+ DBUG_PRINT("enter", ("inx: %u", inx));
+ DBUG_DUMP("start_key", min_key->key, min_key->length);
+ DBUG_DUMP("end_key", max_key->key, max_key->length);
+ DBUG_PRINT("enter", ("start_search_flag: %u end_search_flag: %u",
+ min_key->flag, max_key->flag));
/*
Check that start_key_len is equal to
@@ -2772,7 +2769,7 @@ ha_ndbcluster::records_in_range(int inx,
*/
NDB_INDEX_TYPE idx_type= get_index_type(inx);
if ((idx_type == UNIQUE_INDEX || idx_type == PRIMARY_KEY_INDEX) &&
- start_key_len < key_length)
+ min_key->length < key_length)
{
DBUG_PRINT("warning", ("Tried to use index which required"
"full key length: %d, HA_POS_ERROR",
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index bd601f39fc4..029ebc11e46 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -121,12 +121,7 @@ class ha_ndbcluster: public handler
}
double scan_time();
- ha_rows records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
-
+ ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
static Ndb* seize_ndb();
static void release_ndb(Ndb* ndb);
diff --git a/sql/handler.cc b/sql/handler.cc
index 7374242ebf8..f8eca1b93ef 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1184,7 +1184,7 @@ int handler::index_next_same(byte *buf, const byte *key, uint keylen)
int error;
if (!(error=index_next(buf)))
{
- if (key_cmp(table, key, active_index, keylen))
+ if (key_cmp_if_same(table, key, active_index, keylen))
{
table->status=STATUS_NOT_FOUND;
error=HA_ERR_END_OF_FILE;
@@ -1388,6 +1388,7 @@ int ha_discover(const char* dbname, const char* name,
read_range_first()
start_key Start key. Is 0 if no min range
end_key End key. Is 0 if no max range
+ eq_range_arg Set to 1 if start_key == end_key
sorted Set to 1 if result should be sorted per key
NOTES
@@ -1401,11 +1402,12 @@ int ha_discover(const char* dbname, const char* name,
int handler::read_range_first(const key_range *start_key,
const key_range *end_key,
- bool sorted)
+ bool eq_range_arg, bool sorted)
{
int result;
DBUG_ENTER("handler::read_range_first");
+ eq_range= eq_range_arg;
end_range= 0;
if (end_key)
{
@@ -1416,7 +1418,6 @@ int handler::read_range_first(const key_range *start_key,
}
range_key_part= table->key_info[active_index].key_part;
-
if (!start_key) // Read first record
result= index_first(table->record[0]);
else
@@ -1438,7 +1439,6 @@ int handler::read_range_first(const key_range *start_key,
SYNOPSIS
read_range_next()
- eq_range Set to 1 if start_key == end_key
NOTES
Record is read into table->record[0]
@@ -1449,17 +1449,19 @@ int handler::read_range_first(const key_range *start_key,
# Error code
*/
-int handler::read_range_next(bool eq_range)
+int handler::read_range_next()
{
int result;
DBUG_ENTER("handler::read_range_next");
if (eq_range)
- result= index_next_same(table->record[0],
- end_range->key,
- end_range->length);
- else
- result= index_next(table->record[0]);
+ {
+ /* We trust that index_next_same always gives a row in range */
+ DBUG_RETURN(index_next_same(table->record[0],
+ end_range->key,
+ end_range->length));
+ }
+ result= index_next(table->record[0]);
if (result)
DBUG_RETURN(result);
DBUG_RETURN(compare_key(end_range) <= 0 ? 0 : HA_ERR_END_OF_FILE);
@@ -1467,16 +1469,18 @@ int handler::read_range_next(bool eq_range)
/*
- Compare if found key is over max-value
+ Compare if found key (in row) is over max-value
SYNOPSIS
compare_key
- range key to compare to row
+ range range to compare to row. May be 0 for no range
NOTES
- For this to work, the row must be stored in table->record[0]
+ See key.cc::key_cmp() for details
RETURN
+ The return value is SIGN(key_in_row - range_key):
+
0 Key is equal to range or 'range' == 0 (no range)
-1 Key is less than range
1 Key is larger than range
@@ -1484,37 +1488,11 @@ int handler::read_range_next(bool eq_range)
int handler::compare_key(key_range *range)
{
- KEY_PART_INFO *key_part= range_key_part;
- uint store_length;
-
+ int cmp;
if (!range)
return 0; // No max range
-
- for (const char *key= (const char*) range->key, *end=key+range->length;
- key < end;
- key+= store_length, key_part++)
- {
- int cmp;
- store_length= key_part->store_length;
- if (key_part->null_bit)
- {
- if (*key)
- {
- if (!key_part->field->is_null())
- return 1;
- continue;
- }
- else if (key_part->field->is_null())
- return 0;
- key++; // Skip null byte
- store_length--;
- }
- if ((cmp=key_part->field->key_cmp((byte*) key, key_part->length)) < 0)
- return -1;
- if (cmp > 0)
- return 1;
- }
- return key_compare_result_on_equal;
+ cmp= key_cmp(range_key_part, range->key, range->length);
+ if (!cmp)
+ cmp= key_compare_result_on_equal;
+ return cmp;
}
-
-
diff --git a/sql/handler.h b/sql/handler.h
index 4f721a01412..bbeefa7c916 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -234,14 +234,6 @@ typedef struct st_ha_check_opt
} HA_CHECK_OPT;
-typedef struct st_key_range
-{
- const byte *key;
- uint length;
- enum ha_rkey_function flag;
-} key_range;
-
-
class handler :public Sql_alloc
{
protected:
@@ -268,6 +260,7 @@ public:
key_range save_end_range, *end_range;
KEY_PART_INFO *range_key_part;
int key_compare_result_on_equal;
+ bool eq_range;
uint errkey; /* Last dup key */
uint sortkey, key_used_on_scan;
@@ -330,13 +323,14 @@ public:
return (my_errno=HA_ERR_WRONG_COMMAND);
}
virtual int read_range_first(const key_range *start_key,
- const key_range *end_key,
- bool sorted);
- virtual int read_range_next(bool eq_range);
+ const key_range *end_key,
+ bool eq_range, bool sorted);
+ virtual int read_range_next();
int compare_key(key_range *range);
virtual int ft_init()
{ return -1; }
- virtual FT_INFO *ft_init_ext(uint flags,uint inx,const byte *key, uint keylen)
+ virtual FT_INFO *ft_init_ext(uint flags,uint inx,const byte *key,
+ uint keylen)
{ return NULL; }
virtual int ft_read(byte *buf) { return -1; }
virtual int rnd_init(bool scan=1)=0;
@@ -345,11 +339,8 @@ public:
virtual int rnd_pos(byte * buf, byte *pos)=0;
virtual int read_first_row(byte *buf, uint primary_key);
virtual int restart_rnd_next(byte *buf, byte *pos);
- virtual ha_rows records_in_range(int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag)
+ virtual ha_rows records_in_range(uint inx, key_range *min_key,
+ key_range *max_key)
{ return (ha_rows) 10; }
virtual void position(const byte *record)=0;
virtual my_off_t row_position() { return HA_OFFSET_ERROR; }
diff --git a/sql/item_func.cc b/sql/item_func.cc
index aaea676fee1..f221e0dcc5c 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -612,6 +612,7 @@ longlong Item_func_div::val_int()
void Item_func_div::fix_length_and_dec()
{
decimals=max(args[0]->decimals,args[1]->decimals)+2;
+ set_if_smaller(decimals, NOT_FIXED_DEC);
max_length=args[0]->max_length - args[0]->decimals + decimals;
uint tmp=float_length(decimals);
set_if_smaller(max_length,tmp);
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 2d10be62d53..4503c1b63a9 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -56,10 +56,24 @@ void Item_subselect::init(st_select_lex *select_lex,
DBUG_PRINT("subs", ("select_lex 0x%xl", (ulong) select_lex));
unit= select_lex->master_unit();
- if (select_lex->next_select())
- engine= new subselect_union_engine(unit, result, this);
+ if (unit->item)
+ {
+ /*
+ Item can be changed in JOIN::prepare while engine in JOIN::optimize
+ => we do not copy old_engine here
+ */
+ engine= unit->item->engine;
+ unit->item->engine= 0;
+ unit->item= this;
+ engine->change_item(this, result);
+ }
else
- engine= new subselect_single_select_engine(select_lex, result, this);
+ {
+ if (select_lex->next_select())
+ engine= new subselect_union_engine(unit, result, this);
+ else
+ engine= new subselect_single_select_engine(select_lex, result, this);
+ }
DBUG_VOID_RETURN;
}
@@ -69,11 +83,13 @@ void Item_subselect::cleanup()
Item_result_field::cleanup();
if (old_engine)
{
- engine->cleanup();
+ if (engine)
+ engine->cleanup();
engine= old_engine;
old_engine= 0;
}
- engine->cleanup();
+ if (engine)
+ engine->cleanup();
reset();
value_assigned= 0;
DBUG_VOID_RETURN;
@@ -127,7 +143,6 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
if (have_to_be_excluded)
engine->exclude();
substitution= 0;
- fixed= 1;
thd->where= "checking transformed subquery";
if (!(*ref)->fixed)
ret= (*ref)->fix_fields(thd, tables, ref);
@@ -660,10 +675,20 @@ Item_in_subselect::single_value_transformer(JOIN *join,
item= new Item_sum_min(*select_lex->ref_pointer_array);
}
*select_lex->ref_pointer_array= item;
- select_lex->item_list.empty();
- select_lex->item_list.push_back(item);
+ {
+ List_iterator<Item> it(select_lex->item_list);
+ it++;
+ it.replace(item);
+ }
- // fix_fields call for 'item' will be made during new subquery fix_fields
+ /*
+ Item_sum_(max|min) can't substitute other item => we can use 0 as
+ reference
+ */
+ if (item->fix_fields(thd, join->tables_list, 0))
+ goto err;
+ /* we added aggregate function => we have to change statistic */
+ count_field_types(&join->tmp_table_param, join->all_fields, 0);
subs= new Item_singlerow_subselect(select_lex);
}
@@ -1428,3 +1453,67 @@ void subselect_indexsubquery_engine::print(String *str)
}
str->append(')');
}
+
+/*
+ change select_result object of engine
+
+ SINOPSYS
+ subselect_single_select_engine::change_result()
+ si new subselect Item
+ res new select_result object
+
+ RETURN
+ 0 OK
+ -1 error
+*/
+
+int subselect_single_select_engine::change_item(Item_subselect *si,
+ select_subselect *res)
+{
+ item= si;
+ result= res;
+ return select_lex->join->change_result(result);
+}
+
+
+/*
+ change select_result object of engine
+
+ SINOPSYS
+ subselect_single_select_engine::change_result()
+ si new subselect Item
+ res new select_result object
+
+ RETURN
+ 0 OK
+ -1 error
+*/
+
+int subselect_union_engine::change_item(Item_subselect *si,
+ select_subselect *res)
+{
+ item= si;
+ int rc= unit->change_result(res, result);
+ result= res;
+ return rc;
+}
+
+
+/*
+ change select_result emulation, never should be called
+
+ SINOPSYS
+ subselect_single_select_engine::change_result()
+ si new subselect Item
+ res new select_result object
+
+ RETURN
+ -1 error
+*/
+
+int subselect_uniquesubquery_engine::change_item(Item_subselect *si,
+ select_subselect *res)
+{
+ DBUG_ASSERT(0);
+ return -1;
+}
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 6d8f5353695..364781de362 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -290,6 +290,7 @@ public:
virtual table_map upper_select_const_tables()= 0;
static table_map calc_const_tables(TABLE_LIST *);
virtual void print(String *str)= 0;
+ virtual int change_item(Item_subselect *si, select_subselect *result)= 0;
};
@@ -313,6 +314,7 @@ public:
void exclude();
table_map upper_select_const_tables();
void print (String *str);
+ int change_item(Item_subselect *si, select_subselect *result);
};
@@ -332,6 +334,7 @@ public:
void exclude();
table_map upper_select_const_tables();
void print (String *str);
+ int change_item(Item_subselect *si, select_subselect *result);
};
@@ -360,6 +363,7 @@ public:
void exclude();
table_map upper_select_const_tables() { return 0; }
void print (String *str);
+ int change_item(Item_subselect *si, select_subselect *result);
};
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index eac8d31b256..0c5b29fc069 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -502,6 +502,14 @@ void Item_sum_variance::update_field()
/* min & max */
+void Item_sum_hybrid::clear()
+{
+ sum= 0.0;
+ sum_int= 0;
+ value.length(0);
+ null_value= 1;
+}
+
double Item_sum_hybrid::val()
{
DBUG_ASSERT(fixed == 1);
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 4cded41a9f6..ef947900fd2 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -415,13 +415,7 @@ class Item_sum_hybrid :public Item_sum
table_map used_tables() const { return used_table_cache; }
bool const_item() const { return !used_table_cache; }
- void clear()
- {
- sum=0.0;
- sum_int=0;
- value.length(0);
- null_value=1;
- }
+ void clear();
double val();
longlong val_int();
void reset_field();
diff --git a/sql/key.cc b/sql/key.cc
index a2c3b2c8989..9425a368669 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -156,9 +156,28 @@ void key_restore(TABLE *table,byte *key,uint idx,uint key_length)
} /* key_restore */
- /* Compare if a key has changed */
+/*
+ Compare if a key has changed
+
+ SYNOPSIS
+ key_cmp_if_same()
+ table TABLE
+ key key to compare to row
+ idx Index used
+ key_length Length of key
+
+ NOTES
+ In theory we could just call field->cmp() for all field types,
+ but as we are only interested if a key has changed (not if the key is
+ larger or smaller than the previous value) we can do things a bit
+ faster by using memcmp() instead.
+
+ RETURN
+ 0 If key is equal
+ 1 Key has changed
+*/
-int key_cmp(TABLE *table,const byte *key,uint idx,uint key_length)
+bool key_cmp_if_same(TABLE *table,const byte *key,uint idx,uint key_length)
{
uint length;
KEY_PART_INFO *key_part;
@@ -281,3 +300,56 @@ bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields)
return check_if_key_used(table, table->primary_key, fields);
return 0;
}
+
+
+/*
+ Compare key in row to a given key
+
+ SYNOPSIS
+ key_cmp()
+ key_part Key part handler
+ key Key to compare to value in table->record[0]
+ key_length length of 'key'
+
+ RETURN
+ The return value is SIGN(key_in_row - range_key):
+
+ 0 Key is equal to range or 'range' == 0 (no range)
+ -1 Key is less than range
+ 1 Key is larger than range
+*/
+
+int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length)
+{
+ uint store_length;
+
+ for (const byte *end=key + key_length;
+ key < end;
+ key+= store_length, key_part++)
+ {
+ int cmp;
+ store_length= key_part->store_length;
+ if (key_part->null_bit)
+ {
+ /* This key part allows null values; NULL is lower than everything */
+ register bool field_is_null= key_part->field->is_null();
+ if (*key) // If range key is null
+ {
+ /* the range is expecting a null value */
+ if (!field_is_null)
+ return 1; // Found key is > range
+ /* null -- exact match, go to next key part */
+ continue;
+ }
+ else if (field_is_null)
+ return -1; // NULL is less than any value
+ key++; // Skip null byte
+ store_length--;
+ }
+ if ((cmp=key_part->field->key_cmp((byte*) key, key_part->length)) < 0)
+ return -1;
+ if (cmp > 0)
+ return 1;
+ }
+ return 0; // Keys are equal
+}
diff --git a/sql/log_event.cc b/sql/log_event.cc
index b3ec1f0fe55..abbccb32034 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1058,6 +1058,7 @@ end:
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->db= 0; // prevent db from being freed
thd->query= 0; // just to be sure
+ thd->query_length= 0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
// assume no convert for next query unless set explictly
#ifdef TO_BE_REMOVED
@@ -1674,6 +1675,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
thd->db= (char*) rewrite_db(db);
DBUG_ASSERT(thd->query == 0);
thd->query= 0; // Should not be needed
+ thd->query_length= 0; // Should not be needed
thd->query_error= 0;
clear_all_errors(thd, rli);
if (!use_rli_only_for_errors)
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 8cae95e5070..14bd16332ef 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -754,11 +754,12 @@ void mysql_print_status(THD *thd);
int find_ref_key(TABLE *form,Field *field, uint *offset);
void key_copy(byte *key,TABLE *form,uint index,uint key_length);
void key_restore(TABLE *form,byte *key,uint index,uint key_length);
-int key_cmp(TABLE *form,const byte *key,uint index,uint key_length);
+bool key_cmp_if_same(TABLE *form,const byte *key,uint index,uint key_length);
void key_unpack(String *to,TABLE *form,uint index);
bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields);
-bool init_errmessage(void);
+int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length);
+bool init_errmessage(void);
void sql_perror(const char *message);
void sql_print_error(const char *format,...)
__attribute__ ((format (printf, 1, 2)));
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 1e7bf90738c..3cc64c35223 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1800,8 +1800,8 @@ SEL_ARG *
SEL_ARG::insert(SEL_ARG *key)
{
SEL_ARG *element,**par,*last_element;
-
LINT_INIT(par); LINT_INIT(last_element);
+
for (element= this; element != &null_element ; )
{
last_element=element;
@@ -2296,26 +2296,32 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
{
if (tmp_min_flag & GEOM_FLAG)
{
- tmp= param->table->file->
- records_in_range((int) keynr, (byte*)(param->min_key),
- min_key_length,
- (ha_rkey_function)(tmp_min_flag ^ GEOM_FLAG),
- (byte *)NullS, 0, HA_READ_KEY_EXACT);
+ key_range min_range;
+ min_range.key= (byte*) param->min_key;
+ min_range.length= min_key_length;
+ /* In this case tmp_min_flag contains the handler-read-function */
+ min_range.flag= (ha_rkey_function) (tmp_min_flag ^ GEOM_FLAG);
+
+ tmp= param->table->file->records_in_range(keynr, &min_range,
+ (key_range*) 0);
}
else
{
- tmp=param->table->file->
- records_in_range((int) keynr,
- (byte*) (!min_key_length ? NullS :
- param->min_key),
- min_key_length,
- tmp_min_flag & NEAR_MIN ?
- HA_READ_AFTER_KEY : HA_READ_KEY_EXACT,
- (byte*) (!max_key_length ? NullS :
- param->max_key),
- max_key_length,
- (tmp_max_flag & NEAR_MAX ?
- HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY));
+ key_range min_range, max_range;
+
+ min_range.key= (byte*) param->min_key;
+ min_range.length= min_key_length;
+ min_range.flag= (tmp_min_flag & NEAR_MIN ? HA_READ_AFTER_KEY :
+ HA_READ_KEY_EXACT);
+ max_range.key= param->max_key;
+ max_range.length= max_key_length;
+ max_range.flag= (tmp_max_flag & NEAR_MAX ?
+ HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY);
+ tmp=param->table->file->records_in_range(keynr,
+ (min_key_length ? &min_range :
+ (key_range*) 0),
+ (max_key_length ? &max_range :
+ (key_range*) 0));
}
}
end:
@@ -2604,7 +2610,7 @@ int QUICK_SELECT::get_next()
if (range)
{
// Already read through key
- result= file->read_range_next(test(range->flag & EQ_RANGE));
+ result= file->read_range_next();
if (result != HA_ERR_END_OF_FILE)
DBUG_RETURN(result);
}
@@ -2628,6 +2634,7 @@ int QUICK_SELECT::get_next()
result= file->read_range_first(range->min_length ? &start_key : 0,
range->max_length ? &end_key : 0,
+ test(range->flag & EQ_RANGE),
sorted);
if (range->flag == (UNIQUE_RANGE | EQ_RANGE))
range=0; // Stop searching
@@ -2815,40 +2822,14 @@ int QUICK_SELECT_DESC::get_next()
int QUICK_SELECT_DESC::cmp_prev(QUICK_RANGE *range_arg)
{
+ int cmp;
if (range_arg->flag & NO_MIN_RANGE)
return 0; /* key can't be to small */
- KEY_PART *key_part = key_parts;
- uint store_length;
-
- for (char *key = range_arg->min_key, *end = key + range_arg->min_length;
- key < end;
- key += store_length, key_part++)
- {
- int cmp;
- store_length= key_part->store_length;
- if (key_part->null_bit)
- {
- // this key part allows null values; NULL is lower than everything else
- if (*key)
- {
- // the range is expecting a null value
- if (!key_part->field->is_null())
- return 0; // not null -- still inside the range
- continue; // null -- exact match, go to next key part
- }
- else if (key_part->field->is_null())
- return 1; // null -- outside the range
- key++;
- store_length--;
- }
- if ((cmp = key_part->field->key_cmp((byte*) key,
- key_part->length)) > 0)
- return 0;
- if (cmp < 0)
- return 1;
- }
- return (range_arg->flag & NEAR_MIN) ? 1 : 0; // Exact match
+ cmp= key_cmp(key_part_info, range_arg->min_key, range_arg->min_length);
+ if (cmp > 0 || cmp == 0 && !(range_arg->flag & NEAR_MIN))
+ return 0;
+ return 1; // outside of range
}
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 2df9d93e1ef..2072ded15d1 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -80,13 +80,18 @@ public:
MEM_ROOT alloc;
KEY_PART *key_parts;
+ KEY_PART_INFO *key_part_info;
ha_rows records;
double read_time;
QUICK_SELECT(THD *thd, TABLE *table,uint index_arg,bool no_alloc=0);
virtual ~QUICK_SELECT();
void reset(void) { next=0; it.rewind(); }
- int init() { return error=file->index_init(index); }
+ int init()
+ {
+ key_part_info= head->key_info[index].key_part;
+ return error=file->index_init(index);
+ }
virtual int get_next();
virtual bool reverse_sorted() { return 0; }
bool unique_key_range();
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 4fdcd093132..8c1cd9ce1cb 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -716,7 +716,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
static int reckey_in_range(bool max_fl, TABLE_REF *ref, Field* field,
COND *cond, uint range_fl, uint prefix_len)
{
- if (key_cmp(field->table, ref->key_buff, ref->key, prefix_len))
+ if (key_cmp_if_same(field->table, ref->key_buff, ref->key, prefix_len))
return 1;
if (!cond || (range_fl & (max_fl ? NO_MIN_RANGE : NO_MAX_RANGE)))
return 0;
diff --git a/sql/slave.cc b/sql/slave.cc
index 12fec28ec49..4ce8d5939bc 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3156,6 +3156,7 @@ err:
IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff));
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query = thd->db = 0; // extra safety
+ thd->query_length = 0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
if (mysql)
{
@@ -3321,6 +3322,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
err:
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query = thd->db = 0; // extra safety
+ thd->query_length = 0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->proc_info = "Waiting for slave mutex on exit";
pthread_mutex_lock(&rli->run_lock);
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 9c7fe3e2993..fbd47d4954d 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1820,7 +1820,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
}
my_hash_insert(&hash_columns, (byte *) mem_check);
} while (!col_privs->file->index_next(col_privs->record[0]) &&
- !key_cmp(col_privs,key,0,key_len));
+ !key_cmp_if_same(col_privs,key,0,key_len));
}
}
@@ -2043,7 +2043,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
}
}
} while (!table->file->index_next(table->record[0]) &&
- !key_cmp(table,key,0,key_length));
+ !key_cmp_if_same(table,key,0,key_length));
}
end:
@@ -3064,7 +3064,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
/* Add first global access grants */
{
- String global(buff,sizeof(buff),&my_charset_latin1);
+ String global(buff,sizeof(buff),system_charset_info);
global.length(0);
global.append("GRANT ",6);
@@ -3089,7 +3089,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
}
global.append (" ON *.* TO '",12);
- global.append(lex_user->user.str,lex_user->user.length);
+ global.append(lex_user->user.str, lex_user->user.length,
+ system_charset_info);
global.append ("'@'",3);
global.append(lex_user->host.str,lex_user->host.length);
global.append ('\'');
@@ -3177,7 +3178,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
want_access=acl_db->access;
if (want_access)
{
- String db(buff,sizeof(buff),&my_charset_latin1);
+ String db(buff,sizeof(buff),system_charset_info);
db.length(0);
db.append("GRANT ",6);
@@ -3203,7 +3204,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
db.append (" ON ",4);
append_identifier(thd, &db, acl_db->db, strlen(acl_db->db));
db.append (".* TO '",7);
- db.append(lex_user->user.str,lex_user->user.length);
+ db.append(lex_user->user.str, lex_user->user.length,
+ system_charset_info);
db.append ("'@'",3);
db.append(lex_user->host.str, lex_user->host.length);
db.append ('\'');
@@ -3237,7 +3239,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
ulong table_access= grant_table->privs;
if ((table_access | grant_table->cols) != 0)
{
- String global(buff,sizeof(buff),&my_charset_latin1);
+ String global(buff, sizeof(buff), system_charset_info);
ulong test_access= (table_access | grant_table->cols) & ~GRANT_ACL;
global.length(0);
@@ -3291,7 +3293,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
else
global.append(", ",2);
global.append(grant_column->column,
- grant_column->key_length);
+ grant_column->key_length,
+ system_charset_info);
}
}
if (found_col)
@@ -3307,7 +3310,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
append_identifier(thd, &global, grant_table->tname,
strlen(grant_table->tname));
global.append(" TO '",5);
- global.append(lex_user->user.str,lex_user->user.length);
+ global.append(lex_user->user.str, lex_user->user.length,
+ system_charset_info);
global.append("'@'",3);
global.append(lex_user->host.str,lex_user->host.length);
global.append('\'');
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 3a18b7eaabc..e3fbfb2d0e3 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2096,7 +2096,16 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
if (field_name && item->type() == Item::FIELD_ITEM)
{
Item_field *item_field= (Item_field*) item;
- if (!my_strcasecmp(system_charset_info, item_field->name, field_name))
+ /*
+ In case of group_concat() with ORDER BY condition in the QUERY
+ item_field can be field of temporary table without item name
+ (if this field created from expression argument of group_concat()),
+ => we have to check presence of name before compare
+ */
+ if (item_field->name &&
+ (!my_strcasecmp(system_charset_info, item_field->name, field_name) ||
+ !my_strcasecmp(system_charset_info,
+ item_field->field_name, field_name)))
{
if (!table_name)
{
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 03d67c4f300..f7992c3db9e 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -86,7 +86,7 @@ bool key_part_spec::operator==(const key_part_spec& other) const
/*
- Test if a foreign key is a prefix of the given key
+ Test if a foreign key (= generated key) is a prefix of the given key
(ignoring key name, key type and order of columns)
NOTES:
diff --git a/sql/sql_class.h b/sql/sql_class.h
index e602b7d6d5f..2566385a6d9 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -598,7 +598,24 @@ public:
struct rand_struct rand; // used for authentication
struct system_variables variables; // Changeable local variables
pthread_mutex_t LOCK_delete; // Locked before thd is deleted
-
+ /*
+ Note that (A) if we set query = NULL, we must at the same time set
+ query_length = 0, and protect the whole operation with the
+ LOCK_thread_count mutex. And (B) we are ONLY allowed to set query to a
+ non-NULL value if its previous value is NULL. We do not need to protect
+ operation (B) with any mutex. To avoid crashes in races, if we do not
+ know that thd->query cannot change at the moment, one should print
+ thd->query like this:
+ (1) reserve the LOCK_thread_count mutex;
+ (2) check if thd->query is NULL;
+ (3) if not NULL, then print at most thd->query_length characters from
+ it. We will see the query_length field as either 0, or the right value
+ for it.
+ Assuming that the write and read of an n-bit memory field in an n-bit
+ computer is atomic, we can avoid races in the above way.
+ This printing is needed at least in SHOW PROCESSLIST and SHOW INNODB
+ STATUS.
+ */
/* all prepared statements and cursors of this connection */
Statement_map stmt_map;
/*
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 5fa8b37285e..1038066f6ef 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1710,6 +1710,7 @@ TABLE_LIST *st_lex::link_first_table_back(TABLE_LIST *tables,
st_select_lex::print is in sql_select.h
st_select_lex_unit::prepare, st_select_lex_unit::exec,
- st_select_lex_unit::cleanup, st_select_lex_unit::reinit_exec_mechanism
+ st_select_lex_unit::cleanup, st_select_lex_unit::reinit_exec_mechanism,
+ st_select_lex_unit::change_result
are in sql_union.cc
*/
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index aa3e81fd9c9..557c037c799 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -371,6 +371,7 @@ public:
void print(String *str);
ulong init_prepare_fake_select_lex(THD *thd);
+ int change_result(select_subselect *result, select_subselect *old_result);
friend void mysql_init_query(THD *thd);
friend int subselect_union_engine::exec();
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e949d40625d..f2458068633 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1475,9 +1475,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
packet++;
length--;
}
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_length= length;
thd->query= packet;
- VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id= query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
#ifndef EMBEDDED_LIBRARY
@@ -1768,6 +1768,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->proc_info=0;
thd->command=COM_SLEEP;
thd->query=0;
+ thd->query_length=0;
thread_running--;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
@@ -1807,6 +1808,7 @@ bool alloc_query(THD *thd, char *packet, ulong packet_length)
packet_length--;
}
/* We must allocate some extra memory for query cache */
+ thd->query_length= 0; // Extra safety: Avoid races
if (!(thd->query= (char*) thd->memdup_w_gap((gptr) (packet),
packet_length,
thd->db_length+ 1 +
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c330d1e6b54..4325edc3502 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -665,7 +665,6 @@ JOIN::optimize()
if (!order && org_order)
skip_sort_order= 1;
}
- order= remove_const(this, order, conds, &simple_order);
if (group_list || tmp_table_param.sum_func_count)
{
if (! hidden_group_fields)
@@ -1585,8 +1584,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
if (select_lex->linkage != GLOBAL_OPTIONS_TYPE)
{
//here is EXPLAIN of subselect or derived table
- join->result= result;
- if (!join->procedure && result->prepare(join->fields_list, unit))
+ if (join->change_result(result))
{
DBUG_RETURN(-1);
}
@@ -6162,8 +6160,8 @@ join_read_prev_same(READ_RECORD *info)
if ((error=table->file->index_prev(table->record[0])))
return report_error(table, error);
- if (key_cmp(table, tab->ref.key_buff, tab->ref.key,
- tab->ref.key_length))
+ if (key_cmp_if_same(table, tab->ref.key_buff, tab->ref.key,
+ tab->ref.key_length))
{
table->status=STATUS_NOT_FOUND;
error= -1;
@@ -9123,7 +9121,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
THD *thd=join->thd;
select_result *result=join->result;
Item *item_null= new Item_null();
- CHARSET_INFO *cs= &my_charset_latin1;
+ CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("select_describe");
DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s",
(ulong)join->select_lex, join->select_lex->type,
@@ -9190,7 +9188,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{
if (tmp1.length())
tmp1.append(',');
- tmp1.append(table->key_info[j].name);
+ tmp1.append(table->key_info[j].name, 0, system_charset_info);
}
}
}
@@ -9209,7 +9207,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{
if (tmp2.length())
tmp2.append(',');
- tmp2.append((*ref)->name());
+ tmp2.append((*ref)->name(), 0, system_charset_info);
}
item_list.push_back(new Item_string(tmp2.ptr(),tmp2.length(),cs));
}
@@ -9370,23 +9368,23 @@ void st_select_lex::print(THD *thd, String *str)
//options
if (options & SELECT_STRAIGHT_JOIN)
str->append("straight_join ", 14);
- if ((thd->lex->lock_option & TL_READ_HIGH_PRIORITY) &&
+ if ((thd->lex->lock_option == TL_READ_HIGH_PRIORITY) &&
(this == &thd->lex->select_lex))
str->append("high_priority ", 14);
if (options & SELECT_DISTINCT)
str->append("distinct ", 9);
if (options & SELECT_SMALL_RESULT)
- str->append("small_result ", 13);
+ str->append("sql_small_result ", 17);
if (options & SELECT_BIG_RESULT)
- str->append("big_result ", 11);
+ str->append("sql_big_result ", 15);
if (options & OPTION_BUFFER_RESULT)
- str->append("buffer_result ", 14);
+ str->append("sql_buffer_result ", 18);
if (options & OPTION_FOUND_ROWS)
- str->append("calc_found_rows ", 16);
+ str->append("sql_calc_found_rows ", 20);
if (!thd->lex->safe_to_cache_query)
- str->append("no_cache ", 9);
+ str->append("sql_no_cache ", 13);
if (options & OPTION_TO_QUERY_CACHE)
- str->append("cache ", 6);
+ str->append("sql_cache ", 10);
//Item List
bool first= 1;
@@ -9514,3 +9512,27 @@ void st_select_lex::print(THD *thd, String *str)
// PROCEDURE unsupported here
}
+
+
+/*
+ change select_result object of JOIN
+
+ SYNOPSIS
+ JOIN::change_result()
+ res new select_result object
+
+ RETURN
+ 0 - OK
+ -1 - error
+*/
+
+int JOIN::change_result(select_result *res)
+{
+ DBUG_ENTER("JOIN::change_result");
+ result= res;
+ if (!procedure && result->prepare(fields_list, select_lex->master_unit()))
+ {
+ DBUG_RETURN(-1);
+ }
+ DBUG_RETURN(0);
+}
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 5a246a477cf..8aca43484d2 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -304,6 +304,7 @@ class JOIN :public Sql_alloc
return (do_send_rows && tmp_table_param.sum_func_count != 0 &&
!group_list);
}
+ int change_result(select_result *result);
};
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 51b44af63ec..80634c68ac7 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1597,10 +1597,13 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
thd_info->query=0;
if (tmp->query)
{
- /* query_length is always set before tmp->query */
+ /*
+ query_length is always set to 0 when we set query = NULL; see
+ the comment in sql_class.h why this prevents crashes in possible
+ races with query_length
+ */
uint length= min(max_query_length, tmp->query_length);
- thd_info->query=(char*) thd->memdup(tmp->query,length+1);
- thd_info->query[length]=0;
+ thd_info->query=(char*) thd->strmake(tmp->query,length);
}
thread_infos.append(thd_info);
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index b90ff942cc6..e017bc7e6b5 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -683,9 +683,16 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
{
while ((key2 = key_iterator2++) != key)
{
- if ((key2->type != Key::FOREIGN_KEY && !foreign_key_prefix(key, key2)))
+ /*
+ foreign_key_prefix(key, key2) returns 0 if key or key2, or both, is
+ 'generated', and a generated key is a prefix of the other key.
+ Then we do not need the generated shorter key.
+ */
+ if ((key2->type != Key::FOREIGN_KEY &&
+ key2->name != ignore_key &&
+ !foreign_key_prefix(key, key2)))
{
- /* TO DO: issue warning message */
+ /* TODO: issue warning message */
/* mark that the generated key should be ignored */
if (!key2->generated ||
(key->generated && key->columns.elements <
@@ -693,7 +700,6 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
key->name= ignore_key;
else
{
- /* Remove the previous, generated key */
key2->name= ignore_key;
key_parts-= key2->columns.elements;
(*key_count)--;
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 63638b618d9..165c19ec61a 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -339,8 +339,8 @@ int st_select_lex_unit::exec()
item->reset();
table->file->delete_all_rows();
}
- if (union_distinct) // for subselects
- table->file->extra(HA_EXTRA_CHANGE_KEY_TO_UNIQUE);
+ if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL))
+ DBUG_RETURN(1); // For sub-selects
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
{
ha_rows records_at_start= 0;
@@ -392,7 +392,11 @@ int st_select_lex_unit::exec()
records_at_start= table->file->records;
sl->join->exec();
if (sl == union_distinct)
- table->file->extra(HA_EXTRA_CHANGE_KEY_TO_DUP);
+ {
+ if (table->file->disable_indexes(HA_KEY_SWITCH_ALL))
+ DBUG_RETURN(1);
+ table->no_keyread=1;
+ }
res= sl->join->error;
offset_limit_cnt= sl->offset_limit;
if (!res && union_result->flush())
@@ -555,3 +559,32 @@ void st_select_lex_unit::reinit_exec_mechanism()
}
#endif
}
+
+
+/*
+ change select_result object of unit
+
+ SYNOPSIS
+ st_select_lex_unit::change_result()
+ result new select_result object
+ old_result old select_result object
+
+ RETURN
+ 0 - OK
+ -1 - error
+*/
+
+int st_select_lex_unit::change_result(select_subselect *result,
+ select_subselect *old_result)
+{
+ int res= 0;
+ for (SELECT_LEX *sl= first_select_in_union(); sl; sl= sl->next_select())
+ {
+ if (sl->join && sl->join->result == old_result)
+ if ((res= sl->join->change_result(result)))
+ return (res);
+ }
+ if (fake_select_lex && fake_select_lex->join)
+ res= fake_select_lex->join->change_result(result);
+ return (res);
+}
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 0f29289ac25..d7ef1fc8d7f 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -4683,8 +4683,8 @@ literal:
| TIMESTAMP text_literal { $$ = $2; };
NUM_literal:
- NUM { $$ = new Item_int($1.str, (longlong) strtol($1.str, NULL, 10),$1.length); }
- | LONG_NUM { $$ = new Item_int($1.str, (longlong) strtoll($1.str,NULL,10), $1.length); }
+ NUM { int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); }
+ | LONG_NUM { int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); }
| ULONGLONG_NUM { $$ = new Item_uint($1.str, $1.length); }
| REAL_NUM { $$ = new Item_real($1.str, $1.length); }
| FLOAT_NUM { $$ = new Item_float($1.str, $1.length); }
diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c
index 349350c6c7a..493d0d63de2 100644
--- a/strings/my_strtoll10.c
+++ b/strings/my_strtoll10.c
@@ -22,9 +22,9 @@
#define ULONGLONG_MAX (~(ulonglong) 0)
#define MAX_NEGATIVE_NUMBER ((ulonglong) LL(0x8000000000000000))
#define INIT_CNT 9
-#define LFACTOR LL(1000000000)
-#define LFACTOR1 LL(10000000000)
-#define LFACTOR2 LL(100000000000)
+#define LFACTOR ULL(1000000000)
+#define LFACTOR1 ULL(10000000000)
+#define LFACTOR2 ULL(100000000000)
static unsigned long lfactor[9]=
{
@@ -113,8 +113,8 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error)
negative= 1;
if (++s == end)
goto no_conv;
- cutoff= MAX_NEGATIVE_NUMBER / LL(100000000000);
- cutoff2= (MAX_NEGATIVE_NUMBER % LL(100000000000)) / 100;
+ cutoff= MAX_NEGATIVE_NUMBER / LFACTOR2;
+ cutoff2= (MAX_NEGATIVE_NUMBER % LFACTOR2) / 100;
cutoff3= MAX_NEGATIVE_NUMBER % 100;
}
else
@@ -125,8 +125,8 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error)
if (++s == end)
goto no_conv;
}
- cutoff= ULONGLONG_MAX / LL(100000000000);
- cutoff2= ULONGLONG_MAX % LL(100000000000) / 100;
+ cutoff= ULONGLONG_MAX / LFACTOR2;
+ cutoff2= ULONGLONG_MAX % LFACTOR2 / 100;
cutoff3= ULONGLONG_MAX % 100;
}
diff --git a/tests/client_test.c b/tests/client_test.c
index ba70bcd7fa7..c244274a2e7 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -9614,7 +9614,6 @@ union distinct \
select sum(a) + 200, 1 from t1 \
group by b ");
check_stmt(stmt);
-
mysql_stmt_close(stmt);
stmt= mysql_simple_prepare(mysql,
@@ -9624,14 +9623,14 @@ union distinct \
select sum(a) + 200, 1 from t1 \
group by b ");
check_stmt(stmt);
+ mysql_stmt_close(stmt);
- stmt= mysql_simple_prepare(mysql,
+ stmt= mysql_simple_prepare(mysql,
"select sum(a) + 200, ? from t1 \
union distinct \
select sum(a) + 200, 1 from t1 \
group by b ");
check_stmt(stmt);
-
mysql_stmt_close(stmt);
rc= mysql_query(mysql, "DROP TABLE t1");