susongyan opened a new issue, #25933:
URL: https://github.com/apache/shardingsphere/issues/25933
## Bug Report
### Which version of ShardingSphere did you use?
5.3.0
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
proxy
### Expected behavior
node typeorm, query pg boolean field display correct value
### Actual behavior
typeorm reflect always true for boolean field
### Reason analyze (If you can)
pg boolean is mapped to jdbc java.sql.Types.BIT(-7) related to java
boolean
so, the actual value in proxy(java) is boolean value
but PostgreSQLColumnType's mapping form java.sql.Types.BIT(-7) is
POSTGRESQL_TYPE_BIT(1560) now
the cliean (typeorm) cannot convert 'true' or 'false' text according to
typeOid(1560)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
t_test.bool_field type: boolean value: false
```java
String sql = "select bool_field from t_test where id = ?";
try (Connection conn = dataSource.getConnection()) {
PreparedStatement preparedStatement = conn.prepareStatement(sql);
preparedStatement.setString(1, "1");
ResultSet resultSet = preparedStatement.executeQuery();
if (resultSet.next()) {
return String.valueOf(resultSet.getBoolean("bool_field"));
}
} catch (Exception ex) {
throw ex;
}
```
JDBCPortal#bind queryHeader
<img width="357" alt="image"
src="https://github.com/apache/shardingsphere/assets/17156143/19fb0091-db66-48d1-9339-5691693f89b3">
PostgreSQLColumnDescription typeOid = POSTGRESQL_TYPE_BIT(1560)
<img width="469" alt="image"
src="https://github.com/apache/shardingsphere/assets/17156143/897bd22a-0687-44b1-8b0f-4d03fa63b6bd">
but JdbcPortal#execute row value is Boolean(false)
<img width="467" alt="image"
src="https://github.com/apache/shardingsphere/assets/17156143/c04f760d-63dc-44a4-b29e-f1f99536e3ea">
### Example codes for reproduce this issue (such as a github link).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]