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:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]