Bug #58344 Support nested (C-style) comments
Submitted: 20 Nov 2010 5:41 Modified: 20 Nov 2010 8:37
Reporter: Terry Nycum Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Parser Severity:S4 (Feature request)
Version:5.1 OS:Any
Assigned to: CPU Architecture:Any
Tags: comment, syntax

[20 Nov 2010 5:41] Terry Nycum
Description:
Per http://dev.mysql.com/doc/refman/5.1/en/comments.html:
"Nested comments are not supported. (Under some conditions, nested comments might be permitted, but usually are not, and users should avoid them.)"

To quote from a comment on http://bugs.mysql.com/bug.php?id=57509:
"The cases where it works is just a side effect of the flexibility in the implementation. It is not designed with the purpose to parse nested comments."

This request is fairly simple: design it with that purpose.

If comment parsing is already implemented flexibly in one place, why is it reimplemented--at all, much less inflexibly--elsewhere?

http://bugs.mysql.com/bug.php?id=30631, http://bugs.mysql.com/bug.php?id=39559, http://bugs.mysql.com/bug.php?id=44189, http://bugs.mysql.com/bug.php?id=57509 ... --all dodge the obvious solution. You'd think the parser were some kludge that no one wanted to touch.

How to repeat:
n/a (not a bug)

Suggested fix:
See fix suggested for http://bugs.mysql.com/bug.php?id=4313
[20 Nov 2010 11:19] Davi Arnaut
Why should we support it? Besides people assuming things that clearly aren't supported. Keep in mind that every change like this increases the complexity of the parser and slowdowns it a bit.
[20 Nov 2010 11:23] Davi Arnaut
I also think there is a misunderstanding around what is the purpose of "undefined behavior" cases.

http://en.wikipedia.org/wiki/Undefined_behavior
[20 Nov 2010 11:28] Davi Arnaut
> If comment parsing is already implemented flexibly in one place, why is
> it reimplemented--at all, much less inflexibly--elsewhere?

Keep in mind that we aren't responsible for design decisions elsewhere. If other places decide to support nested comments, that's their burden to carry, not ours. Here we also have to think about the long term maintainability and performance of the parser, which can affect everyone.