From 98a4b8d89ed879bdb0a412dcfbbf3f341fd8c8d6 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Tue, 30 Aug 2022 13:55:52 -0400 Subject: [PATCH] builtins: hide multitenancy functions from docs and fix categories In the public docs, we don't show multitenancy-related functions. This also fixes the category for sql_liveness_is_alive. Release note: None Release justification: docs only change --- docs/generated/sql/functions.md | 20 ++------------------ pkg/sql/sem/builtins/builtins.go | 9 ++++++--- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/docs/generated/sql/functions.md b/docs/generated/sql/functions.md index 55a1b49cc9eb..f314b9a248e0 100644 --- a/docs/generated/sql/functions.md +++ b/docs/generated/sql/functions.md @@ -914,6 +914,8 @@ available replica will error.

jsonb_typeof(val: jsonb) → string

Returns the type of the outermost JSON value as a text string.

+row_to_json(row: tuple) → jsonb

Returns the row as a JSON object.

+
to_json(val: anyelement) → jsonb

Returns the value as JSON or JSONB.

to_jsonb(val: anyelement) → jsonb

Returns the value as JSON or JSONB.

@@ -955,15 +957,6 @@ the locality flag on node startup. Returns an error if no region is set.

-### Multi-tenancy functions - - - - - -
Function → ReturnsDescription
crdb_internal.sql_liveness_is_alive(session_id: bytes) → bool

Checks is given sqlliveness session id is not expired

-
- ### STRING[] functions @@ -2956,15 +2949,6 @@ table. Returns an error if validation fails.

-### TUPLE functions - - - - - -
Function → ReturnsDescription
row_to_json(row: tuple) → jsonb

Returns the row as a JSON object.

-
- ### UUID functions diff --git a/pkg/sql/sem/builtins/builtins.go b/pkg/sql/sem/builtins/builtins.go index c8d0c69ec0b8..5babe92912e9 100644 --- a/pkg/sql/sem/builtins/builtins.go +++ b/pkg/sql/sem/builtins/builtins.go @@ -2987,7 +2987,7 @@ value if you rely on the HLC for accuracy.`, }, ), - "row_to_json": makeBuiltin(defProps(), + "row_to_json": makeBuiltin(jsonProps(), tree.Overload{ Types: tree.ArgTypes{{"row", types.AnyTuple}}, ReturnType: tree.FixedReturnType(types.Jsonb), @@ -5744,7 +5744,10 @@ value if you rely on the HLC for accuracy.`, // Returns true iff the given sqlliveness session is not expired. "crdb_internal.sql_liveness_is_alive": makeBuiltin( - tree.FunctionProperties{Category: categoryMultiTenancy}, + tree.FunctionProperties{ + Category: categorySystemInfo, + Undocumented: true, + }, tree.Overload{ Types: tree.ArgTypes{{"session_id", types.Bytes}}, ReturnType: tree.FixedReturnType(types.Bool), @@ -5756,7 +5759,7 @@ value if you rely on the HLC for accuracy.`, } return tree.MakeDBool(tree.DBool(live)), nil }, - Info: "Checks is given sqlliveness session id is not expired", + Info: "Checks if given sqlliveness session id is not expired", Volatility: tree.VolatilityStable, }, ),