是“类型"吗?和“状态" MySQL中的保留字? [英] Is "type" and "status" a reserved word in MySQL?

查看:271
本文介绍了是“类型"吗?和“状态" 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).

错误#948 标识当时phpMyAdmin将某些列名(包括STATUS)大写(错误地)被标识为该列表中的保留字;结果,这些关键字最初从列表中被删除,但随后该提交被解释原因亚历山大·图雷克(Alexander Turek):

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命令的一部分. 在显示状态"中使用状态.和第一部分 更改语法.

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.

这篇关于是“类型"吗?和“状态" MySQL中的保留字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆