Fix:修复达梦物化视图分页元数据分类#3430
Conversation
t8y2
left a comment
There was a problem hiding this comment.
There are two metadata correctness and regression issues to address.
USER_MVIEWSonly covers materialized views owned by the connected user. When a privileged account browses another owner, a materialized view reported asVIEWbyALL_OBJECTSstill misses the join and is later passed toDBMS_METADATA.GET_DDLas a normal view. Please support the connected-user-differs-from-requested-schema case with an appropriate catalog/fallback and regression coverage.- The materialized-view join is currently added to every constrained metadata query, including table-only and procedure/function-only searches. This adds unnecessary catalog work and makes unrelated queries depend on
USER_MVIEWS. Please add the classification join only when VIEW/MATERIALIZED_VIEW classification is relevant.
|
已按评审意见修复并推送 8fdab6e:
验证结果:
|
t8y2
left a comment
There was a problem hiding this comment.
request changes: 跨 schema 的物化视图分类还有一个权限场景没有覆盖。
新的 SYS.SYSOBJECTS 查询在具备系统目录权限时可以正确分类,但普通用户可能只能通过对象级授权访问另一个 schema。实测这种用户可以在 ALL_OBJECTS 中看到目标普通视图和物化视图,但两者都显示为 VIEW;同时该用户无权查询 SYS.SYSOBJECTS,而 USER_MVIEWS 只包含当前用户自己的物化视图。
因此主查询失败后,USER_MVIEWS fallback 仍无法识别跨 owner 的物化视图,最后会把它作为普通 VIEW 返回,并在加载源码时按 VIEW 调用 DBMS_METADATA.GET_DDL。
请补充一个不依赖 SYS.SYSOBJECTS 权限的跨 owner fallback,并增加回归测试:连接用户仅被显式授予另一个 schema 下普通视图和物化视图的访问权限,确认两者仍能正确分类。
8fdab6e to
ad51e54
Compare
|
已按最新审核意见修复,提交:ad51e542。
真实 DM8 验证:创建仅拥有 DBX_TEST.V_CITY_SALES 和 DBX_TEST.ISSUE_3418_MV 对象级 SELECT 权限的临时用户。该用户无 SYS.SYSOBJECTS 权限,且 ALL_OBJECTS / JDBC 均将两者报告为 VIEW;修改后普通视图和物化视图均能正确分类,物化视图源码也可正常读取。临时用户已清理。 本地验证::dameng:check --rerun-tasks 通过。 |
t8y2
left a comment
There was a problem hiding this comment.
Thanks for the update. The constrained-query permission case is improved, but two blocking issues remain on the current head.
-
The normal unconstrained
listTables(schema)andlistObjects(schema)paths still classify cross-owner materialized views throughUSER_MVIEWS. A restricted user browsing another owner can therefore still receive a materialized view as a regularVIEW, or have it omitted. The new privilege-safe fallback only runs for constrained requests. Please cover the normal overloads with the same restricted cross-owner scenario. -
The restricted-user fallback removes pagination and probes every candidate view using a separate
DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW', ...)call. A small page request can therefore perform an unbounded scan plus N+1 catalog queries across the entire schema, andlistTablesandlistObjectsmay repeat the work. Please replace this with a bulk or bounded classification strategy and add regression/performance coverage.
ad51e54 to
0cc861d
Compare
|
已按本轮审核意见修复并推送
验证:
|
|
Thanks for the contribution! Merged in b4bf5e0, will be released in the next version. |
问题
达梦物化视图会记录在 USER_MVIEWS 中,但当前测试版本的 ALL_OBJECTS 和 ALL_TAB_COMMENTS 仍将其标记为 VIEW。
原有非分页元数据路径会通过 USER_MVIEWS 将物化视图与普通视图区分开;v0.5.56 包含的分页元数据优化改为直接按 ALL_OBJECTS.OBJECT_TYPE 过滤,绕过了达梦专用分类逻辑,导致物化视图进入普通视图分组。后续查看源码时会按 VIEW 调用 DBMS_METADATA.GET_DDL,从而报对象不存在。
修复
验证
Fixes #3418