| Bug #37484 | C-style comments not ignored within character literals | ||
|---|---|---|---|
| Submitted: | 18 Jun 2008 16:43 | Modified: | 18 Jun 2008 20:49 |
| Reporter: | Eric Friedman | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S2 (Serious) |
| Version: | 5.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[18 Jun 2008 17:04]
Paul DuBois
I don't see the reported behavior:
mysql> create table table1 (text varchar(100));
Query OK, 0 rows affected (0.07 sec)
mysql> insert into table1 values('/* valid character data */');
Query OK, 1 row affected (0.01 sec)
mysql> select * from table1;
+----------------------------+
| text |
+----------------------------+
| /* valid character data */ |
+----------------------------+
1 row in set (0.00 sec)
[18 Jun 2008 20:49]
Eric Friedman
Apparently this C-style comment removal behavior is a feature of the Teradata Sql Assistant 7.1 client I am using to access MySQL, not of MySQL itself. I apologize for the false alarm.

Description: MySQL parser treats /*...*/ as a comment within character literals. This prevents you from entering the character sequences '/*', '*/', or '/*...*/' as character data in a SQL statement, even though the literal contains perfectly valid character data. How to repeat: create table table1 (text varchar(100)); insert into table1 values('/* valid character data */'); Result: column text is empty. Instead, it should contain the string: /* valid character data */ Suggested fix: Ignore comments (of any style) when contained within a string literal.