diff --git a/pkg/sql/parser/builtins.go b/pkg/sql/parser/builtins.go index 9d2603b53f65..3fac80124a8c 100644 --- a/pkg/sql/parser/builtins.go +++ b/pkg/sql/parser/builtins.go @@ -1394,21 +1394,7 @@ var Builtins = map[string][]Builtin{ // TODO(knz): This is a proof-of-concept until TypeAny works // properly. Builtin{ - Types: ArgTypes{TypeInt}, - ReturnType: TypeString, - fn: func(_ *EvalContext, args DTuple) (Datum, error) { - return NewDString(args[0].ResolvedType().String()), nil - }, - }, - Builtin{ - Types: ArgTypes{TypeDecimal}, - ReturnType: TypeString, - fn: func(_ *EvalContext, args DTuple) (Datum, error) { - return NewDString(args[0].ResolvedType().String()), nil - }, - }, - Builtin{ - Types: ArgTypes{TypeString}, + Types: ArgTypes{TypeAny}, ReturnType: TypeString, fn: func(_ *EvalContext, args DTuple) (Datum, error) { return NewDString(args[0].ResolvedType().String()), nil diff --git a/pkg/sql/testdata/builtin_function b/pkg/sql/testdata/builtin_function index ed841e5f52e1..62be3e750a9b 100644 --- a/pkg/sql/testdata/builtin_function +++ b/pkg/sql/testdata/builtin_function @@ -1333,3 +1333,24 @@ query T SELECT pg_catalog.pg_typeof(sign(1:::decimal)) ---- decimal + +query T +VALUES (pg_typeof(1:::int)), + (pg_typeof('a':::string)), + (pg_typeof(true)), + (pg_typeof(null)), + (pg_typeof('3m':::interval)), + (pg_typeof('2016-11-12':::date)), + (pg_typeof(now():::timestamptz)), + (pg_typeof(b'a':::bytes)), + (pg_typeof(array[1,2,3])) +---- +int +string +bool +NULL +interval +date +timestamptz +bytes +int[]