mysql error when using over() and an alias(使用 over() 和别名时的 mysql 错误)
问题描述
使用 phpMyAdmin 控制台和 MariaDB 10.2,如果我将 over() 函数与别名结合使用,则会出现各种错误:
Using the phpMyAdmin console and MariaDB 10.2, if I combine the over() function with an alias I get a variety of errors:
SELECT AVG(foo) OVER() AS bar FROM some_table
- 之前发现了一个别名(靠近 bar)
- 意外标记(靠近条形)
- 需要一个别名(靠近 )<-- 只是一个空格
这些带有任一功能的语句都不会给我错误
these statements with either one function don't give me errors
SELECT AVG(foo) AS bar FROM some_table
SELECT AVG(foo) OVER() FROM some_table
我能找到的所有内容都暗示这些错误来自基本错误,例如逗号不合适,或使用保留关键字作为别名.我不认为我在做任何事情.
All of the stuff I can find implies that these errors come from basic mistakes, like having a comma out of place, or using reserved keywords as aliases. I don't think I'm doing any of that.
推荐答案
似乎 phpMyAdmin 用于验证语法的 linter 似乎尚未针对 MariaDB 10.2 引入的这种语法进行更新.虽然这很烦人,但您可以忽略警告并运行您的查询.
It appears the linter that phpMyAdmin uses for verifying syntax hasn't been updated for this syntax that seems to have been introduced with MariaDB 10.2. While it's annoying, you can ignore the warnings and run your query anyway.
我在 https://github.com 打开了一个关于它的错误报告/phpmyadmin/sql-parser/issues/197,您可以在此处继续操作,直到错误修复为止.
I've opened a bug report about it at https://github.com/phpmyadmin/sql-parser/issues/197, where you can follow along until the bug is fixed.
这篇关于使用 over() 和别名时的 mysql 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 over() 和别名时的 mysql 错误
基础教程推荐
- 是否可以执行按位分组功能? 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 无法解决整理冲突 2021-01-01
