@@ -179,8 +179,12 @@ func (r *RegexpLike) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
179179 if err != nil {
180180 return nil , err
181181 }
182+ textStr , _ , err := sql .Unwrap [string ](ctx , text )
183+ if err != nil {
184+ return nil , err
185+ }
182186
183- err = r .re .SetMatchString (ctx , text .( string ) )
187+ err = r .re .SetMatchString (ctx , textStr )
184188 if err != nil {
185189 return nil , err
186190 }
@@ -220,9 +224,13 @@ func compileRegex(ctx *sql.Context, pattern, text, flags sql.Expression, funcNam
220224 if err != nil {
221225 return nil , err
222226 }
227+ patternValStr , _ , err := sql .Unwrap [string ](ctx , patternVal )
228+ if err != nil {
229+ return nil , err
230+ }
223231
224232 // Empty regex, throw illegal argument
225- if len (patternVal .( string ) ) == 0 {
233+ if len (patternValStr ) == 0 {
226234 return nil , errors .NewKind ("Illegal argument to regular expression." ).New ()
227235 }
228236
@@ -250,7 +258,10 @@ func compileRegex(ctx *sql.Context, pattern, text, flags sql.Expression, funcNam
250258 return nil , err
251259 }
252260
253- flagsStr = f .(string )
261+ flagsStr , _ , err = sql .Unwrap [string ](ctx , f )
262+ if err != nil {
263+ return nil , err
264+ }
254265 flagsStr , err = consolidateRegexpFlags (flagsStr , funcName )
255266 if err != nil {
256267 return nil , err
@@ -279,7 +290,7 @@ func compileRegex(ctx *sql.Context, pattern, text, flags sql.Expression, funcNam
279290 ctx .Warn (1193 , `System variable for regular expressions "regexp_buffer_size" is missing` )
280291 }
281292 re := regex .CreateRegex (bufferSize )
282- if err = re .SetRegexString (ctx , patternVal .( string ) , regexFlags ); err != nil {
293+ if err = re .SetRegexString (ctx , patternValStr , regexFlags ); err != nil {
283294 _ = re .Close ()
284295 return nil , err
285296 }
0 commit comments