Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion go/vt/sqlparser/normalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ func newNormalizer(
// It handles normalization logic based on node types.
func (nz *normalizer) walkDown(node, _ SQLNode) bool {
switch node := node.(type) {
case *Begin, *Commit, *Rollback, *Savepoint, *SRollback, *Release, *OtherAdmin, *Analyze, *AssignmentExpr,
case *AssignmentExpr:
nz.err = vterrors.VT12001("Assignment expression")
return false
case *Begin, *Commit, *Rollback, *Savepoint, *SRollback, *Release, *OtherAdmin, *Analyze,
*PrepareStmt, *ExecuteStmt, *FramePoint, *ColName, TableName, *ConvertType:
// These statement don't need normalizing
return false
Expand Down
6 changes: 6 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1327,9 +1327,15 @@ var (
input: "update /* a.b */ a.b set b = 3",
}, {
input: "update a.b set d = @v := d + 7 where u = 42",
// Assignment expresions aren't supported, so we skip the normalizer test.
// We only support parsing these expressions.
ignoreNormalizerTest: true,
}, {
input: "select @topic3_id:= 10103;",
output: "select @topic3_id := 10103 from dual",
// Assignment expresions aren't supported, so we skip the normalizer test.
// We only support parsing these expressions.
ignoreNormalizerTest: true,
}, {
input: "update /* list */ a set b = 3, c = 4",
}, {
Expand Down
5 changes: 5 additions & 0 deletions go/vt/vtgate/planbuilder/testdata/unsupported_cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@
"query": "select @val := 42",
"plan": "VT12001: unsupported: Assignment expression"
},
{
"comment": "Assignment expression in on duplicate clause",
"query": "insert into unsharded (id) values (@val := 42)",
"plan": "VT12001: unsupported: Assignment expression"
},
{
"comment": "Assignment expression in union statements",
"query": "select @val := 42 union select 1",
Expand Down
Loading