Skip to content

fix(方言): 保留PostgreSQL精确字符串关联索引 - #145

Merged
zhou-hao merged 1 commit into
4.2from
codex/postgres-exact-string-index
Nov 30, 2026
Merged

zhou-hao merged 1 commit into
4.2from
codex/postgres-exact-string-index

Conversation

@zhou-hao

Copy link
Copy Markdown
Member

当声明 exactString 的 PostgreSQL 列与现有默认排序规则的业务列关联时,强制添加 COLLATE "C" 会让比较采用另一种排序规则,原业务列的主键索引无法用于该条件,查询退化为全表扫描。

PostgreSQL 方言改为沿用数据库默认的确定性排序规则,保留大小写、重音及尾空格的精确比较,同时保持与现有业务列的关联索引兼容。其他方言的映射不变。

验证:

  • DialectTest 与 PostgresqlExactStringIntegrationTest 共 9 项通过,0 失败、0 错误、0 跳过。
  • 使用隔离 PostgreSQL 16 验证 10,000 行普通 VARCHAR 主键表与精确声明列关联时,执行计划使用原主键索引;验证大小写、重音及尾空格值可分别插入并精确查询。
  • 专用容器、匿名卷和运行临时目录已清理。仅验证 PostgreSQL,未重跑 MySQL 集成测试。

消费者:jetlinks-components #1712 改为使用通用 @ColumnType(exactString = true) 声明,移除业务侧的方言配置识别和专用实体定制器。

这是列定义生成的修正,不自动迁移已有显式 COLLATE "C" 的物理列。

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.23%. Comparing base (68b2764) to head (6395738).
⚠️ Report is 70 commits behind head on 4.2.

Additional details and impacted files
@@              Coverage Diff              @@
##                4.2     #145       +/-   ##
=============================================
+ Coverage     64.92%   81.23%   +16.30%     
- Complexity     2341     3746     +1405     
=============================================
  Files           343      385       +42     
  Lines          9375    11463     +2088     
  Branches        940     1417      +477     
=============================================
+ Hits           6087     9312     +3225     
+ Misses         2810     1510     -1300     
- Partials        478      641      +163     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zhou-hao
zhou-hao merged commit c9cf2d9 into 4.2 Nov 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants