Skip to content

Commit b054825

Browse files
authored
ddl: fix prepare stmt with partition related ddl stmts (pingcap#54493)
close pingcap#54283
1 parent f8d87de commit b054825

File tree

3 files changed

+1
-18
lines changed

3 files changed

+1
-18
lines changed

ast/ast.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type Node interface {
4444
// SetText sets original text to the Node.
4545
SetText(enc charset.Encoding, text string)
4646
// SetOriginTextPosition set the start offset of this node in the origin text.
47+
// Only be called when `parser.lexer.skipPositionRecording` equals to false.
4748
SetOriginTextPosition(offset int)
4849
// OriginTextPosition get the start offset of this node in the origin text.
4950
OriginTextPosition() int

parser.go

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser.y

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,6 @@ AlterTableSpecSingleOpt:
21242124
startOffset := parser.yyVAL.offset
21252125
endOffset := parser.yylval.offset
21262126
partitionMethod.SetText(parser.lexer.client, parser.src[startOffset:endOffset])
2127-
partitionMethod.SetOriginTextPosition(startOffset)
21282127
$$ = &ast.AlterTableSpec{
21292128
Tp: ast.AlterTableReorganizeLastPartition,
21302129
Partition: &ast.PartitionOptions{PartitionMethod: partitionMethod},
@@ -2136,8 +2135,6 @@ AlterTableSpecSingleOpt:
21362135
startOffset := parser.yyVAL.offset
21372136
endOffset := parser.yylval.offset
21382137
partitionMethod.SetText(parser.lexer.client, parser.src[startOffset:endOffset])
2139-
// Needed for replacing syntactic sugar with generated partitioning definition string
2140-
partitionMethod.SetOriginTextPosition(startOffset)
21412138
$$ = &ast.AlterTableSpec{
21422139
Tp: ast.AlterTableReorganizeFirstPartition,
21432140
Partition: &ast.PartitionOptions{PartitionMethod: partitionMethod},
@@ -2318,8 +2315,6 @@ AlterTableSpec:
23182315
startOffset := parser.yyVAL.offset
23192316
endOffset := parser.yylval.offset
23202317
partitionMethod.SetText(parser.lexer.client, parser.src[startOffset:endOffset])
2321-
// Needed for replacing syntactic sugar with generated partitioning definition string
2322-
partitionMethod.SetOriginTextPosition(startOffset)
23232318
$$ = &ast.AlterTableSpec{
23242319
NoWriteToBinlog: noWriteToBinlog,
23252320
Tp: ast.AlterTableAddLastPartition,
@@ -2406,8 +2401,6 @@ AlterTableSpec:
24062401
startOffset := parser.yyVAL.offset
24072402
endOffset := parser.yylval.offset
24082403
partitionMethod.SetText(parser.lexer.client, parser.src[startOffset:endOffset])
2409-
// Needed for replacing syntactic sugar with generated partitioning definition string
2410-
partitionMethod.SetOriginTextPosition(startOffset)
24112404
$$ = &ast.AlterTableSpec{
24122405
IfExists: $8.(bool),
24132406
Tp: ast.AlterTableDropFirstPartition,
@@ -4713,8 +4706,6 @@ PartitionIntervalOpt:
47134706
startOffset := parser.yyVAL.offset
47144707
endOffset := parser.yylval.offset
47154708
partitionInterval.SetText(parser.lexer.client, parser.src[startOffset:endOffset])
4716-
// Needed for replacing syntactic sugar with generated partitioning definition string
4717-
partitionInterval.SetOriginTextPosition(startOffset)
47184709
$$ = partitionInterval
47194710
}
47204711

0 commit comments

Comments
 (0)