兼容性判定
公开资料依据 · 建议 PoC 复核支持度partial
严重度critical
置信度low
依据规则my.ddl.default_expression
怎么改
优先改常量或应用赋值;必须数据库生成时改目标支持的生成机制
判定说明
可使用无列引用表达式默认值;MySQL 函数名、列算术与易变性限制建议 PoC 复核
库侧 / 应用侧路径
库侧改造
可行:按目标逐函数改默认表达式,在线 DDL 不支持时安排受控离线变更
应用侧改造
可行:在统一写入层生成值并禁止绕过路径
推荐路线:case_by_case。验证建议:省略列、显式 NULL、批量写入和在线变更期间分别回归
规则样例
CREATE TABLE t (created_epoch BIGINT DEFAULT (UNIX_TIMESTAMP()))
ALTER TABLE t ADD token BINARY(16) DEFAULT (UUID_TO_BIN(UUID()))
CREATE TABLE t (retry_count INT DEFAULT (1))
参考来源
- https://www.postgresql.org/docs/16/ddl-default.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://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html
- https://github.com/oceanbase/oceanbase/issues/1812
- https://cloud.tencent.com/document/product/1376/126644
相关改造点
- 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 怎么改