O-king opened a new issue, #20414:
URL: https://github.com/apache/shardingsphere/issues/20414

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   5.1.3-SNAPSHOT
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
    ShardingSphere-JDBC 
   ### Expected behavior
   return correct primary key
   ### Actual behavior
   return first db column
   ### Reason analyze (If you can)
   ShardingSphereConnection#prepareStatement(java.lang.String, 
java.lang.String[]) is not working
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   postgresql db:
   ```sql
   create table if not exists t_aa (
                   user_id VARCHAR(50) not null, 
                   id serial primary key, 
                   address_id BIGINT not null, 
                   status VARCHAR(50));
   ```
   ### Example codes for reproduce this issue (such as a github link).
   ```java
       public static void test(DataSource dataSource) throws SQLException {
           final Statement statement = 
dataSource.getConnection().createStatement();
           statement.execute("create table if not exists t_aa (\n" +
                   "                user_id VARCHAR(50) not null, \n" +
                   "                id serial primary key, \n" +
                   "                address_id BIGINT not null, \n" +
                   "                status VARCHAR(50));");
           
           final PreparedStatement preparedStatement = 
dataSource.getConnection().prepareStatement("INSERT INTO t_aa (user_id, 
address_id, status) " +
                           "VALUES (?,?,?);"
                   , new String[]{"id"});
           
           preparedStatement.setString(1, "a");
           preparedStatement.setLong(2, 2);
           preparedStatement.setString(3, "c");
           
           preparedStatement.execute();
           
           final ResultSet generatedKeys = preparedStatement.getGeneratedKeys();
           while (generatedKeys != null && generatedKeys.next()) {
               Object userId = generatedKeys.getObject(1);
               System.out.println("resultset userId:"+userId);
           }
       }
   ```


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

Reply via email to