>>>>> "Arjen" == Arjen G Lentz <[EMAIL PROTECTED]> writes:
Arjen> Hi, Arjen> ----- Original Message ----- Arjen> From: "AJ" <[EMAIL PROTECTED]> >> > > Ver 11.15 Distrib 3.23.46, for pc-linux-gnu (i686) >> > > The problem that has cropped up I have is that in all GROUP BY column >> > > DESC >> > > statements, the DESC is now not being recognized, and the query is being >> > > returned in ascending order. If I use ORDER BY... DESC that works fine. >>> >> >I'm seeing the same bug on 3.23.45 (and maybe others but I can't remember >> >all the versions I've played with recently). It does the same thing where >> >it accepts the syntax but does not respect it (and returns rows in the >> >default ASC ordering). >> >> The problem is apparently solved if you kluge with e.g. >> select field, count(field) from table group by field order by field >> desc but it IS a kluge. This is now fixed in the MySQL 3.23.47 and MySQL 4.0.1 source trees. Here is a patch for this: ===== sql/sql_lex.h 1.34 vs edited ===== *** /tmp/sql_lex.h-1.34-29757 Sun Oct 7 14:18:08 2001 --- edited/sql/sql_lex.h Mon Dec 10 17:27:02 2001 *************** *** 140,146 **** enum lex_states next_state; enum enum_duplicates duplicates; enum enum_tx_isolation tx_isolation; ! uint in_sum_expr,grant,grant_tot_col,which_columns, sort_default; thr_lock_type lock_option; bool create_refs,drop_primary,drop_if_exists,local_file; bool in_comment,ignore_space,verbose; --- 140,146 ---- enum lex_states next_state; enum enum_duplicates duplicates; enum enum_tx_isolation tx_isolation; ! uint in_sum_expr,grant,grant_tot_col,which_columns; thr_lock_type lock_option; bool create_refs,drop_primary,drop_if_exists,local_file; bool in_comment,ignore_space,verbose; ===== sql/sql_yacc.yy 1.86 vs edited ===== *** /tmp/sql_yacc.yy-1.86-29757 Tue Aug 21 20:06:00 2001 --- edited/sql/sql_yacc.yy Mon Dec 10 17:26:37 2001 *************** *** 470,476 **** ULONGLONG_NUM %type <item> ! literal text_literal insert_ident group_ident order_ident simple_ident select_item2 expr opt_expr opt_else sum_expr in_sum_expr table_wild opt_pad no_in_expr expr_expr simple_expr no_and_expr using_list --- 470,476 ---- ULONGLONG_NUM %type <item> ! literal text_literal insert_ident order_ident simple_ident select_item2 expr opt_expr opt_else sum_expr in_sum_expr table_wild opt_pad no_in_expr expr_expr simple_expr no_and_expr using_list *************** *** 1869,1878 **** | GROUP BY group_list group_list: ! group_list ',' group_ident ! { if (add_group_to_list($3,(bool) 1)) YYABORT; } ! | group_ident ! { if (add_group_to_list($1,(bool) 1)) YYABORT; } /* ** Order by statement in select --- 1869,1878 ---- | GROUP BY group_list group_list: ! group_list ',' order_ident order_dir ! { if (add_group_to_list($3,(bool) $4)) YYABORT; } ! | order_ident order_dir ! { if (add_group_to_list($1,(bool) $2)) YYABORT; } /* ** Order by statement in select *************** *** 1883,1889 **** | order_clause order_clause: ! ORDER_SYM BY { Lex->sort_default=1; } order_list order_list: order_list ',' order_ident order_dir --- 1883,1889 ---- | order_clause order_clause: ! ORDER_SYM BY order_list order_list: order_list ',' order_ident order_dir *************** *** 1893,1900 **** order_dir: /* empty */ { $$ = 1; } ! | ASC { $$ = Lex->sort_default=1; } ! | DESC { $$ = Lex->sort_default=0; } limit_clause: --- 1893,1900 ---- order_dir: /* empty */ { $$ = 1; } ! | ASC { $$ =1; } ! | DESC { $$ =0; } limit_clause: *************** *** 2451,2459 **** ident '.' '*' { $$ = new Item_field(NullS,$1.str,"*"); } | ident '.' ident '.' '*' { $$ = new Item_field((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS : $1.str),$3.str,"*"); } - - group_ident: - order_ident order_dir order_ident: expr { $$=$1; } --- 2451,2456 ---- Regards, Monty --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php