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 2022/04/25 12:06:30 UTC

[GitHub] [shardingsphere] TeslaCN opened a new issue, #17098: NPE occurred in ShardingSphere-Proxy PostgreSQL caused by case of column name unmatched

TeslaCN opened a new issue, #17098:
URL: https://github.com/apache/shardingsphere/issues/17098

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   Since 5.1.0
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   No error occurred.
   
   ### Actual behavior
   
   ```
   java.lang.NullPointerException: Cannot invoke "org.apache.shardingsphere.infra.metadata.schema.model.ColumnMetaData.getDataType()" because the return value of "java.util.Map.get(Object)" is null
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.describe.PostgreSQLComDescribeExecutor.describeInsertStatementByShardingSphereMetaData(PostgreSQLComDescribeExecutor.java:152)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.describe.PostgreSQLComDescribeExecutor.tryDescribePreparedStatement(PostgreSQLComDescribeExecutor.java:108)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.describe.PostgreSQLComDescribeExecutor.describePreparedStatement(PostgreSQLComDescribeExecutor.java:100)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.describe.PostgreSQLComDescribeExecutor.execute(PostgreSQLComDescribeExecutor.java:84)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.PostgreSQLAggregatedCommandExecutor.execute(PostgreSQLAggregatedCommandExecutor.java:41)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:107)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77)
   	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
   	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
   	at java.base/java.lang.Thread.run(Thread.java:833)
   ```
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ```SQL
   create table sbtest1
   (
       id  integer                      not null
           primary key,
       k   integer   default 0          not null,
       c   char(120) default ''::bpchar not null,
       pad char(60)  default ''::bpchar not null
   );
   ```
   
   Describe prepared statement with the following SQL:
   ```sql
   insert into sbtest1 (id, K, c, pad) values (?, ?, ?, ?) returning id, k
   ```
   
   Please notice that the `K` is upper case in SQL but lower case in DDL.
   
   ### Example codes for reproduce this issue (such as a github link).
   
   
   ```java
   public class PostgreSQLDescribePreparedStatement {
       
       public static void main(String[] args) throws Exception {
           try (Connection connection = getConnection()) {
               try (PreparedStatement preparedStatement = connection.prepareStatement("insert into sbtest1 (id, K, c, pad) values (?, ?, ?, ?) returning id, k")) {
                   ResultSetMetaData resultSetMetaData = preparedStatement.getMetaData();
               }
           }
       }
       
       @SneakyThrows
       private static Connection getConnection() {
           return DriverManager.getConnection("jdbc:postgresql://127.0.0.1:55432/sbtest_sharding?prepareThreshold=1", "postgres", "postgres");
       }
   }
   
   ```
   


-- 
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] zjcnb closed issue #17098: NPE occurred in ShardingSphere-Proxy PostgreSQL caused by case of column name unmatched

Posted by GitBox <gi...@apache.org>.
zjcnb closed issue #17098: NPE occurred in ShardingSphere-Proxy PostgreSQL caused by case of column name unmatched
URL: https://github.com/apache/shardingsphere/issues/17098


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