This code would pass static type validation, there's nothing wrong with it at that level. It gets a default value to use and does exactly that.
Though in practice in decent languages it's much less likely you'd write your own `any -> any, any`-typed library for whatever (in this case DB interactions), and use a strongly typed one in which this would at least have been a much more explicit mistake to make.
Generally, static languages will just culturally be less likely to have this kind of invisible "T | (() -> T)" overload.
[1] https://doc.rust-lang.org/std/option/enum.Option.html#method...)