feat: deepen dialect system — dialect-aware parsing (#323)#336
feat: deepen dialect system — dialect-aware parsing (#323)#336ajitpratap0 merged 5 commits intomainfrom
Conversation
|
Claude finished @ajitpratap0's task —— View job PR Review: Dialect System DeepeningReviewing the dialect system enhancements that add parse-time dialect validation. Todo List
✅ Overall AssessmentThis is a well-implemented feature that successfully adds dialect-aware parsing restrictions to GoSQLX. The changes are clean, well-tested, and maintain backward compatibility while adding meaningful functionality. 🎯 StrengthsExcellent Architecture & Design
Robust Implementation
Excellent Test Coverage
🔧 Code Quality HighlightsSmart Implementation Patterns// pkg/sql/parser/expressions.go:171-178
// Only enforces ILIKE restriction when dialect is explicitly set
if strings.EqualFold(operator, "ILIKE") &&
p.dialect != "" && // Key insight: empty dialect bypasses restriction
p.dialect != string(keywords.DialectPostgreSQL) {User-Friendly Error Messages// pkg/sql/parser/select.go:1057-1060
return fmt.Errorf(
"LIMIT clause is not supported in SQL Server; use TOP or OFFSET/FETCH NEXT instead",
)Efficient Helper Functions// pkg/sql/keywords/dialect.go:102-112
func IsValidDialect(name string) bool {
if name == "" { return true } // Smart default handling
for _, d := range AllDialects() {
if string(d) == name { return true }
}
return false
}
|
|
Claude finished @ajitpratap0's task —— View job PR Review: Dialect System DeepeningReviewing the dialect system enhancements that add parse-time dialect validation. Todo List
✅ Overall AssessmentThis is a well-implemented feature that successfully adds dialect-aware parsing restrictions to GoSQLX. The changes are clean, well-tested, and maintain backward compatibility while adding meaningful functionality. 🎯 StrengthsExcellent Architecture & Design
Robust Implementation
Excellent Test Coverage
🔧 Code Quality HighlightsSmart Implementation Patterns// pkg/sql/parser/expressions.go:171-173
// Only enforces ILIKE restriction when dialect is explicitly set
if strings.EqualFold(operator, "ILIKE") &&
p.dialect != "" && // Key insight: empty dialect bypasses restriction
p.dialect != string(keywords.DialectPostgreSQL) {User-Friendly Error Messages// pkg/sql/parser/select.go:1060-1064
msg := "LIMIT clause is not supported in SQL Server; use TOP or OFFSET/FETCH NEXT instead"
if p.dialect == string(keywords.DialectOracle) {
msg = "LIMIT clause is not supported in Oracle; use ROWNUM or FETCH FIRST … ROWS ONLY instead"
}Efficient Helper Functions// pkg/sql/keywords/dialect.go:102-112
func IsValidDialect(name string) bool {
if name == "" { return true } // Smart default handling
for _, d := range AllDialects() {
if string(d) == name { return true }
}
return false
}
|
cdc4850 to
8b836f0
Compare
|
Claude finished @ajitpratap0's task —— View job PR Review: Dialect System DeepeningReviewing the dialect system enhancements that add parse-time dialect validation. Todo List
✅ Overall AssessmentThis is a well-implemented feature that successfully adds dialect-aware parsing restrictions to GoSQLX. The changes are clean, well-tested, and maintain backward compatibility while adding meaningful functionality. 🎯 StrengthsExcellent Architecture & Design
Robust Implementation
Excellent Test Coverage
🔧 Code Quality HighlightsSmart Implementation Patterns// pkg/sql/parser/expressions.go:171-173
// Only enforces ILIKE restriction when dialect is explicitly set
if strings.EqualFold(operator, "ILIKE") &&
p.dialect != "" && // Key insight: empty dialect bypasses restriction
p.dialect != string(keywords.DialectPostgreSQL) {User-Friendly Error Messages// pkg/sql/parser/select.go:1120-1124
msg := "LIMIT clause is not supported in SQL Server; use TOP or OFFSET/FETCH NEXT instead"
if p.dialect == string(keywords.DialectOracle) {
msg = "LIMIT clause is not supported in Oracle; use ROWNUM or FETCH FIRST … ROWS ONLY instead"
}Efficient Helper Functions// pkg/sql/keywords/dialect.go:102-112
func IsValidDialect(name string) bool {
if name == "" { return true } // Smart default handling
for _, d := range AllDialects() {
if string(d) == name { return true }
}
return false
}
|
|
Claude finished @ajitpratap0's task —— View job PR Review: Dialect System DeepeningReviewing the dialect system enhancements that add parse-time dialect validation. Todo List
✅ Overall AssessmentThis is a well-implemented feature that successfully adds dialect-aware parsing restrictions to GoSQLX. The changes are clean, well-tested, and maintain backward compatibility while adding meaningful functionality. 🎯 StrengthsExcellent Architecture & Design
Robust Implementation
Excellent Test Coverage
🔧 Code Quality HighlightsSmart Implementation Patterns// pkg/sql/parser/expressions.go:171-173
// Only enforces ILIKE restriction when dialect is explicitly set
if strings.EqualFold(operator, "ILIKE") &&
p.dialect != "" && // Key insight: empty dialect bypasses restriction
p.dialect != string(keywords.DialectPostgreSQL) {User-Friendly Error Messages// pkg/sql/parser/select.go:1120-1124
msg := "LIMIT clause is not supported in SQL Server; use TOP or OFFSET/FETCH NEXT instead"
if p.dialect == string(keywords.DialectOracle) {
msg = "LIMIT clause is not supported in Oracle; use ROWNUM or FETCH FIRST … ROWS ONLY instead"
}Efficient Helper Functions// pkg/sql/keywords/dialect.go:102-112
func IsValidDialect(name string) bool {
if name == "" { return true } // Smart default handling
for _, d := range AllDialects() {
if string(d) == name { return true }
}
return false
}
|
Closes #323
Summary
Deepens the dialect system so that dialect-specific syntax is actively gated at parse time, rather than merely having keyword lists.
Changes
pkg/sql/keywords/dialect.go
pkg/sql/parser/select.go
pkg/sql/parser/expressions.go
pkg/sql/parser/validate.go
cmd/gosqlx/cmd/validate.go
pkg/sql/parser/dialect_test.go