兼容性判定
公开资料依据 · 建议 PoC 复核支持度none
严重度major
置信度low
依据规则ora.func.harvest_orafce_plvstr_substr
怎么改
PLVSTR.SUBSTR(text,start[,length]) -> plvstr.substr(text,start[,length])(orafce 4.16;目标能力按 capability 判定)
判定说明
PostgreSQL core 不自带 orafce 的 PLV/PLUnit 与 Oracle 兼容重载;扩展准入、search_path 和语义边界建议 PoC 复核
库侧 / 应用侧路径
库侧改造
可行:启用获批兼容层并固定 schema/search_path,保留 1 基及动态负起点语义
应用侧改造
可行:在应用适配层封装截取并保留 Oracle NULL、0/负起点和越界契约
推荐路线:db_side。验证建议:建议 PoC 复核正常值、NULL、0/负起点、越界、动态参数和多字节字符,并与 Oracle 逐项比对
规则样例
BEGIN v_result := PLVSTR.SUBSTR('sample', 2); END;
SELECT PLVSTR.SUBSTR(code, :start_pos, :amount) FROM orders
SELECT PLVSTR.SUBSTR(code, -4, 4) FROM orders
参考来源
- https://github.com/orafce/orafce/blob/841978f4ec493492bb57fd12415959695cae1b64/README.asciidoc
- https://www.postgresql.org/docs/16/external-extensions.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/orafce/orafce/blob/841978f4ec493492bb57fd12415959695cae1b64/orafce--4.16.sql
相关改造点
- ORACLE → postgresql 16 全部改造点
- postgresql 16 兼容性总览
- ORACLE 迁移国产库总览
- 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 怎么改