兼容性判定
公开资料依据 · 建议 PoC 复核支持度partial
严重度critical
置信度low
依据规则my.txn.update_subquery_rr
怎么改
显式锁定参与子查询的数据,或拆分读取与更新并评估改用 RC
判定说明
UPDATE 子查询可用,但 MVCC 快照、锁等待与可串行化失败契约不同;建议 PoC 复核并发交错
库侧 / 应用侧路径
库侧改造
可行:按目标支持面使用锁定读/联接重写并保留影响行数断言
应用侧改造
可行:拆为带版本号的乐观并发更新和有界重试
推荐路线:case_by_case。验证建议:双会话在 RR/RC 下交错提交,核对影响行数、最终值和重试路径
规则样例
UPDATE account SET balance=(SELECT amount FROM staging WHERE id=account.id) WHERE id=1
UPDATE task SET state=1 WHERE id IN (SELECT id FROM queue WHERE ready=1)
UPDATE account SET balance=balance+1 WHERE id=1
参考来源
- https://www.postgresql.org/docs/16/transaction-iso.html
- https://www.postgresql.org/docs/16/sql-update.html
- https://www.postgresql.org/docs/16/datatype.html
- https://www.postgresql.org/docs/16/functions.html
- https://www.postgresql.org/docs/16/sql-commands.html
- https://github.com/pingcap/tidb/issues/45677
- https://github.com/oceanbase/oceanbase/issues/2145
- https://dev.mysql.com/doc/refman/8.0/en/update.html
相关改造点
- MYSQL → postgresql 16 全部改造点
- postgresql 16 兼容性总览
- MYSQL 迁移国产库总览
- ORACLE ADD_MONTHS 函数 迁移 postgresql 16 怎么改
- ORACLE ALTER SESSION SET 会话参数 迁移 postgresql 16 怎么改
- ORACLE ANYDATA 动态类型列 迁移 postgresql 16 怎么改
- ORACLE ASCIISTR Unicode 转义函数 迁移 postgresql 16 怎么改
- ORACLE 关联数组(INDEX BY 表) 迁移 postgresql 16 怎么改
- ORACLE AT TIME ZONE 时区表达式 迁移 postgresql 16 怎么改