Subject: [pgjdbc/pgjdbc] issue #3761: BaseDataSource getProperty does not get all properties.

From: "simon-greatrix (@simon-greatrix)" <[email-masked]>
Date: Wed, 13 Aug 2025 22:57:38 +0000

You can set properties that you cannot get.

I believe the following unit test should succeed:

```
  @ParameterizedTest
  @CsvSource({
      "PGHOST,'database1.test,database2.test",
      "PGPORT,'1234,5678'",
      "PGDNAME,my-postgresql",
      "user,the-test-user",
      "password,the-test-password",
      
      // And one working one to prove the test can be passed
      "ApplicationName,my-application"
  })
  void settableShouldBeReadable(String propertyName, String testValue) {
    PGProperty property = PGProperty.forName(propertyName);
    assertNotNull(property);

    PGSimpleDataSource dataSource = new PGSimpleDataSource();
    dataSource.setProperty(property, testValue);
    assertEquals(testValue, dataSource.getProperty(property));
  }
```

**Describe the issue**
The five properties referenced in the unit test above can be set, but cannot be read. This is because the getProperty method only references the internal properties object, but the setting handles these five properties specially.

**Driver Version?** 
42.7.7

**Java Version?**
Not applicable

**OS Version?**
Not applicable

**PostgreSQL Version?**
Not applicable

**To Reproduce**
Run JUnit test above.

**Expected behaviour**
If a property has been set using setProperty or a direct setter, then the value should be retrievable using getProperty.

**Logs**
Not applicable

---

From: "simon-greatrix (@simon-greatrix)" <[email-masked]>
Date: Mon, 18 Aug 2025 11:26:09 +0000

In writing a unit test I have discovered a related issue:

```
PGSimpleDataSource dataSource = new PGSimpleDataSource();
dataSource.setLoadBalanceHosts(false);
assertFalse( dataSource.getLoadBalanceHosts() );
```

The `getLoadBalanceHosts()` method returns true if any value is set, even if the value is `false`.

Should we create a new issue for this or expand the scope of this one to cover it?

---

From: "simon-greatrix (@simon-greatrix)" <[email-masked]>
Date: Wed, 27 Aug 2025 07:03:26 +0000

Is there anything blocking the merge request for this?