Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
80659: sql: add disallowed imports for tree r=ajwerner a=RichardJCai

Release note: None

81304: types: fix SQLTypeName for VoidFamily r=rafiss a=otan

Release note (bug fix): Fixed a bug where format_type on the void type
results in an error.

Resolves cockroachdb#81255

Co-authored-by: richardjcai <[email protected]>
Co-authored-by: Oliver Tan <[email protected]>
  • Loading branch information
3 people committed May 16, 2022
3 parents 55a86a9 + c91e938 + c83bb59 commit 815726a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/builtin_function
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,7 @@ VALUES (format_type('anyelement'::regtype, -1)),
(format_type('unknown'::regtype, -1)),
(format_type('varbit'::regtype, -1)),
(format_type('varchar'::regtype, -1)),
(format_type('void'::regtype, -1)),
(format_type('int[]'::regtype, -1)),
(format_type('int2[]'::regtype, -1)),
(format_type('string[]'::regtype, -1)),
Expand Down Expand Up @@ -2102,6 +2103,7 @@ uuid
unknown
bit varying
character varying
void
bigint[]
smallint[]
text[]
Expand Down Expand Up @@ -2155,6 +2157,10 @@ SELECT format_type(oid, -1) FROM pg_type WHERE typname='_text' LIMIT 1
----
text[]

# Ensure each type can be formatted.
statement ok
SELECT format_type(oid, NULL) FROM pg_type

query T
SELECT pg_catalog.pg_get_userbyid((SELECT oid FROM pg_roles WHERE rolname='root'))
----
Expand Down
5 changes: 4 additions & 1 deletion pkg/sql/sem/tree/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,11 @@ genrule(
disallowed_imports_test(
"tree",
disallowed_list = [
"//pkg/sql/sessiondata",
"//pkg/kv",
"//pkg/security",
"//pkg/server",
"//pkg/sql/sessiondata",
"//pkg/storage",
],
disallowed_prefixes = [
"pkg/sql/catalog",
Expand Down
2 changes: 2 additions & 0 deletions pkg/sql/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,8 @@ func (t *T) SQLStandardNameWithTypmod(haveTypmod bool, typmod int) string {
return "unknown"
case UuidFamily:
return "uuid"
case VoidFamily:
return "void"
case EnumFamily:
return t.TypeMeta.Name.Basename()
default:
Expand Down

0 comments on commit 815726a

Please sign in to comment.