赞
踩
有一段WITH查询的SQL,最后的SELECT中含聚合函数SUM和UNION ALL,上一层查询RESULT_DETAIL中还用到了窗口函数OVER(),执行报错
sqlyog工具中执行报错:Lost connection to MySQL server during query
JAVA程序里执行报错:The last packet successfully received from the server was 8,321 milliseconds ago. The last packet sent successfully to the server was 8,322 milliseconds ago.; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
1、该SQL在几个8.0.25版本的MySQL数据库中执行,均报错,在8.0.26,8.0.28版本的数据库中执行正常,均没有报错;
(以下在8.0.25版本中执行)
2、去掉RESULT_DETAIL中的窗口函数OVER(),写成 1 AS RN,不再报错;
3、保留窗口函数,去掉最后的UNION ALL以及SUM,直接SELECT * FROM RESULT_DETAIL ,不再报错。
将MySQL数据库,从8.0.25升级到8.0.28,问题解决。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。