兼容性判定
公开资料依据 · 建议 PoC 复核支持度partial
严重度blocker
置信度medium
依据规则my.func.timestamp_interval
怎么改
ADD 构造 interval;DIFF 按完整单位/月末规则实现
判定说明
可人工改写但完整单位截断、月末和微秒边界无同名等价;建议 PoC 复核
库侧 / 应用侧路径
库侧改造
可行:按实际 unit 分支重写并封装完整单位算法
应用侧改造
可行:日历单位差可在应用日期库统一实现
推荐路线:case_by_case。验证建议:月末、闰年、负差、不足一单位、微秒和时区边界回归
规则样例
SELECT TIMESTAMPADD(MONTH, 1, invoice_date) FROM invoice
SELECT TIMESTAMPDIFF(MONTH, started_at, finished_at) FROM job
SELECT DATEDIFF(finished_at, started_at) FROM job
参考来源
- https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html
- https://www.postgresql.org/docs/16/functions-datetime.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/darold/ora2pg/blob/97015451a4d1cfbee888f2e6efe7ff68c239a9b5/lib/Ora2Pg/PLSQL.pm#L3060-L3145
相关改造点
- 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 怎么改