database compatibility assessment

ORACLE REGEXP_SUBSTR 函数 迁移 panweidb 3.0 A 模式 怎么改

迁衡基于规则 ora.func.regexp_substr 分析 ORACLE REGEXP_SUBSTR 函数 到 panweidb 3.0 A 模式 的兼容性、改写路径与验证建议。

兼容性判定

真机验证:opengauss 6.0.5 · 实测2026-07-09(og6.0.5): occurrence 参数可用;6 参 subexpr 形态报 function regexp_substr(...) does not exist,捕获组提取需改写
支持度partial
严重度minor
置信度high
依据规则ora.func.regexp_substr

怎么改

需按命中位置逐条评估改写

判定说明

实测2026-07-09(og6.0.5): occurrence 参数可用;6 参 subexpr 形态报 function regexp_substr(...) does not exist,捕获组提取需改写

库侧 / 应用侧路径

库侧改造

需人工确认改造边界

应用侧改造

需人工确认改造边界

推荐路线:case_by_case。验证建议:position/occurrence/subexpr 参数与正则方言差异需逐参核对(PG15+ 才有同名函数);常见"按分隔符拆列"用法建议改 split_part

规则样例

SELECT REGEXP_SUBSTR(csv, '[^,]+', 1, 2) FROM t
SELECT REGEXP_SUBSTR(url, 'https?://([^/]+)', 1, 1, NULL, 1) FROM t
SELECT SUBSTR(csv, 1, 10) FROM t