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 2020/08/09 04:02:26 UTC
[GitHub] [shardingsphere] sandynz commented on issue #6729: PostgreSQL plain insert doesn't work
sandynz commented on issue #6729:
URL: https://github.com/apache/shardingsphere/issues/6729#issuecomment-671003027
Reason analyze of "sql parameters not set".
InsertValueContext.parameterCount is 0, since related ExpressionSegment is not instanceof ParameterMarkerExpressionSegment.
```
InsertValueContext.java
private int calculateParametersCount(final Collection<ExpressionSegment> assignments) {
int result = 0;
for (ExpressionSegment each : assignments) {
if (each instanceof ParameterMarkerExpressionSegment) {
result++;
}
}
return result;
}
```
```
PostgreSQLDMLVisitor.java
private Collection<ExpressionSegment> createInsertValuesSegments(final ExprListContext ctx) {
Collection<ExpressionSegment> result = new LinkedList<>();
if (null != ctx.exprList()) {
Collection<ExpressionSegment> tmpResult = createInsertValuesSegments(ctx.exprList());
result.addAll(tmpResult);
}
visit(ctx.aExpr());
CommonExpressionSegment expressionSegment = new CommonExpressionSegment(ctx.aExpr().start.getStartIndex(), ctx.aExpr().stop.getStopIndex(), ctx.aExpr().getText());
result.add(expressionSegment);
return result;
}
```
Underlying expressionSegment result is ignored, and a new CommonExpressionSegment is created.
routeContext example:

----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org