Skip to content

Avoid aurora_version() probe on standard PostgreSQL - #51794

Merged
ahus1 merged 3 commits into
keycloak:mainfrom
kalayciburak:fix/51792-aurora-probe-no-pg-error
Aug 24, 2026
Merged

ahus1 merged 3 commits into
keycloak:mainfrom
kalayciburak:fix/51792-aurora-probe-no-pg-error

Conversation

@kalayciburak

Copy link
Copy Markdown
Contributor

Closes #51792

Since 26.7.0, Aurora detection runs SELECT aurora_version() during
startup. On standard PostgreSQL that function does not exist, so the
server logs ERROR: function aurora_version() does not exist even
though Keycloak swallows the SQLException.

Probe with SELECT to_regproc('aurora_version') IS NOT NULL instead.
Stock PostgreSQL returns false without an ERROR; Aurora still reports
the function as present.

Test plan

  • ./mvnw -pl model/jpa -am test -Dtest=AsyncCommitIntegratorTest,JpaUtilsTest,JpaHashUtilsTest,KeyUtilsTest
    AsyncCommitIntegratorTest 2/2 (RED then GREEN); module tests 10/10 GREEN

@kalayciburak
kalayciburak requested a review from a team as a code owner August 18, 2026 12:08
Copilot AI balanced review requested due to automatic review settings August 18, 2026 12:08

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Query to_regproc('aurora_version') so Aurora detection does not
write ERROR to the PostgreSQL server log on every startup.

Closes keycloak#51792

Signed-off-by: Burak KALAYCI <kalayciburak1996@gmail.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Copilot AI review requested due to automatic review settings August 20, 2026 13:42

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (1)

model/jpa/src/main/java/org/keycloak/connections/jpa/AsyncCommitIntegrator.java:175

  • The test plan reports AsyncCommitIntegratorTest, but no such test is included in this PR, so the new probe's true/false result handling has no regression coverage. Please add the stated unit tests for both function-present and function-absent result sets.
    static boolean auroraVersionFunctionExists(Connection connection) throws SQLException {

Copilot AI review requested due to automatic review settings August 24, 2026 11:52

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

ahus1
ahus1 previously approved these changes Aug 24, 2026

@ahus1 ahus1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested with an Aurora database, approving

…itIntegrator.java

Signed-off-by: Alexander Schwartz <alexander.schwartz@gmx.net>
Copilot AI review requested due to automatic review settings August 24, 2026 11:56
@ahus1
ahus1 force-pushed the fix/51792-aurora-probe-no-pg-error branch from 0b00006 to af7d1f4 Compare August 24, 2026 11:56

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment on lines +175 to +178
static boolean auroraVersionFunctionExists(Connection connection) throws SQLException {
try (Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT to_regproc('pg_catalog.aurora_version') IS NOT NULL")) {
return rs.next() && rs.getBoolean(1);
@ahus1
ahus1 merged commit 2b6bd4c into keycloak:main Aug 24, 2026
95 checks passed
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.

AsyncCommitIntegrator Aurora detection logs "ERROR: function aurora_version() does not exist" in the PostgreSQL server log on every startup

4 participants