List:Internals« Previous MessageNext Message »
From:Martin Friebe Date:March 17 2007 9:37pm
Subject:Re: select *, more_fields
View as plain text  
Hi Chad,

attached is a patch and a test case. The test case is a bit over-sized 
(hope I havent missed any essential case), but I rather cover more than 
less....

Seems to work fine on my box (passes the test suite). If it finds 
approval, shall I attach it to the original bug, in the bug system?

Best Regards
Martin


Chad MILLER wrote:

> On 16 Mar 2007, at 15:42, Martin Friebe wrote:
>
>> I believe to remember there have been feature requests, about the  
>> placement options for the * in the select
>> ( http://bugs.mysql.com/bug.php?id=26066 )
>>
>> This appears to be fixable in the parser with little effort.
>
>
> Hi Martin.  Offhand, I don't know why this special case exists.   
> Looking at the parser, I suspect that it's probably only a case of  
> someone wishing to avoid shift/reduce conflicts and not thinking of  
> these cases.  I very much would like to see a patch, along with some  
> test results that show that such a construction doesn't confuse the  
> optimizer, which is the only potential problem that comes to mind.
>
> I also say that "SELECT *, *, *, * FROM tablename" should be allowed  
> also.
>
> - chad
>
> -- 
> Chad Miller, Software Developer                         chad@stripped
> MySQL Inc., www.mysql.com
> Orlando, Florida, USA                                13-20z,  UTC-0500
> Office: +1 408 213 6740                         sip:6740@stripped
>
>


*** sql/sql_yacc.yy	Wed Mar  7 09:24:42 2007
--- ../mysql-5.0.bk-asterisk/sql/sql_yacc.yy	Fri Mar 16 19:20:31 2007
***************
*** 4421,4445 ****
  	  }
  	;
  
  select_item_list:
  	  select_item_list ',' select_item
! 	| select_item
! 	| '*'
  	  {
  	    THD *thd= YYTHD;
  	    if (add_item_to_list(thd,
                                   new Item_field(&thd->lex->current_select->
                                                  context,
                                                  NULL, NULL, "*")))
  	      MYSQL_YYABORT;
  	    (thd->lex->current_select->with_wild)++;
! 	  };
! 
! 
! select_item:
! 	  remember_name select_item2 remember_end select_alias
  	  {
  	    if (add_item_to_list(YYTHD, $2))
  	      MYSQL_YYABORT;
  	    if ($4.str)
              {
--- 4421,4444 ----
  	  }
  	;
  
  select_item_list:
  	  select_item_list ',' select_item
! 	| select_item;
! 
! select_item:
! 	 '*'
  	  {
  	    THD *thd= YYTHD;
  	    if (add_item_to_list(thd,
                                   new Item_field(&thd->lex->current_select->
                                                  context,
                                                  NULL, NULL, "*")))
  	      MYSQL_YYABORT;
  	    (thd->lex->current_select->with_wild)++;
! 	  }
!         | remember_name select_item2 remember_end select_alias
  	  {
  	    if (add_item_to_list(YYTHD, $2))
  	      MYSQL_YYABORT;
  	    if ($4.str)
              {

Thread
select *, more_fieldsMartin Friebe16 Mar
  • Re: select *, more_fieldsChad MILLER17 Mar
    • Re: select *, more_fieldsMartin Friebe17 Mar
      • engine agnostic test [Re: select *, more_fields]Martin Friebe17 Mar
    • Re: select *, more_fieldsVladimir Shebordaev17 Mar
      • Re: select *, more_fieldsMartin Friebe18 Mar
      • Re: select *, more_fieldsPeter Gulutzan21 Mar
        • draft of sql2003 / quoting [Re: select *, more_fields]Martin Friebe21 Mar