MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / IsAmbiguous

Method IsAmbiguous

pkg/sql/types/types.go:2841–2863  ·  view source on GitHub ↗

IsAmbiguous returns true if this type is in UnknownFamily or AnyFamily. Instances of ambiguous types can be NULL or be in one of several different type families. This is important for parameterized types to determine whether they are fully concrete or not.

()

Source from the content-addressed store, hash-verified

2839// type families. This is important for parameterized types to determine whether
2840// they are fully concrete or not.
2841func (t *T) IsAmbiguous() bool {
2842 switch t.Family() {
2843 case UnknownFamily, AnyFamily:
2844 return true
2845 case CollatedStringFamily:
2846 return t.Locale() == ""
2847 case TupleFamily:
2848 if len(t.TupleContents()) == 0 {
2849 return true
2850 }
2851 for i := range t.TupleContents() {
2852 if t.TupleContents()[i].IsAmbiguous() {
2853 return true
2854 }
2855 }
2856 return false
2857 case ArrayFamily:
2858 return t.ArrayContents().IsAmbiguous()
2859 case EnumFamily:
2860 return t.Oid() == oid.T_anyenum
2861 }
2862 return false
2863}
2864
2865// IsNumeric returns true iff this type is an integer, float, or decimal.
2866func (t *T) IsNumeric() bool {

Callers 5

typeCheckConstantFunction · 0.80
TypeCheckMethod · 0.80
SetTypeMethod · 0.80

Calls 5

FamilyMethod · 0.95
LocaleMethod · 0.95
TupleContentsMethod · 0.95
ArrayContentsMethod · 0.95
OidMethod · 0.95

Tested by

no test coverage detected