Skip to content

Support '2'::int statement in PostgreSQL and openGauss#37962

Merged
strongduanmu merged 8 commits intoapache:masterfrom
ClaireLytt:postgresql
Feb 8, 2026
Merged

Support '2'::int statement in PostgreSQL and openGauss#37962
strongduanmu merged 8 commits intoapache:masterfrom
ClaireLytt:postgresql

Conversation

@ClaireLytt
Copy link
Contributor

Fixes #34976

Changes proposed in this pull request:


Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.
  • I have updated the Release Notes of the current development version. For more details, see Update Release Note

return new ParameterMarkerLimitValueSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ((ParameterMarkerExpressionSegment) astNode).getParameterMarkerIndex());
}
return new NumberLiteralLimitValueSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), Long.parseLong(((ExpressionSegment) astNode).getText()));
return toLimitValueSegment(ctx, (ExpressionSegment) visit(ctx.aExpr()));
Copy link
Member

Choose a reason for hiding this comment

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

Do you think createLimitValueSegment is better?

return toLimitValueSegment(ctx, (ExpressionSegment) visit(ctx.aExpr()));
}

private LimitValueSegment toLimitValueSegment(final ParserRuleContext ctx, final ExpressionSegment segment) {
Copy link
Member

Choose a reason for hiding this comment

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

Do you think createLimitValueSegment is better?

return new NumberLiteralLimitValueSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), Long.parseLong(literals.toString()));
}
return new NumberLiteralLimitValueSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), Long.parseLong(((ExpressionSegment) astNode).getText()));
throw new SQLParsingException("Unsupported LIMIT expression: " + segment.getText());
Copy link
Member

Choose a reason for hiding this comment

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

Why add this check? openGauss does not support limit segment?

Copy link
Member

@strongduanmu strongduanmu left a comment

Choose a reason for hiding this comment

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

Looks so great, thanks for your contribution.

@strongduanmu strongduanmu merged commit 4ce37f5 into apache:master Feb 8, 2026
148 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with limit '2'::int

2 participants