Bug #83904 JOIN syntax in manual
Submitted: 21 Nov 2016 8:53 Modified: 5 Dec 2016 14:34
Reporter: Roel Van de Paar Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Documentation Severity:S2 (Serious)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[21 Nov 2016 8:53] Roel Van de Paar
Description:
It looks like:

  | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition
  | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor

Should read:

  | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition
  | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor join_condition

Or perhaps:

  | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition
  | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor ON conditional_expr

How to repeat:
http://dev.mysql.com/doc/refman/5.7/en/join.html
[21 Nov 2016 8:59] MySQL Verification Team
Hello Roel,

Thank you for the report.

Thanks,
Umesh
[21 Nov 2016 14:13] MySQL Verification Team
Are you sure it's a documentation bug?

sql_yacc.yy says;

join_table:
...
| table_ref NATURAL JOIN_SYM table_factor
..
| table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
..
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor

And the syntax doesn't allow ON or USING.

mysql> select * from t natural join s;
Empty set (0.00 sec)

mysql> select * from t natural join s on 1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the ma
[5 Dec 2016 14:34] Paul DuBois
See Shane's comment. Also, I asked the parser folks about it and got this reply:

"
I don't see why this is a bug.

Our implementation of the natural join doesn't expect the ON clause (i.e. the "join condition") as documented.

AFAIU the Standard does the same: "join condition" is a part of a "qualified join", not a natural join.
"

Roel, do you have an example of a statement that the syntax in the manual does not cover that the server actually accepts?