是“类型"吗?和“状态"MySQL 中的保留字?
我在 MySQL 手册中找不到这些保留字的词,但显然 phpMyAdmin 说它们是保留的:
I can't find these in words in the MySQL manual for reserved words but apparently phpMyAdmin says they're reserved:
推荐答案
从技术上讲,这是 phpMyAdmin 中的一个错误.来自 libraries/sqlparser.data.php
:
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 (
(列表包括 'STATUS'
和 'TYPE'
,它们显然不在参考手册页上).
(list includes 'STATUS'
and 'TYPE'
, which are clearly not on the referenced manual page).
Bug #948 指出当时的 phpMyAdmin 将某些列名(包括 STATUS
) 由于(错误地)被识别为该列表中的保留字;这些关键字最初被从列表中删除,但该提交随后被反转,为原因解释作者:亚历山大·图雷克:
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 和 STATUS 已经在这个保留字数组中因为它们是 MySQL 命令的一部分.STATUS 用于SHOW STATUS"和第一部分改变语法.
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.
也就是说,phpMyAdmin 使用相同的单词列表在其漂亮的打印机中进行语法突出显示,就像检测保留字一样;这是错误的,会导致您观察到警告.
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.
相关文章