Skip to content

Commit 16d2fd1

Browse files
committed
refactor(analyzer): standardize error message format in VALUES resolver
Update error messages in resolve_values_types.go to follow existing error messaging conventions in analyzer: - Add "VALUES:" prefix to match pattern used in analzyer code files, such as in assign_update_casts.go (UPDATE:) and in assign_insert_casts.go (INSERT:) - Also fix return value of n to nil when returning error Refs: #1648
1 parent 0157795 commit 16d2fd1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

server/analyzer/resolve_values_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func ResolveValuesTypes(ctx *sql.Context, a *analyzer.Analyzer, node sql.Node, s
6767
// GetField indices are 1-based in GMS planbuilder, so subtract 1 for schema access
6868
schemaIdx := gf.Index() - 1
6969
if schemaIdx < 0 || schemaIdx >= len(newSch) {
70-
return nil, transform.NewTree, errors.Newf("GetField `%s` on table `%s` uses invalid index `%d`",
70+
return nil, transform.NewTree, errors.Errorf("VALUES: GetField `%s` on table `%s` uses invalid index `%d`",
7171
gf.Name(), gf.Table(), gf.Index())
7272
}
7373

@@ -118,7 +118,7 @@ func transformValuesNode(n sql.Node) (sql.Node, transform.TreeIdentity, error) {
118118
numCols := len(values.ExpressionTuples[0])
119119
for i := 1; i < len(values.ExpressionTuples); i++ {
120120
if len(values.ExpressionTuples[i]) != numCols {
121-
return nil, transform.NewTree, errors.New("VALUES lists must all be the same length")
121+
return nil, transform.NewTree, errors.New("VALUES: VALUES lists must all be the same length")
122122
}
123123
}
124124
if numCols == 0 {
@@ -136,7 +136,7 @@ func transformValuesNode(n sql.Node) (sql.Node, transform.TreeIdentity, error) {
136136
} else if pgType, ok := exprType.(*pgtypes.DoltgresType); ok {
137137
columnTypes[colIdx][rowIdx] = pgType
138138
} else {
139-
return n, transform.NewTree, errors.New("VALUES cannot use GMS types")
139+
return nil, transform.NewTree, errors.New("VALUES: VALUES cannot use GMS types")
140140
}
141141
}
142142
}

0 commit comments

Comments
 (0)