Bug #29959 Non-standard bison syntax in sql_yacc.yy
Submitted: 22 Jul 2007 16:11 Modified: 2 Aug 2007 3:27
Reporter: Philip Stoev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.41-debug-log, 5.0 BK, 5.1 BK OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[22 Jul 2007 16:11] Philip Stoev
Description:
Line 5573 of sql_yacc.yy says:

table_ref %prec TABLE_REF_PRIORITY normal_join table_ref

however the Bison manual says:

"5.4 Context-Dependent Precedence
...
The %prec modifier declares the precedence of a particular rule by specifying a terminal symbol whose precedence should be used for that rule. It's not necessary for that symbol to appear otherwise in the rule. The modifier's syntax is: 

     %prec terminal-symbol

and it is written after the components of the rule."

Therefore %prec in the middle of the rule may cause problems if any future bison versions enforce the behavoir. %prec is used in a few other places in sql_yacc.yy, however they all seem fine.

How to repeat:
Try to compile the same grammer with another bison-compatible tool, e.g. Parse::Yapp

Suggested fix:
Replace the problematic line with

table_ref normal_join table_ref %prec TABLE_REF_PRIORITY
[23 Jul 2007 9:55] Sveta Smirnova
Thank you for the report.

Verified as described using code analysis.
[23 Jul 2007 22:23] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/31441

ChangeSet@1.2477, 2007-07-23 16:23:35-06:00, malff@weblab.(none) +1 -0
  Bug#29959 (Non-standard bison syntax in sql_yacc.yy)
  
  In sql/sql_yacc.yy, use the %prec construct at the end of rule join_table
[1 Aug 2007 23:26] Bugs System
Pushed into 5.0.48
[1 Aug 2007 23:27] Bugs System
Pushed into 5.1.21-beta
[2 Aug 2007 3:27] Paul DuBois
No user-visible consequences. No changelog entry needed.