Subject: [pgjdbc/pgjdbc] PR #3612: chore: use Java 21 for building pgjdbc by default

From: "vlsi (@vlsi)" <[email-masked]>
Date: Tue, 29 Apr 2025 11:28:26 +0000

Note: the resulting binaries still target Java 8, so the change should not be use-visible.

However, we would use a newer toolset which should result in fewer bugs in the generated binaries.

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Tue, 29 Apr 2025 12:08:32 +0000

I think we should be good to go for Java 21 for spawning the build. Looks like the CI succeeds, so we are good to go.
Any objections on merging this?

---

From: "sehrope (@sehrope)" <[email-masked]>
Date: Tue, 29 Apr 2025 12:28:12 +0000

LGTM.

For anybody else reading this, we're going from 17 to 21 (which like 17 is an LTS release) for the build itself. Testing etc still happens on multiple JDK versions including 8 and none of this changes any of that.

---

From: "sehrope (@sehrope)" <[email-masked]>
Date: Tue, 29 Apr 2025 14:18:17 +0000

(on appveyor.yml)

Why do we have to change anything for this when we're only updating the JDK version?

---

From: "sehrope (@sehrope)" <[email-masked]>
Date: Tue, 29 Apr 2025 14:18:41 +0000

(on appveyor.yml)

Oh wait, is this because appveyor was completely broken before and now it might actually work?

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Tue, 29 Apr 2025 14:25:34 +0000

interestingly, ChatGPT figured out that `wal_keep_segments` configuration option was deprecated since PG 13, so it could be a reason for the failure when starting PostgreSQL 15/16 at AppVeyor: https://chatgpt.com/share/6810e0e1-9038-800f-acde-02e785eb28d1

---

From: "sehrope (@sehrope)" <[email-masked]>
Date: Tue, 29 Apr 2025 14:45:54 +0000

That's awesome. Looks like it's mostly working too.

I see some errors for the auth test. Feels like this appveyor stuff has been broken forever that I don't think whatever we did to the GHA environment to work was ever done there too (the explicit stuff in HBA to test the different auth types). If it's going to be annoying to get it to work, maybe just disable those tests on appveyor.

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Tue, 29 Apr 2025 15:53:48 +0000

There are still two failures, and I don't understand why the tests expect certain output values:

Here we fail to authenticate. Did we get the user right? Should it be pre-created when creating the DB? Should the DB be preconfigured somehow? I'm a bit lost here.

```
FAILURE   0.2sec, org.postgresql.test.util.PasswordUtilTest > mD5()
    java.lang.RuntimeException: Failed to authenticate using supplied user and password
        at org.postgresql.test.util.PasswordUtilTest.assertValidUsernamePassword(PasswordUtilTest.java:44)
        at org.postgresql.test.util.PasswordUtilTest.testUserPassword(PasswordUtilTest.java:79)
        at org.postgresql.test.util.PasswordUtilTest.testUserPassword(PasswordUtilTest.java:110)
        at org.postgresql.test.util.PasswordUtilTest.testUserPassword(PasswordUtilTest.java:125)
        at org.postgresql.test.util.PasswordUtilTest.mD5(PasswordUtilTest.java:152)
        Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "test_password_md5cb54c42fe0974f50"
            at app//org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:745)
            at app//org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:234)
            at app//org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:289)
            at app//org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:57)
            at app//org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:277)
            at app//org.postgresql.Driver.makeConnection(Driver.java:448)
            at app//org.postgresql.Driver.connect(Driver.java:298)
            at platform/[email-masked]/java.sql.DriverManager.getConnection(DriverManager.java:683)
            at platform/[email-masked]/java.sql.DriverManager.getConnection(DriverManager.java:191)
            at app//org.postgresql.test.TestUtil.openDB(TestUtil.java:401)
            at app//org.postgresql.test.util.PasswordUtilTest.assertValidUsernamePassword(PasswordUtilTest.java:40)
            ... 4 more
```

We get "The authentication type should match ==> expected: <MD5_PASSWORD> but was: <SASL>", however, it is hard to understand why exactly something should be MD5.

```
FAILURE   0.2sec, org.postgresql.test.plugin.AuthenticationPluginTest > authPluginMD5()
    org.opentest4j.AssertionFailedError: The authentication type should match ==> expected: <MD5_PASSWORD> but was: <SASL>
        at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
        at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1156)
        at app//org.postgresql.test.plugin.AuthenticationPluginTest.lambda$testAuthPlugin$0(AuthenticationPluginTest.java:55)
        at app//org.postgresql.test.plugin.AuthenticationPluginTest$DummyAuthenticationPlugin.getPassword(AuthenticationPluginTest.java:38)
        at app//org.postgresql.core.v3.AuthenticationPluginManager.withPassword(AuthenticationPluginManager.java:78)
        at app//org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:886)
        at app//org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:234)
        at app//org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:289)
        at app//org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:57)
        at app//org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:277)
        at app//org.postgresql.Driver.makeConnection(Driver.java:448)
        at app//org.postgresql.Driver.connect(Driver.java:298)
        at platform/[email-masked]/java.sql.DriverManager.getConnection(DriverManager.java:683)
        at platform/[email-masked]/java.sql.DriverManager.getConnection(DriverManager.java:191)
        at app//org.postgresql.test.TestUtil.openDB(TestUtil.java:401)
        at app//org.postgresql.test.plugin.AuthenticationPluginTest.testAuthPlugin(AuthenticationPluginTest.java:57)
        at app//org.postgresql.test.plugin.AuthenticationPluginTest.authPluginMD5(AuthenticationPluginTest.java:67)
```

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Tue, 29 Apr 2025 18:06:43 +0000

> Here we fail to authenticate. Did we get the user right? Should it be pre-created when creating the DB? Should the DB be preconfigured somehow? I'm a bit lost here.
Yes postgresql.conf has to have `#password_encryption = scram-sha-256    # scram-sha-256 or md5` set to `md5` for this to work.

by default the password_encryption will be set to scram-sha-256. I'd vote for dumping the md5 test

Dave

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Wed, 30 Apr 2025 09:35:30 +0000

(on docker/postgres-server/scripts/entrypoint.sh:39)

I'm not sure what was the reason to have `127.0.0.1/32` in the source `pg_hba.conf` file and replace it with `0.0.0.0/0` later, so I replaced the value with the base `pg_hba.conf` file so we don't need to replace them. At the same time, I replaced `0.0.0.0/0` with `all` to support both `ipv4` and `ipv6` ips.

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Wed, 30 Apr 2025 12:04:26 +0000

I commend your persistence here

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Wed, 30 Apr 2025 12:45:46 +0000

Even though I managed to get both `PG 11 and 16` tested at AppVeyor, I leave just 16 as each test run takes ~20 minutes, so waiting both is way too long

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Thu, 01 May 2025 12:13:48 +0000

Good work!