Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
463 views
in Technique[技术] by (71.8m points)

phpmyadmin - Is "type" and "status" a reserved word in MySQL?

I can't find these in words in the MySQL manual for reserved words but apparently phpMyAdmin says they're reserved:

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is, technically, a bug in phpMyAdmin. From libraries/sqlparser.data.php:

/**
 * words forbidden to be used as column or table name wihtout quotes
 * as seen in http://dev.mysql.com/doc/mysql/en/reserved-words.html
 *
 * @global array MySQL forbidden words
 */
$PMA_SQPdata_forbidden_word = array (

(list includes 'STATUS' and 'TYPE', which are clearly not on the referenced manual page).

Bug #948 identified that phpMyAdmin at that time capitalised certain column names (including STATUS) due to (erroneously) being identified as reserved words from this list; those keywords were initially removed from the list as a result, but that commit was subsequently reversed, for the reasons explained by Alexander Turek:

Your fix messes up the pretty-printer! This is rather an analyzer problem.

FIRST and STATUS have been inside this reserved words array because they are part of MySQL commands. STATUS is used in "SHOW STATUS" and FIRST part of the ALTER sytax.

Furthermore, this bug affects a lot more words than just STATUS and FIRST. I do not want to know what happens if we remove them all from the reserved words array...

Because of your change, both queries are not highlighted well anymore.

That is to say, phpMyAdmin uses the same list of words to conduct syntax highlighting in its pretty printer as it does for detecting reserved words; this is erroneous and leads to the warnings you observe.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...