Skip to content

Commit a1bcdb1

Browse files
committed
add miss for trim
1 parent 58e535d commit a1bcdb1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sql/expression/function/trim_ltrim_rtrim.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ func (t *LeftTrim) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
219219
return nil, sql.ErrInvalidType.New(reflect.TypeOf(str))
220220
}
221221

222+
// Handle Dolt's TextStorage wrapper that doesn't convert to plain string
223+
str, err = sql.UnwrapAny(ctx, str)
224+
if err != nil {
225+
return nil, err
226+
}
227+
222228
return strings.TrimLeftFunc(str.(string), func(r rune) bool {
223229
return r == ' '
224230
}), nil
@@ -282,6 +288,12 @@ func (t *RightTrim) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
282288
return nil, sql.ErrInvalidType.New(reflect.TypeOf(str))
283289
}
284290

291+
// Handle Dolt's TextStorage wrapper that doesn't convert to plain string
292+
str, err = sql.UnwrapAny(ctx, str)
293+
if err != nil {
294+
return nil, err
295+
}
296+
285297
return strings.TrimRightFunc(str.(string), func(r rune) bool {
286298
return r == ' '
287299
}), nil

0 commit comments

Comments
 (0)