Comments on: `;`.`*`.`.` is a valid column name https://shlomi-noach.github.io/blog/mysql/is-a-valid-column-name Blog by Shlomi Noach Sat, 28 Feb 2009 06:42:40 +0000 hourly 1 https://wordpress.org/?v=5.3.3 By: themattreid https://shlomi-noach.github.io/blog/mysql/is-a-valid-column-name/comment-page-1#comment-862 Sat, 28 Feb 2009 06:42:40 +0000 https://shlomi-noach.github.io/blog/?p=502#comment-862 Those are valid names, but are a total hassle to deal with when writing automation scripts and general day to day DBA duties. Having to always escape table/schema names is annoying at best, and time consuming as well.

I prefer to tell my clients to follow some basic naming convention rules: stay away from special characters like $,%,^,#,&,*,; and so forth. In addition, using a dash “-” in names is possible, but an underscore “_” is preferred.

Just because we can do things doesn’t always mean we should 🙂

Nice write up though, I think a lot of people forget or just never learned about the back tick escapes in MySQL.

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/is-a-valid-column-name/comment-page-1#comment-637 Thu, 12 Feb 2009 16:13:38 +0000 https://shlomi-noach.github.io/blog/?p=502#comment-637 @Zilivinas – thanks for the link!

@sergei – thanks, also fixed comment’s HTML issues.

]]>
By: Sergei Golubchik https://shlomi-noach.github.io/blog/mysql/is-a-valid-column-name/comment-page-1#comment-635 Thu, 12 Feb 2009 15:42:04 +0000 https://shlomi-noach.github.io/blog/?p=502#comment-635 fine, thanks HTML markup 🙂

http://pastebin.com/m29081b3d

]]>
By: Sergei Golubchik https://shlomi-noach.github.io/blog/mysql/is-a-valid-column-name/comment-page-1#comment-634 Thu, 12 Feb 2009 15:38:30 +0000 https://shlomi-noach.github.io/blog/?p=502#comment-634 Two comments:

1. In 5.1 table names are converted to a safe representation, you won’t see these dangerous characters in a filename there.

2. All these characters are actually allowed in identifiers by the standard, MySQL must support all them. In a delimited identifier one can have *any* character:

<delimited identifier> ::= <double quote> <delimited identifier body> <double quote>
<delimited identifier body> ::= <delimited identifier part>…
<delimited identifier part> ::=
<nondoublequote character>
| <doublequote symbol>
<doublequote symbol> ::= “” !! two consecutive double quote characters

6) A <nondoublequote character> is any character of the source language character set other than a <double
quote>.

]]>
By: Zilvinas https://shlomi-noach.github.io/blog/mysql/is-a-valid-column-name/comment-page-1#comment-633 Thu, 12 Feb 2009 15:27:46 +0000 https://shlomi-noach.github.io/blog/?p=502#comment-633 Nice insights there. I think you will find this link interesting: http://dev.mysql.com/doc/refman/5.1/en/identifier-mapping.html

]]>