8000 Evaluate CockroachDB as a PostgreSQL database in tests by ahus1 · Pull Request #54845 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Evaluate CockroachDB as a PostgreSQL database in tests - #54845

Draft
ahus1 wants to merge 7 commits into
keycloak:mainfrom
ahus1:is-54844-cockroachdb
Draft

ahus1 wants to merge 7 commits into
keycloak:mainfrom
ahus1:is-54844-cockroachdb

Conversation

@ahus1
@ahus1 ahus1 commented Nov 8, 2026 •
Copy link
Copy Markdown
Member

Closes #54844
Spike to evaluate Keycloak on CockroachDB, used as a plain PostgreSQL database (--db=postgres, no dedicated Keycloak database vendor).

Test wiring

  • New test framework module test-framework/db-cockroachdb, selected with KC_TEST_DATABASE=cockroachdb. It starts a single-node insecure container and creates a keycloak role that defaults to READ COMMITTED, which Keycloak requires.

Changes needed for CockroachDB

  • Liquibase detects CockroachDB as its own database (cockroachdb) instead of PostgreSQL. KeycloakCockroachDatabase reports DDL as supported in transactions, as Liquibase would otherwise switch to auto-commit, which Keycloak's custom tasks can't use.
  • Custom generators for adding and dropping primary keys and for modifying column types, as CockroachDB doesn't support the PostgreSQL statements Liquibase generates. A separate authz-3.4.0.CR1 changeSet avoids dropping an index that CockroachDB won't drop.
  • The PostgreSQL-specific modifySql blocks and dbms preconditions now also apply to cockroachdb, so the partial and expression indexes match PostgreSQL. EDB-only migration changeSets are untouched.
  • DbTest passes. A migration on a fresh database takes about 12 minutes.

@xgp
xgp commented Nov 8, 2026
Copy link
Copy Markdown
Contributor

@ahus1 Let me know if I can help with this.

ahus1 and others added 7 commits November 12, 2026 10:24
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Relates to keycloak#54844

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Relates to keycloak#54844

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
…schema quoting

Relates to keycloak#54844

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
CockroachDB resolves a quoted name as a database first, so the test created a database named keycloak-t but no schema, and Liquibase could not see the existing objects.

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-54844-cockroachdb branch from aaa306e to fbcc219 Compare November 12, 2026 09:24
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.

Evaluate current compatibility with CockroachDB

2 participants

0