Skip to content

Describe Db2's index for a primary key as unique - #7479

Merged
morozov merged 1 commit into
doctrine:4.5.xfrom
morozov:db2-primary-key-index-unique
Jul 26, 2026
Merged

Describe Db2's index for a primary key as unique#7479
morozov merged 1 commit into
doctrine:4.5.xfrom
morozov:db2-primary-key-index-unique

Conversation

@morozov

@morozov morozov commented Jul 26, 2026

Copy link
Copy Markdown
Member

Db2MetadataProvider classifies an index as unique only when its UNIQUERULE is 'U'. A primary key's index is unique too, and Db2 reports it with UNIQUERULE = 'P', so the check should be "anything but 'D'" ('D' is the only rule that allows duplicates).

It's a no-op change on 4.5.x: the introspection query excludes primary-key indexes, so no 'P' row ever reaches the mapping:

AND I.UNIQUERULE != 'P'

This will become an issue if schema introspection starts reporting underlying primary key indexes (currently prototyped in #7477). Without this change, the introspection will report the primary key indexes as regular.

@morozov
morozov force-pushed the db2-primary-key-index-unique branch from 16958d5 to 69f5629 Compare July 26, 2026 01:05
@morozov
morozov marked this pull request as ready for review July 26, 2026 02:54
@morozov
morozov requested a review from greg0ire July 26, 2026 02:56
@morozov morozov added this to the 4.5.0 milestone Jul 26, 2026
@morozov
morozov merged commit cf1fa87 into doctrine:4.5.x Jul 26, 2026
231 of 256 checks passed
@morozov
morozov deleted the db2-primary-key-index-unique branch July 26, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants