You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/10/20 09:10:37 UTC

[GitHub] [shardingsphere] TeslaCN commented on issue #13139: PostgreSQLTimeBinaryProtocolValue bug

TeslaCN commented on issue #13139:
URL: https://github.com/apache/shardingsphere/issues/13139#issuecomment-947476148


   I've reproduced this issue in master branch.
   
   ```sql
   create table ts (n varchar, t timestamp(6) default current_timestamp not null);
   ```
   
   ```java
   public class PostgreSQLTimestamp {
       
       public static void main(String[] args) throws Exception {
           try (Connection connection = getConnection()) {
               try (PreparedStatement preparedStatement = connection.prepareStatement("select * from ts")) {
                   for (int i = 0; i < 10; i++) {
                       try (ResultSet resultSet = preparedStatement.executeQuery()) {
                           while (resultSet.next()) {
                               System.out.println(resultSet.getTimestamp(1));
                           }
                       }
                   }
               }
           }
       }
       
       @SneakyThrows
       private static Connection getConnection() {
           return DriverManager.getConnection("jdbc:postgresql://127.0.0.1:3307/wuweijie", "postgres", "postgres");
       }
   }
   ```
   
   Output:
   ```
   2021-10-20 16:50:17.408992
   2021-10-20 16:50:17.408992
   2021-10-20 16:50:17.408992
   2021-10-20 16:50:17.408992
   2021-10-20 16:50:17.408992
   2000-01-19 22:05:19.817408
   2000-01-19 22:05:19.817408
   2000-01-19 22:05:19.817408
   2000-01-19 22:05:19.817408
   2000-01-19 22:05:19.817408
   ```


-- 
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