This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new b8d19a21dae Fix postgreSQL NPE when parse columnRef (#30211)
b8d19a21dae is described below
commit b8d19a21dae702cd2454d132e65cd643d50020e8
Author: LotusMoon <[email protected]>
AuthorDate: Tue Feb 20 19:36:27 2024 +0800
Fix postgreSQL NPE when parse columnRef (#30211)
---
.../parser/postgresql/visitor/statement/PostgreSQLStatementVisitor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/parser/sql/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/PostgreSQLStatementVisitor.java
b/parser/sql/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/PostgreSQLStatementVisitor.java
index 8d1475eac7f..f02081615a8 100644
---
a/parser/sql/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/PostgreSQLStatementVisitor.java
+++
b/parser/sql/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/PostgreSQLStatementVisitor.java
@@ -517,7 +517,7 @@ public abstract class PostgreSQLStatementVisitor extends
PostgreSQLStatementPars
@Override
public ASTNode visitColumnref(final ColumnrefContext ctx) {
- if (null != ctx.indirection()) {
+ if (null != ctx.indirection() && null !=
ctx.indirection().indirectionEl().attrName()) {
AttrNameContext attrName =
ctx.indirection().indirectionEl().attrName();
ColumnSegment result = new
ColumnSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), new
IdentifierValue(attrName.getText()));
OwnerSegment owner = new
OwnerSegment(ctx.colId().start.getStartIndex(),
ctx.colId().stop.getStopIndex(), new IdentifierValue(ctx.colId().getText()));