Skip to content

Commit

Permalink
eval: don't always ignore error from ResolveFunctionByOID
Browse files Browse the repository at this point in the history
This addresses a comment from the review of cockroachdb#85656.

Release note: None
  • Loading branch information
rafiss committed Aug 10, 2022
1 parent c1d005c commit 655ae28
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/sql/sem/eval/cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -940,12 +940,15 @@ func performIntToOidCast(
return tree.NewDOidWithTypeAndName(o, t, name), nil

case oid.T_regproc, oid.T_regprocedure:
if v == 0 {
return tree.WrapAsZeroOid(t), nil
}
name, _, err := res.ResolveFunctionByOID(ctx, oid.Oid(v))
if err != nil {
if v == 0 {
return tree.WrapAsZeroOid(t), nil
if errors.Is(err, tree.ErrFunctionUndefined) {
return tree.NewDOidWithType(o, t), nil //nolint:returnerrcheck
}
return tree.NewDOidWithType(o, t), nil //nolint:returnerrcheck
return nil, err
}
return tree.NewDOidWithTypeAndName(o, t, name), nil

Expand Down

0 comments on commit 655ae28

Please sign in to comment.