phpmyadmin / phpmyadmin/sql-parser
unrecognised keyword 'CASE'
未关闭
还没有人认领这个 Issue。
bug
help wanted
- 主要语言
- PHP
- 星标
- 485
- 派生
- 119
- PR 合并指标
- 30 天内没有已合并 PR
描述
$ ./lint-query --query 'SELECT * FROM `Caracteristiques` WHERE CASE `an` WHEN 86400 THEN 4 WHEN 604800 THEN 5 WHEN 2419200 THEN 6 WHEN 31536000 THEN 7 ELSE -1 END < 0;'
#1: Unrecognised keyword. (near "CASE" at position 39)
#2: Unexpected token. (near "`an`" at position 44)
#3: Unrecognised keyword. (near "WHEN" at position 49)
#4: Unexpected token. (near "86400" at position 54)
#5: Unrecognised keyword. (near "THEN" at position 60)
#6: Unexpected token. (near "4" at position 65)
#7: Unrecognised keyword. (near "WHEN" at position 67)
#8: Unexpected token. (near "604800" at position 72)
#9: Unrecognised keyword. (near "THEN" at position 79)
#10: Unexpected token. (near "5" at position 84)
#11: Unrecognised keyword. (near "WHEN" at position 86)
#12: Unexpected token. (near "2419200" at position 91)
#13: Unrecognised keyword. (near "THEN" at position 99)
#14: Unexpected token. (near "6" at position 104)
#15: Unrecognised keyword. (near "WHEN" at position 106)
#16: Unexpected token. (near "31536000" at position 111)
#17: Unrecognised keyword. (near "THEN" at position 120)
#18: Unexpected token. (near "7" at position 125)
#19: Unrecognised keyword. (near "ELSE" at position 127)
#20: Unexpected token. (near "-1" at position 132)
#21: Unrecognised keyword. (near "END" at position 135)
#22: Unexpected token. (near "<" at position 139)
#23: Unexpected token. (near "0" at position 141)
I am using the version shipped with phpMyAdmin 4.9.1. The query works.
SELECT VERSION();
5.7.27-30-57-log
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用 lint-query 入口点重现该查询,并检查 SQL 解析器如何处理 CASE、WHEN、THEN、ELSE 和 END 标记。为该查询添加覆盖,并确认有效的 MySQL CASE 表达式不再产生报告中的错误。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- mysql, php, sql
- 领域
- databases, tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100