You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/02/08 11:58:31 UTC
[shardingsphere] branch master updated: Fix modify column wrong index (#15294)
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 06f9cbb Fix modify column wrong index (#15294)
06f9cbb is described below
commit 06f9cbb4b18f3d8d00c14d542b6d45863821466f
Author: tuichenchuxin <86...@users.noreply.github.com>
AuthorDate: Tue Feb 8 19:57:28 2022 +0800
Fix modify column wrong index (#15294)
* add unsupported sql for pg/og doc
* Fix modify column wrong index
---
.../mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java | 2 +-
.../src/main/resources/case/ddl/alter-table.xml | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java
index 930c2a5..d8d5a11 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java
@@ -294,7 +294,7 @@ public final class MySQLDDLStatementSQLVisitor extends MySQLStatementSQLVisitor
private ColumnDefinitionSegment generateColumnDefinitionSegment(final ColumnSegment column, final FieldDefinitionContext ctx) {
DataTypeSegment dataTypeSegment = (DataTypeSegment) visit(ctx.dataType());
boolean isPrimaryKey = isPrimaryKey(ctx);
- return new ColumnDefinitionSegment(column.getStartIndex(), dataTypeSegment.getStopIndex(), column, dataTypeSegment, isPrimaryKey);
+ return new ColumnDefinitionSegment(column.getStartIndex(), ctx.getStop().getStopIndex(), column, dataTypeSegment, isPrimaryKey);
}
@Override
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-table.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-table.xml
index b4c58b1..7c9f9a4 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-table.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/alter-table.xml
@@ -621,7 +621,7 @@
<alter-table sql-case-id="alter_table_modify_unsigned_not_null">
<table name="t1" start-index="12" stop-index="13" />
<modify-column>
- <column-definition type="real" start-index="22" stop-index="37">
+ <column-definition type="real" start-index="22" stop-index="46">
<column name="c1" />
</column-definition>
</modify-column>
@@ -630,7 +630,7 @@
<alter-table sql-case-id="alter_table_modify_unsigned_zerofill_not_null">
<table name="t1" start-index="12" stop-index="13" />
<modify-column>
- <column-definition type="real" start-index="22" stop-index="46">
+ <column-definition type="real" start-index="22" stop-index="55">
<column name="c1" />
</column-definition>
</modify-column>