Skip to content

Resolve db-schema case via Hibernate in DatabaseIndexChecker - #55220

Draft
ahus1 wants to merge 1 commit into
keycloak:mainfrom
ahus1:is-54836-index-checker-schema-case
Draft

ahus1 wants to merge 1 commit into
keycloak:mainfrom
ahus1:is-54836-index-checker-schema-case

Conversation

@ahus1

@ahus1 ahus1 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Closes #54836

Decisions and assumptions:

  • The configured schema is resolved with Hibernate's IdentifierHelper instead of folding case in the checker, so the checker looks at the same schema Hibernate uses for the unquoted name.
  • Verified on PostgreSQL with CaseSensitiveSchemaTest, PreserveSchemaCaseLiquibaseTest and a temporary mixed-case dash schema test (Keycloak-T); no "Failed to create index" warnings remain.
  • No new test, as CaseSensitiveSchemaTest already reproduces the issue.

Closes keycloak#54836

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
@ahus1
ahus1 force-pushed the is-54836-index-checker-schema-case branch from 6dae682 to 837c7ce Compare November 16, 2026 11:33
@ahus1
ahus1 requested review from ruchikajha95 and a balanced review from Copilot November 16, 2026 13:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The tests lack an assertion that the checker reports no missing indexes with a case-mismatched schema, leaving the fix unprotected against regressions.

1 open issue
What changed in this PR

This PR addresses #54836 by aligning DatabaseIndexChecker schema resolution with Hibernate, preventing false missing-index reports when configured schema casing differs from the database.

Changes:

  • Resolve the configured schema through Hibernate’s IdentifierHelper.
  • Use the resolved schema for index metadata lookups, PostgreSQL invalid-index queries, and qualified index identifiers.
File Description
quarkus/​runtime/​src/​main/​java/​org/​keycloak/​quarkus/​runtime/​storage/​database/​jpa/​DatabaseIndexChecker.java Resolves schema casing through Hibernate and applies it to index checks and PostgreSQL identifiers.

Review effort: Balanced

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.

DatabaseIndexChecker logs a warning for every index when db-schema case differs from the actual schema

2 participants