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/11/25 08:06:14 UTC
[GitHub] [shardingsphere] TeslaCN opened a new issue, #22407: Parameters lost after KernelProcessor.generateExecutionContext
TeslaCN opened a new issue, #22407:
URL: https://github.com/apache/shardingsphere/issues/22407
## Bug Report
### Which version of ShardingSphere did you use?
master - a1da19a3471f1f87ec7e1eb45e25a42322ad249c
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy PostgreSQL.
### Expected behavior
Data inserted.
### Actual behavior
Client:
```
Exception in thread "main" org.postgresql.util.PSQLException: ERROR: No value specified for parameter 1.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2365)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:355)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:166)
at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:134)
```
Proxy:
```
[INFO ] 2022-11-25 16:05:30.051 [Connection-1-ThreadExecutor] ShardingSphere-SQL - Logic SQL: INSERT INTO f (col_f, col_d) VALUES (?::REAL, ?::DOUBLE PRECISION)
[INFO ] 2022-11-25 16:05:30.051 [Connection-1-ThreadExecutor] ShardingSphere-SQL - SQLStatement: PostgreSQLInsertStatement(super=InsertStatement(super=AbstractSQLStatement(parameterCount=2, parameterMarkerSegments=[ParameterMarkerExpressionSegment(startIndex=37, stopIndex=37, parameterMarkerIndex=0, parameterMarkerType=QUESTION, alias=Optional.empty), ParameterMarkerExpressionSegment(startIndex=46, stopIndex=46, parameterMarkerIndex=1, parameterMarkerType=QUESTION, alias=Optional.empty)], commentSegments=[]), table=SimpleTableSegment(tableName=TableNameSegment(startIndex=12, stopIndex=12, identifier=IdentifierValue(value=f, quoteCharacter=NONE)), owner=Optional.empty, alias=Optional.empty), insertColumns=Optional[InsertColumnsSegment(startIndex=14, stopIndex=27, columns=[ColumnSegment(startIndex=15, stopIndex=19, identifier=IdentifierValue(value=col_f, quoteCharacter=NONE), owner=Optional.empty), ColumnSegment(startIndex=22, stopIndex=26, identifier=IdentifierValue(value=col_d, qu
oteCharacter=NONE), owner=Optional.empty)])], insertSelect=Optional.empty, values=[InsertValuesSegment(startIndex=36, stopIndex=65, values=[CommonExpressionSegment(startIndex=37, stopIndex=43, text=?::REAL), CommonExpressionSegment(startIndex=46, stopIndex=64, text=?::DOUBLE PRECISION)])]), withSegment=Optional.empty, onDuplicateKeyColumnsSegment=null, returningSegment=Optional.empty)
[INFO ] 2022-11-25 16:05:30.052 [Connection-1-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_0 ::: INSERT INTO f (col_f, col_d) VALUES (?::REAL, ?::DOUBLE PRECISION)
[ERROR] 2022-11-25 16:05:30.079 [Connection-1-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
org.postgresql.util.PSQLException: No value specified for parameter 1.
at org.postgresql.core.v3.SimpleParameterList.checkAllParametersSet(SimpleParameterList.java:284)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:340)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:181)
at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:170)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.impl.ProxyPreparedStatementExecutorCallback.execute(ProxyPreparedStatementExecutorCallback.java:43)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:75)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:68)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:45)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:90)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:69)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:135)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.parallelExecute(ExecutorEngine.java:131)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:116)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:67)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.ProxyJDBCExecutor.execute(ProxyJDBCExecutor.java:75)
at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.useDriverToExecute(ProxySQLExecutor.java:229)
at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.doExecute(ProxySQLExecutor.java:186)
at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:151)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:131)
at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.JDBCPortal.bind(JDBCPortal.java:101)
at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.bind.PostgreSQLComBindExecutor.execute(PostgreSQLComBindExecutor.java:53)
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:111)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
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)
```
### Reason analyze (If you can)
![image](https://user-images.githubusercontent.com/20503072/203930697-cc219a7b-d460-4416-87c3-8e930f4bc556.png)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
No rule configured.
```yaml
schemaName: postgres
dataSources:
ds_0:
url: jdbc:postgresql://127.0.0.1:5432/postgres?prepareThreshold=1
username: postgres
password: postgres
connectionTimeoutMilliseconds: 3000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 32
minPoolSize: 0
```
### Example codes for reproduce this issue (such as a github link).
```sql
create table f (col_d double precision, col_f real);
```
```java
try (PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO f (col_f, col_d) VALUES (?::REAL, ?::DOUBLE PRECISION)")) {
preparedStatement.setObject(1, "Infinity");
preparedStatement.setObject(2, "Infinity");
preparedStatement.executeUpdate();
}
```
--
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] zhaojinchao95 closed issue #22407: Parameters lost after KernelProcessor.generateExecutionContext
Posted by GitBox <gi...@apache.org>.
zhaojinchao95 closed issue #22407: Parameters lost after KernelProcessor.generateExecutionContext
URL: https://github.com/apache/shardingsphere/issues/22407
--
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
[GitHub] [shardingsphere] TeslaCN commented on issue #22407: Parameters lost after KernelProcessor.generateExecutionContext
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #22407:
URL: https://github.com/apache/shardingsphere/issues/22407#issuecomment-1364970814
We have extracted all `parameterMarkerSegments` in AbstractSQLStatement, could we consider extracting it by `startIndex` and `stopIndex`?
--
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
[GitHub] [shardingsphere] TeslaCN commented on issue #22407: Parameters lost after KernelProcessor.generateExecutionContext
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #22407:
URL: https://github.com/apache/shardingsphere/issues/22407#issuecomment-1364971427
This issue is similar with https://github.com/apache/shardingsphere/issues/12272
--
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
[GitHub] [shardingsphere] FlyingZC commented on issue #22407: Parameters lost after KernelProcessor.generateExecutionContext
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on issue #22407:
URL: https://github.com/apache/shardingsphere/issues/22407#issuecomment-1364953044
![image](https://user-images.githubusercontent.com/19788130/209516305-9f94b0fb-2d25-4f8f-8f23-497cf261c477.png)
![image](https://user-images.githubusercontent.com/19788130/209516808-dad97e0b-f4dc-4801-939f-606c0d1d7bc7.png)
The visit logic does not handle this scenario, and when query context information is extracted, the corresponding parameters are not extracted.
--
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
[GitHub] [shardingsphere] TeslaCN commented on issue #22407: Parameters lost after KernelProcessor.generateExecutionContext
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #22407:
URL: https://github.com/apache/shardingsphere/issues/22407#issuecomment-1327144629
I found this may relate to `InsertStatementContext`.
![image](https://user-images.githubusercontent.com/20503072/203933842-4371a05d-adb4-46bf-b450-f4833841d605.png)
--
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
[GitHub] [shardingsphere] FlyingZC commented on issue #22407: Parameters lost after KernelProcessor.generateExecutionContext
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on issue #22407:
URL: https://github.com/apache/shardingsphere/issues/22407#issuecomment-1327318114
I want to investigate this issue, please assign me. @strongduanmu
--
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
[GitHub] [shardingsphere] TeslaCN commented on issue #22407: Parameters lost after KernelProcessor.generateExecutionContext
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #22407:
URL: https://github.com/apache/shardingsphere/issues/22407#issuecomment-1364942450
Hi @FlyingZC
Any progress?
--
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