兼容性判定
公开资料依据 · 建议 PoC 复核支持度partial
严重度critical
置信度medium
依据规则my.func.connection_identity
怎么改
CONNECTION_ID -> pg_backend_pid;身份按 session_user/current_user/client_addr 分解
判定说明
能力可组合但 MySQL USER()/CURRENT_USER 的认证/授权主体语义不同;建议 PoC 复核
库侧 / 应用侧路径
库侧改造
可行:用 pg_backend_pid、session_user、current_user 和客户端地址组合
应用侧改造
可行:审计主体优先由认证层注入稳定 ID
推荐路线:case_by_case。验证建议:代理连接、连接池、SET ROLE、定义者权限和客户端地址回归
规则样例
SELECT CONNECTION_ID()
INSERT INTO audit(actor) VALUES(USER())
SELECT CURRENT_USER
参考来源
- https://dev.mysql.com/doc/refman/8.4/en/information-functions.html
- https://www.postgresql.org/docs/16/functions-info.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#L3040-L3085
相关改造点
- 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 怎么改