Description:
If database is not selected, mysqld will crash on load data.
How to repeat:
load data infile 'test into table db.table
Suggested fix:
===== sql/sql_load.cc 1.43 vs 1.44 =====
*** /tmp/sql_load.cc-1.43-1397 Fri Feb 14 22:20:33 2003
--- 1.44/sql/sql_load.cc Wed Feb 26 15:27:42 2003
***************
*** 90,95 ****
--- 90,102 ----
bool is_fifo=0;
LOAD_FILE_INFO lf_info;
char * db = table_list->db ? table_list->db : thd->db;
+ char * tdb= thd->db ? thd->db : db;
+ /*
+ 'tdb' can be NULL only if both table_list->db and thd->db are NULL
+ 'db' itself can be NULL. but in that case it will generate
+ an error earlier open_ltable()).
+ */
+
bool transactional_table, log_delayed;
DBUG_ENTER("mysql_load");
***************
*** 168,177 ****
ex->file_name+=dirname_length(ex->file_name);
#endif
if (!dirname_length(ex->file_name) &&
! strlen(ex->file_name)+strlen(mysql_data_home)+strlen(thd->db)+3 <
FN_REFLEN)
{
! (void) sprintf(name,"%s/%s/%s",mysql_data_home,thd->db,ex->file_name);
unpack_filename(name,name); /* Convert to system format */
}
else
--- 175,184 ----
ex->file_name+=dirname_length(ex->file_name);
#endif
if (!dirname_length(ex->file_name) &&
! strlen(ex->file_name)+strlen(mysql_data_home)+strlen(tdb)+3 <
FN_REFLEN)
{
! (void) sprintf(name,"%s/%s/%s",mysql_data_home,tdb,ex->file_name);
unpack_filename(name,name); /* Convert to system format */
}
else