Schema Diff does not detect foreign keys that reference a different schema

未关闭
#10,786 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 2 天内回复

@dpage 已经在做这个了。

开始于 2026年11月18日。

  • #10789 来自 @dpage —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
57/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
postgresql, python
领域
databases

调研方向

Start with web/pgadmin/browser/server_groups/servers/databases/schemas/tables/schema_diff_table_utils.py and trace the table equality check and table_constraint_comp. Compare how referenced schemas are handled when source and target schema names differ. Done means foreign keys to same named tables in different external schemas are reported as a difference and produce DDL, while references to the compared schemas remain normalized.

由索引模型根据 Issue 内容生成。

描述

Schema Diff reports two tables as identical when their foreign keys reference tables of the same name in different schemas, so the difference is never shown and no DDL is generated for it.

For example, comparing schemas app and app_prod where app.orders has a foreign key to common_a.users and app_prod.orders has the same foreign key to common_b.users: the tables are reported as identical.

The cause is that the table comparison's keys_to_ignore (web/pgadmin/browser/server_groups/servers/databases/schemas/tables/schema_diff_table_utils.py) includes references, refnsp and remote_schema, so the referenced schema is dropped from the initial equality check and table_constraint_comp is never reached. Those keys are ignored so that a reference to the compared schema itself does not count as a difference when the source and target schemas have different names; the fix is to compare the referenced schema after normalising the source and target schema names, rather than ignoring it outright.

This was found by CodeRabbit whilst reviewing #10782, which fixes a related false difference; the gap predates that PR.

主要语言
Python
星标
3.9k
派生
922
平均合并
2 天 3 小时
30 天内合并 PR
33

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pgadmin-org/pgadmin4 的其他 Issue

查看 pgadmin-org/pgadmin4 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。