兼容性判定
公开资料依据 · 建议 PoC 复核支持度partial
严重度critical
置信度low
依据规则my.op.modulo_zero_semantics
怎么改
mod(dividend, NULLIF(divisor,0))
判定说明
mod/% 存在但零除行为不同;建议 PoC 复核动态零值、NULL 与数值类型
库侧 / 应用侧路径
库侧改造
可行:用 NULLIF 保留零除返回 NULL
应用侧改造
可行:约束除数并显式处理零值
推荐路线:db_side。验证建议:零、NULL、正负与小数操作数结果对照
规则样例
SELECT MOD(order_no, bucket_count) FROM orders
SELECT order_no % bucket_count FROM orders
SELECT order_no % (bucket_count + 1) FROM orders
参考来源
- https://github.com/tobymao/sqlglot/blob/64e268a5d95cd84a87ad74ef569fc9bf356fd3fb/tests/dialects/test_mysql.py#L1498-L1521
- https://www.postgresql.org/docs/16/functions-math.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
相关改造点
- 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 怎么改