兼容性判定
公开资料依据 · 建议 PoC 复核支持度none
严重度minor
置信度medium
依据规则my.func.truncate
怎么改
TRUNCATE(x,d) -> TRUNC(x,d),必要时 cast numeric
判定说明
无同名数值函数;双参数类型与返回精度建议 PoC 复核
库侧 / 应用侧路径
库侧改造
可行:改数值 trunc 并保持输入/返回精度
应用侧改造
不可行:SQL 数值函数优先数据库侧改写
推荐路线:db_side。验证建议:正负位数、负数、浮点/定点与返回类型对照
规则样例
SELECT TRUNCATE(price, 2) FROM product
SELECT TRUNCATE(-123.456, -1)
TRUNCATE TABLE staging
参考来源
- https://github.com/tobymao/sqlglot/blob/64e268a5d95cd84a87ad74ef569fc9bf356fd3fb/tests/dialects/test_mysql.py#L1662-L1680
- 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 怎么改