Commit f0e835ac authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Fixed problem with WHERE key=const ORDER BY key DESC

parent 93ab42f6
...@@ -9869,6 +9869,9 @@ If you would like MySQL to start automatically, you can copy ...@@ -9869,6 +9869,9 @@ If you would like MySQL to start automatically, you can copy
@file{support-files/mysql.server} to @file{/etc/init.d} and create a @file{support-files/mysql.server} to @file{/etc/init.d} and create a
symbolic link to it named @file{/etc/rc3.d/S99mysql.server}. symbolic link to it named @file{/etc/rc3.d/S99mysql.server}.
As Solaris doesn't support core files for @code{setuid()} applications,
you can't get a core file from @code{mysqld} if you are using the
@code{--user} option.
@menu @menu
* Solaris 2.7:: Solaris 2.7/2.8 Notes * Solaris 2.7:: Solaris 2.7/2.8 Notes
...@@ -14114,7 +14117,8 @@ though. ...@@ -14114,7 +14117,8 @@ though.
@item --core-file @item --core-file
Write a core file if @code{mysqld} dies. For some systems you must also Write a core file if @code{mysqld} dies. For some systems you must also
specify @code{--core-file-size} to @code{safe_mysqld}. @xref{safe_mysqld, , specify @code{--core-file-size} to @code{safe_mysqld}. @xref{safe_mysqld, ,
@code{safe_mysqld}}. @code{safe_mysqld}}. Note that on some system like Solaris, you will
not get a core file if you are also using the @code{--user} option.
@item -h, --datadir=path @item -h, --datadir=path
Path to the database root. Path to the database root.
...@@ -48732,6 +48736,8 @@ Fixed wrong error value when doing a @code{SELECT} with an empty HEAP table. ...@@ -48732,6 +48736,8 @@ Fixed wrong error value when doing a @code{SELECT} with an empty HEAP table.
@item @item
Use @code{ORDER BY column DESC} now sorts @code{NULL} values first. Use @code{ORDER BY column DESC} now sorts @code{NULL} values first.
@item @item
Fixed bug in @code{WHERE key_name='constant' ORDER BY key_name DESC}.
@item
Fixed bug in @code{SELECT DISTINCT ... ORDER BY DESC} optimization. Fixed bug in @code{SELECT DISTINCT ... ORDER BY DESC} optimization.
@item @item
Fixed bug in @code{... HAVING 'GROUP_FUNCTION'(xxx) IS [NOT] NULL}. Fixed bug in @code{... HAVING 'GROUP_FUNCTION'(xxx) IS [NOT] NULL}.
...@@ -112,7 +112,7 @@ int FTB_WORD_cmp_list(void *v __attribute__((unused)), FTB_WORD **a, FTB_WORD ** ...@@ -112,7 +112,7 @@ int FTB_WORD_cmp_list(void *v __attribute__((unused)), FTB_WORD **a, FTB_WORD **
} }
void _ftb_parse_query(FTB *ftb, byte **start, byte *end, void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
FTB_EXPR *up, uint depth) FTB_EXPR *up, uint depth)
{ {
byte res; byte res;
FTB_PARAM param; FTB_PARAM param;
...@@ -127,7 +127,7 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end, ...@@ -127,7 +127,7 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
param.prev=' '; param.prev=' ';
while ((res=ft_get_word(start,end,&w,&param))) while ((res=ft_get_word(start,end,&w,&param)))
{ {
byte r=param.plusminus; int r=param.plusminus;
float weight= (float) (param.pmsign ? nwghts : wghts)[(r>5)?5:((r<-5)?-5:r)]; float weight= (float) (param.pmsign ? nwghts : wghts)[(r>5)?5:((r<-5)?-5:r)];
switch (res) { switch (res) {
case 1: /* word found */ case 1: /* word found */
......
...@@ -583,14 +583,14 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize) ...@@ -583,14 +583,14 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
thd->proc_info="Repair by sorting"; thd->proc_info="Repair by sorting";
statistics_done=1; statistics_done=1;
error = mi_repair_by_sort(&param, file, fixed_name, error = mi_repair_by_sort(&param, file, fixed_name,
param.testflag & T_QUICK); param.testflag & T_QUICK);
} }
else else
{ {
thd->proc_info="Repair with keycache"; thd->proc_info="Repair with keycache";
param.testflag &= ~T_REP_BY_SORT; param.testflag &= ~T_REP_BY_SORT;
error= mi_repair(&param, file, fixed_name, error= mi_repair(&param, file, fixed_name,
param.testflag & T_QUICK); param.testflag & T_QUICK);
} }
param.testflag=testflag; param.testflag=testflag;
optimize_done=1; optimize_done=1;
...@@ -725,10 +725,10 @@ bool ha_myisam::check_and_repair(THD *thd) ...@@ -725,10 +725,10 @@ bool ha_myisam::check_and_repair(THD *thd)
{ {
sql_print_error("Warning: Recovering table: '%s'",table->path); sql_print_error("Warning: Recovering table: '%s'",table->path);
check_opt.flags= check_opt.flags=
(myisam_recover_options & HA_RECOVER_BACKUP ? T_BACKUP_DATA : 0) ((myisam_recover_options & HA_RECOVER_BACKUP ? T_BACKUP_DATA : 0) |
| (marked_crashed ? 0 : T_QUICK) (marked_crashed ? 0 : T_QUICK) |
| (myisam_recover_options & HA_RECOVER_FORCE ? 0 : T_SAFE_REPAIR) (myisam_recover_options & HA_RECOVER_FORCE ? 0 : T_SAFE_REPAIR) |
| T_AUTO_REPAIR; T_AUTO_REPAIR);
if (repair(thd, &check_opt)) if (repair(thd, &check_opt))
error=1; error=1;
} }
......
...@@ -4685,7 +4685,7 @@ join_read_prev_same(READ_RECORD *info) ...@@ -4685,7 +4685,7 @@ join_read_prev_same(READ_RECORD *info)
tab->ref.key_length)) tab->ref.key_length))
{ {
table->status=STATUS_NOT_FOUND; table->status=STATUS_NOT_FOUND;
error= 1; error= -1;
} }
return error; return error;
} }
...@@ -7056,8 +7056,9 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -7056,8 +7056,9 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
item_list.push_back(new Item_null()); item_list.push_back(new Item_null());
if (tab->ref.key_parts) if (tab->ref.key_parts)
{ {
item_list.push_back(new Item_string(table->key_info[tab->ref.key].name,strlen(table->key_info[tab->ref.key].name))); item_list.push_back(new Item_string(table->key_info[tab->ref.key].name,
item_list.push_back(new Item_int((int) tab->ref.key_length)); strlen(table->key_info[tab->ref.key].name)));
item_list.push_back(new Item_int((int32) tab->ref.key_length));
for (store_key **ref=tab->ref.key_copy ; *ref ; ref++) for (store_key **ref=tab->ref.key_copy ; *ref ; ref++)
{ {
if (tmp2.length()) if (tmp2.length())
...@@ -7069,13 +7070,13 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -7069,13 +7070,13 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
else if (tab->type == JT_NEXT) else if (tab->type == JT_NEXT)
{ {
item_list.push_back(new Item_string(table->key_info[tab->index].name,strlen(table->key_info[tab->index].name))); item_list.push_back(new Item_string(table->key_info[tab->index].name,strlen(table->key_info[tab->index].name)));
item_list.push_back(new Item_int((int) table->key_info[tab->index].key_length)); item_list.push_back(new Item_int((int32) table->key_info[tab->index].key_length));
item_list.push_back(new Item_null()); item_list.push_back(new Item_null());
} }
else if (tab->select && tab->select->quick) else if (tab->select && tab->select->quick)
{ {
item_list.push_back(new Item_string(table->key_info[tab->select->quick->index].name,strlen(table->key_info[tab->select->quick->index].name))); item_list.push_back(new Item_string(table->key_info[tab->select->quick->index].name,strlen(table->key_info[tab->select->quick->index].name)));
item_list.push_back(new Item_int((int) tab->select->quick->max_used_key_length)); item_list.push_back(new Item_int((int32) tab->select->quick->max_used_key_length));
item_list.push_back(new Item_null()); item_list.push_back(new Item_null());
} }
else else
......
...@@ -126,8 +126,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) ...@@ -126,8 +126,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
} }
union_result->save_time_stamp=!describe; union_result->save_time_stamp=!describe;
for (sl=lex->select=&lex->select_lex;sl;sl=lex->select=sl->next) for (sl= &lex->select_lex; sl; sl=sl->next)
{ {
lex->select=sl;
thd->offset_limit=sl->offset_limit; thd->offset_limit=sl->offset_limit;
thd->select_limit=sl->select_limit+sl->offset_limit; thd->select_limit=sl->select_limit+sl->offset_limit;
if (thd->select_limit < sl->select_limit) if (thd->select_limit < sl->select_limit)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment