Skip to content

Commit 5950417

Browse files
kyleconroyclaude
andcommitted
Add optional equals sign handling for fulltext index options
Handle the optional = sign in CREATE FULLTEXT INDEX WITH clause for CHANGE_TRACKING and STOPLIST options. Also handle optional parentheses around WITH clause options and fix ALTER FULLTEXT INDEX SET STOPLIST to accept optional = sign. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent db18793 commit 5950417

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

parser/parse_ddl.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8656,6 +8656,10 @@ func (p *Parser) tryParseAlterFullTextIndexAction() ast.AlterFullTextIndexAction
86568656
} else if strings.ToUpper(p.curTok.Literal) == "STOPLIST" {
86578657
// Parse SET STOPLIST OFF | SYSTEM | name [WITH NO POPULATION]
86588658
p.nextToken() // consume STOPLIST
8659+
// Handle optional = sign
8660+
if p.curTok.Type == TokenEquals {
8661+
p.nextToken() // consume =
8662+
}
86598663
action := &ast.SetStopListAlterFullTextIndexAction{
86608664
StopListOption: &ast.StopListFullTextIndexOption{
86618665
OptionKind: "StopList",

parser/parse_statements.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12836,11 +12836,23 @@ func (p *Parser) parseCreateFulltextStatement() (ast.Statement, error) {
1283612836
// Parse WITH clause
1283712837
if p.curTok.Type == TokenWith {
1283812838
p.nextToken() // consume WITH
12839+
12840+
// Handle optional parentheses: WITH (option, option) vs WITH option
12841+
hasParen := false
12842+
if p.curTok.Type == TokenLParen {
12843+
hasParen = true
12844+
p.nextToken() // consume (
12845+
}
12846+
1283912847
noPopulation := false
1284012848
for {
1284112849
optLit := strings.ToUpper(p.curTok.Literal)
1284212850
if optLit == "CHANGE_TRACKING" {
1284312851
p.nextToken() // consume CHANGE_TRACKING
12852+
// Handle optional = sign
12853+
if p.curTok.Type == TokenEquals {
12854+
p.nextToken() // consume =
12855+
}
1284412856
var trackingValue string
1284512857
if strings.ToUpper(p.curTok.Literal) == "MANUAL" {
1284612858
trackingValue = "Manual"
@@ -12862,6 +12874,10 @@ func (p *Parser) parseCreateFulltextStatement() (ast.Statement, error) {
1286212874
})
1286312875
} else if optLit == "STOPLIST" {
1286412876
p.nextToken() // consume STOPLIST
12877+
// Handle optional = sign
12878+
if p.curTok.Type == TokenEquals {
12879+
p.nextToken() // consume =
12880+
}
1286512881
opt := &ast.StopListFullTextIndexOption{
1286612882
OptionKind: "StopList",
1286712883
}
@@ -12889,6 +12905,9 @@ func (p *Parser) parseCreateFulltextStatement() (ast.Statement, error) {
1288912905
}
1289012906
}
1289112907
}
12908+
} else if hasParen && p.curTok.Type == TokenRParen {
12909+
p.nextToken() // consume )
12910+
break
1289212911
} else {
1289312912
break
1289412913
}
@@ -12897,6 +12916,9 @@ func (p *Parser) parseCreateFulltextStatement() (ast.Statement, error) {
1289712916
p.nextToken() // consume comma
1289812917
} else if p.curTok.Type == TokenSemicolon || p.curTok.Type == TokenEOF {
1289912918
break
12919+
} else if hasParen && p.curTok.Type == TokenRParen {
12920+
p.nextToken() // consume )
12921+
break
1290012922
}
1290112923
}
1290212924
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"todo": true}
1+
{}

0 commit comments

Comments
 (0)