兼容性判定
公开资料依据 · 建议 PoC 复核支持度partial
严重度major
置信度medium
依据规则my.syntax.user_variables
怎么改
需按命中位置逐条评估改写
判定说明
Dolphin 提供 @user_variable 语法,求值顺序、类型变化和连接池复用可能改变语义;结论为 doc_based 草案,建议 PoC 复核
库侧 / 应用侧路径
库侧改造
可行:MySQL 兼容目标核对 @var 支持面;PG 系库侧无用户变量承接
应用侧改造
可行:行间累计/排名写法改窗口函数;会话变量改应用层变量或 CTE
推荐路线:app_side。验证建议:行间依赖写法(@var:=@var+1)改窗口函数后结果逐行比对(该写法 8.0 起本已废弃)
规则样例
SET @total = 0
SELECT @rn := @rn + 1 AS rn, t.* FROM t, (SELECT @rn := 0) x
SELECT @@sql_mode
参考来源
- https://docs.opengauss.org/zh/docs/6.0.0/docs/SQLReference/SELECT.html
- https://docs.opengauss.org/zh/docs/6.0.0/docs/ExtensionReference/dolphin-%E4%B8%8D%E6%94%AF%E6%8C%81%E8%AF%AD%E6%B3%95.html
- https://docs.opengauss.org/zh/docs/6.0.0/docs/ExtensionReference/dolphin-Extension.html
- https://github.com/opengauss-mirror/Plugin/tree/e3a0cf2ae9bbcee1aa103497f6eca1b1152a4146/contrib/dolphin
- https://dev.mysql.com/doc/refman/8.0/en/user-variables.html
相关改造点
- MYSQL → opengauss 6.0 B 模式 全部改造点
- opengauss 6.0 B 模式 兼容性总览
- MYSQL 迁移国产库总览
- MYSQL GET_LOCK / RELEASE_LOCK 咨询锁函数 迁移 opengauss 6.0 B 模式 怎么改
- MYSQL ALTER TABLE ALGORITHM= / LOCK= 在线 DDL 子句 迁移 opengauss 6.0 B 模式 怎么改
- MYSQL ALTER TABLE 增删主键限制 迁移 opengauss 6.0 B 模式 怎么改
- MYSQL AUTO_INCREMENT 自增列 迁移 opengauss 6.0 B 模式 怎么改
- MYSQL 表/列级 CHARSET 与 COLLATE 子句 迁移 opengauss 6.0 B 模式 怎么改
- MYSQL CHECK 约束执行与静默忽略差异 迁移 opengauss 6.0 B 模式 怎么改