Subject: [pgjdbc/pgjdbc] PR #3796: Add configurable boolean-to-numeric conversion for ResultSet getters

From: "vwassan (@vwassan)" <[email-masked]>
Date: Fri, 12 Sep 2025 20:30:13 +0000

Addresses: https://github.com/pgjdbc/pgjdbc/issues/367

### Problem:
  When calling numeric getters (getByte(), getInt(), getLong(), getShort(), getFloat(), getDouble(), getBigDecimal()) on PostgreSQL boolean columns, the driver
  throws PSQLException: Bad value for type byte : f. 

  ### Solution:
  Added a new connection property `convertBooleanToNumeric` that enables automatic conversion of PostgreSQL boolean values to numeric types:
  - 't' → 1
  - 'f' → 0
  - Works with boolean columns
  - Property cached per connection for optimal performance
  - Boolean column type detection prevents false positive conversions

  ### Usage:
  // JDBC URL
  jdbc:postgresql://host:5432/db?convertBooleanToNumeric=true

  // HikariCP
  config.addDataSourceProperty("convertBooleanToNumeric", "true");

  // Spring Boot
  spring.datasource.hikari.data-source-properties.convertBooleanToNumeric=true

  ### Backward Compatibility:
  - Default: false (maintains existing behavior)
  - getBoolean() continues working regardless of property setting
  - No changes to existing application behavior unless explicitly enabled

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing](https://github.com/pgjdbc/pgjdbc/blob/master/CONTRIBUTING.md) document?
* [x] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change?

<!-- You can erase any parts of this template not applicable to your Pull Request. -->

### New Feature Submissions:

1. [x] Does your submission pass tests?
2. [x] Does `./gradlew styleCheck` pass ?
3. [x] Have you added your new test classes to an existing test suite in alphabetical order?

### Changes to Existing Features:

* [x] Does this break existing behaviour? If so please explain.
* [x] Have you added an explanation of what your changes do and why you'd like us to include them?
* [x] Have you written new tests for your core changes, as applicable?
* [x] Have you successfully run tests with your changes locally?

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Fri, 12 Sep 2025 21:33:54 +0000

(on pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java)

this has already been checked by the time you get here

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Fri, 12 Sep 2025 21:34:21 +0000

I don't believe there is a way for Postgres to return a capital T

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Fri, 12 Sep 2025 21:39:14 +0000

The conversions by ResultSet getter methods says get Float, Double, and BigDecimal should support this

---

From: "vwassan (@vwassan)" <[email-masked]>
Date: Sun, 14 Sep 2025 00:41:39 +0000

Thank you for the review comment. Made the changes.

---

From: "vwassan (@vwassan)" <[email-masked]>
Date: Sun, 14 Sep 2025 00:42:00 +0000

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Sun, 14 Sep 2025 11:28:28 +0000

(on docs/content/documentation/use.md)

Should probably update the comment here to include double, float, bigdecimal

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Sun, 14 Sep 2025 11:28:42 +0000

(on pgjdbc/src/main/java/org/postgresql/PGProperty.java)

same note about the comment

---

From: "vwassan (@vwassan)" <[email-masked]>
Date: Sun, 14 Sep 2025 13:58:59 +0000

Updated.

---

From: "vwassan (@vwassan)" <[email-masked]>
Date: Sun, 14 Sep 2025 13:59:08 +0000

Updated.

---

From: "vwassan (@vwassan)" <[email-masked]>
Date: Sun, 14 Sep 2025 16:31:56 +0000

@davecramer Made the changes. One SSL-related test on CI is failing. Not sure about it.