You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "susongyan (via GitHub)" <gi...@apache.org> on 2023/05/29 08:20:57 UTC
[GitHub] [shardingsphere] susongyan opened a new issue, #25933: proxy query pg bool, column description's typeOid is not match with actual value
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] susongyan commented on issue #25933: proxy query pg bool, column description's typeOid is not match with actual value
Posted by "susongyan (via GitHub)" <gi...@apache.org>.
susongyan commented on issue #25933:
URL: https://github.com/apache/shardingsphere/issues/25933#issuecomment-1566792056
jdbc bit mapped to pg bool(16) works
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] TeslaCN closed issue #25933: proxy query pg bool, column description's typeOid is not match with actual value
Posted by "TeslaCN (via GitHub)" <gi...@apache.org>.
TeslaCN closed issue #25933: proxy query pg bool, column description's typeOid is not match with actual value
URL: https://github.com/apache/shardingsphere/issues/25933
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org