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

Fix bug in SELECT EXPLAIN ... ORDER BY

parent cd78a8be
......@@ -214,12 +214,15 @@ you will not develop sloppy coding habits.
If you can write it in fewer lines, do it (as long as the code will not
be slower or much harder to read).
@item
Don't use two commands on the same line.
@item
Do not check the same pointer for @code{NULL} more than once.
@item
Use long function and variable names in English; This makes your
code easier to read.
Use long function and variable names in English; This makes your code
easier to read. Use the 'varible_name' style instead of 'VariableName'.
@item
Think assembly - make it easier for the compiler to optimize your code.
......@@ -266,6 +269,25 @@ Any @code{#define}'s are in all-caps.
@item
Matching @samp{@{} are in the same column.
@item
Put the @samp{@{} after a 'switch' on the same line
@example
switch (arg) {
@end example
Because this gives better overall indentation for the switch statement.
@item
In all other cases, @{ and @} should be on their own line, except
if there is nothing inside @{ @}.
@item
Have a space after 'if'
@item
Put a space after ',' for function arguments
@item
Functions return 0 on success, and non-zero on error, so you can do:
......@@ -289,6 +311,32 @@ Use pointers rather than array indexing when operating on strings.
@end itemize
Suggested mode in emacs:
@example
(load "cc-mode")
(setq c-mode-common-hook '(lambda ()
(turn-on-font-lock)
(setq comment-column 48)))
(setq c-style-alist
(cons
'("MY"
(c-basic-offset . 2)
(c-comment-only-line-offset . 0)
(c-offsets-alist . ((statement-block-intro . +)
(knr-argdecl-intro . 0)
(substatement-open . 0)
(label . -)
(statement-cont . +)
(arglist-intro . c-lineup-arglist-intro-after-paren)
(arglist-close . c-lineup-arglist)
))
)
c-style-alist))
(c-set-style "MY")
(setq c-default-style "MY")
@end example
@node mysys functions,,,
@chapter mysys functions
......
......@@ -46853,6 +46853,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.43
@itemize @bullet
@item
Fixed a unlikely core-dump bug when doing @code{EXPLAIN SELECT} when using
many tables and @code{ORDER BY}.
@item
Fixed bug in @code{LOAD DATA FROM MASTER} when using table with
@code{CHECKSUM=1}.
@item
......@@ -1291,11 +1291,8 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
{
info->state->data_file_length=sort_info->max_pos;
if (param->testflag & T_CALC_CHECKSUM)
{
DBUG_PRINT("QQ",("set_checksum"));
share->state.checksum=param->glob_crc;
}
}
if (!(param->testflag & T_SILENT))
{
......@@ -2136,10 +2133,7 @@ static int sort_get_next_record(SORT_INFO *sort_info)
if (*sort_info->record)
{
if (param->calc_checksum)
{
DBUG_PRINT("QQ",("calc_checksum"));
param->glob_crc+= mi_static_checksum(info,sort_info->record);
}
DBUG_RETURN(0);
}
if (!sort_info->fix_datafile)
......
......@@ -531,8 +531,9 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
if (!(select_options & SELECT_BIG_RESULT) &&
((group && join.const_tables != join.tables &&
(!simple_group ||
!test_if_skip_sort_order(&join.join_tab[join.const_tables], group,
HA_POS_ERROR)) ||
HA_POS_ERROR))) ||
select_distinct) &&
join.tmp_table_param.quick_group && !procedure)
{
......@@ -545,8 +546,10 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
order=group;
if (order &&
(join.const_tables == join.tables ||
(simple_order &&
test_if_skip_sort_order(&join.join_tab[join.const_tables], order,
(group ? HA_POS_ERROR : thd->select_limit))))
(group ? HA_POS_ERROR :
thd->select_limit)))))
order=0;
select_describe(&join,need_tmp,
(order != 0 &&
......
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