兼容性判定
公开资料依据 · 建议 PoC 复核支持度partial
严重度major
置信度medium
依据规则my.func.last_insert_id
怎么改
需按命中位置逐条评估改写
判定说明
Dolphin 提供 LAST_INSERT_ID,但会话状态、显式参数和批量写入返回值需与调用驱动联测;结论为 doc_based 草案,建议 PoC 复核
库侧 / 应用侧路径
库侧改造
可行:目标端 MySQL 兼容模式保留原调用(批量插入返回语义真库核对)
应用侧改造
可行:改 INSERT...RETURNING 或 useGeneratedKeys 驱动路径取回自增值
推荐路线:case_by_case。验证建议:判定条件:目标是否 MySQL 兼容模式;批量插入返回首行 ID 的语义必测
规则样例
SELECT LAST_INSERT_ID()
UPDATE seq_t SET id = LAST_INSERT_ID(id + 1)
SELECT MAX(id) FROM t
参考来源
- https://docs.opengauss.org/zh/docs/6.0.0/docs/ExtensionReference/dolphin-Extension.html
- https://docs.opengauss.org/zh/docs/6.0.0/docs/ExtensionReference/dolphin-%E5%AD%97%E7%AC%A6%E5%A4%84%E7%90%86%E5%87%BD%E6%95%B0%E5%92%8C%E6%93%8D%E4%BD%9C%E7%AC%A6.html
- https://github.com/opengauss-mirror/Plugin/tree/e3a0cf2ae9bbcee1aa103497f6eca1b1152a4146/contrib/dolphin
- https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_last-insert-id
相关改造点
- 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 模式 怎么改