Bug #91550 DatabaseMetaData specifies incorrect extra name characters
Submitted: 4 Jul 2018 21:47 Modified: 9 Apr 20:49
Reporter: Raphael Enns Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.46 / 6.0.6 / 8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[4 Jul 2018 21:47] Raphael Enns
Description:
DatabaseMetaData.getExtraNameCharacters() returns '#' and '@' characters that are allowed in schema object names.

Here is the code:

	public String getExtraNameCharacters() throws SQLException {
		return "#@";
	}

I looked at the Connector / J code on GitHub for the 5.1/6.0/8.0 branches and all return those values.

According to the MySQL documentation (https://dev.mysql.com/doc/refman/8.0/en/identifiers.html), that is incorrect.

The documentation states:
  Permitted characters in unquoted identifiers:
  - ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore)
  - Extended: U+0080 .. U+FFFF

How to repeat:
Look in the source code.

Suggested fix:
Make the source code match the documentation.
[5 Jul 2018 12:25] Chiranjeevi Battula
Hello Raphael Enns,

Thank you for the bug report.
Verified based on internal discussion with dev's.

Thanks,
Chiranjeevi.
[9 Apr 20:49] Daniel So
Posted by developer:
 
Added the following entry to the C/J 8.4.0 changelog: 

"DatabaseMetaData.getExtraNameCharacters() returned '#' and '@', which are not allowed in unquoted schema object names. With this fix, it returns '$' as the only "extra" character allowed in unquoted identifiers."