Skip to content

Commit b95d8e3

Browse files
fix: StructType expressions must use Visitor instead of toString()
Signed-off-by: Andreas Reichel <[email protected]>
1 parent be87c74 commit b95d8e3

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/main/java/net/sf/jsqlparser/util/deparser/ExpressionDeParser.java

+10-7
Original file line numberDiff line numberDiff line change
@@ -1169,9 +1169,9 @@ public void visit(AllValue allValue) {
11691169

11701170
@Override
11711171
public void visit(IsDistinctExpression isDistinctExpression) {
1172-
buffer.append(isDistinctExpression.getLeftExpression()
1173-
+ isDistinctExpression.getStringExpression()
1174-
+ isDistinctExpression.getRightExpression());
1172+
buffer.append(isDistinctExpression.getLeftExpression())
1173+
.append(isDistinctExpression.getStringExpression())
1174+
.append(isDistinctExpression.getRightExpression());
11751175
}
11761176

11771177
@Override
@@ -1226,8 +1226,8 @@ public void visit(StructType structType) {
12261226
buffer.append(",");
12271227
}
12281228
buffer.append(e.getAlias().getName());
1229-
buffer.append(":");
1230-
buffer.append(e.getExpression());
1229+
buffer.append(" : ");
1230+
e.getExpression().accept(this);
12311231
}
12321232
buffer.append(" }");
12331233
} else {
@@ -1237,9 +1237,12 @@ public void visit(StructType structType) {
12371237
if (0 < i++) {
12381238
buffer.append(",");
12391239
}
1240-
e.appendTo(buffer);
1240+
e.getExpression().accept(this);
1241+
if (e.getAlias() != null) {
1242+
buffer.append(" as ");
1243+
buffer.append(e.getAlias().getName());
1244+
}
12411245
}
1242-
12431246
buffer.append(")");
12441247
}
12451248
}

0 commit comments

Comments
 (0)