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/31 09:18:40 UTC

[GitHub] [shardingsphere] susongyan opened a new issue, #25960: proxy not deal with non-ordinal prameterIndexs for pg

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

   ## 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
   update using node typeorm
   
   ` UPDATE "t_alert_rule" SET "alert_persons" = $2, "update_time" = CURRENT_TIMESTAMP WHERE "id" IN ($1) RETURNING "update_time"`
   
   update succes
   
   ### Actual behavior
   org.postgresql.util.PSQLException: ERROR: invalid input syntax for integer: ""["test"]""
   
   ### Reason analyze (If you can)
   `UPDATE "t_alert_rule" SET "alert_persons" = $2, "update_time" = CURRENT_TIMESTAMP WHERE "id" IN ($1) RETURNING "update_time”`
   this sql parameter marker index  order is not from small to large 
   
   (1) in 'parse' phase, `PostgreSQLComParseExecutor#execute`   will  convert the sql to jdbc style
   
   ```java
      public Collection<DatabasePacket> execute() {
           SQLParserEngine sqlParserEngine = createShardingSphereSQLParserEngine(connectionSession.getDatabaseName());
           String sql = packet.getSQL();
           SQLStatement sqlStatement = sqlParserEngine.parse(sql, true);
           if (sqlStatement.getParameterCount() > 0) {
               sql = convertSQLToJDBCStyle(sqlStatement, sql);
               sqlStatement = sqlParserEngine.parse(sql, true);
           }
   ```
   
   then final sql is  `UPDATE "t_alert_rule" SET "alert_persons" = ?, "update_time" = CURRENT_TIMESTAMP WHERE "id" IN (?) RETURNING "update_time” ` 
   
   (2) in 'bind' phase ,  parameters passed is according to pg actual parameter index 
   parameters:
   1. bigint  id  123 
   2. json alert_persons  "["test"]"
   
   **actual parameters  mis match  marker index ** 
   
   


-- 
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] TeslaCN closed issue #25960: proxy not deal with non-ordinal prameterIndexs for pg

Posted by "TeslaCN (via GitHub)" <gi...@apache.org>.
TeslaCN closed issue #25960: proxy not deal with non-ordinal prameterIndexs for pg 
URL: https://github.com/apache/shardingsphere/issues/25960


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