Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix set OnDuplicateKeyColumnsSegment on PostgreSQLInsertStatement #34425

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ public ASTNode visitInsert(final InsertContext ctx) {
OpenGaussInsertStatement result = (OpenGaussInsertStatement) visit(ctx.insertRest());
result.setTable((SimpleTableSegment) visit(ctx.insertTarget()));
if (null != ctx.optOnDuplicateKey()) {
result.setOnDuplicateKeyColumnsSegment((OnDuplicateKeyColumnsSegment) visit(ctx.optOnDuplicateKey()));
result.setOnDuplicateKeyColumns((OnDuplicateKeyColumnsSegment) visit(ctx.optOnDuplicateKey()));
}
if (null != ctx.returningClause()) {
result.setReturningSegment((ReturningSegment) visit(ctx.returningClause()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ public ASTNode visitInsert(final InsertContext ctx) {
PostgreSQLInsertStatement result = (PostgreSQLInsertStatement) visit(ctx.insertRest());
result.setTable((SimpleTableSegment) visit(ctx.insertTarget()));
if (null != ctx.optOnConflict()) {
result.setOnDuplicateKeyColumnsSegment((OnDuplicateKeyColumnsSegment) visit(ctx.optOnConflict()));
result.setOnDuplicateKeyColumns((OnDuplicateKeyColumnsSegment) visit(ctx.optOnConflict()));
}
if (null != ctx.returningClause()) {
result.setReturningSegment((ReturningSegment) visit(ctx.returningClause()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public final class OpenGaussInsertStatement extends InsertStatement implements O

private WithSegment withSegment;

private OnDuplicateKeyColumnsSegment onDuplicateKeyColumnsSegment;
private OnDuplicateKeyColumnsSegment onDuplicateKeyColumns;

private ReturningSegment returningSegment;

Expand All @@ -45,7 +45,7 @@ public Optional<WithSegment> getWithSegment() {

@Override
public Optional<OnDuplicateKeyColumnsSegment> getOnDuplicateKeyColumns() {
return Optional.ofNullable(onDuplicateKeyColumnsSegment);
return Optional.ofNullable(onDuplicateKeyColumns);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public final class PostgreSQLInsertStatement extends InsertStatement implements

private WithSegment withSegment;

private OnDuplicateKeyColumnsSegment onDuplicateKeyColumnsSegment;
private OnDuplicateKeyColumnsSegment onDuplicateKeyColumns;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check openGauss insert statement? Since they are same database dialect.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, they have the same problem


private ReturningSegment returningSegment;

Expand All @@ -45,7 +45,7 @@ public Optional<WithSegment> getWithSegment() {

@Override
public Optional<OnDuplicateKeyColumnsSegment> getOnDuplicateKeyColumns() {
return Optional.ofNullable(onDuplicateKeyColumnsSegment);
return Optional.ofNullable(onDuplicateKeyColumns);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides, you need add sql parser test for this change.

}

@Override
Expand Down
Loading