diff --git a/docs/generated/sql/functions.md b/docs/generated/sql/functions.md index 9f5ae3f12ecb..ff45341ad764 100644 --- a/docs/generated/sql/functions.md +++ b/docs/generated/sql/functions.md @@ -1133,9 +1133,9 @@ the locality flag on node startup. Returns an error if no region is set.

json_object_keys(input: jsonb) → string

Returns sorted set of keys in the outermost JSON object.

-json_populate_record(base: anyelement, from_json: jsonb) → anyelement

Expands the object in from_json to a row whose columns match the record type defined by base.

+json_populate_record(base: tuple, from_json: jsonb) → tuple

Expands the object in from_json to a row whose columns match the record type defined by base.

-json_populate_recordset(base: anyelement, from_json: jsonb) → anyelement

Expands the outermost array of objects in from_json to a set of rows whose columns match the record type defined by base

+json_populate_recordset(base: tuple, from_json: jsonb) → tuple

Expands the outermost array of objects in from_json to a set of rows whose columns match the record type defined by base

jsonb_array_elements(input: jsonb) → jsonb

Expands a JSON array to a set of JSON values.

@@ -1147,9 +1147,9 @@ the locality flag on node startup. Returns an error if no region is set.

jsonb_object_keys(input: jsonb) → string

Returns sorted set of keys in the outermost JSON object.

-jsonb_populate_record(base: anyelement, from_json: jsonb) → anyelement

Expands the object in from_json to a row whose columns match the record type defined by base.

+jsonb_populate_record(base: tuple, from_json: jsonb) → tuple

Expands the object in from_json to a row whose columns match the record type defined by base.

-jsonb_populate_recordset(base: anyelement, from_json: jsonb) → anyelement

Expands the outermost array of objects in from_json to a set of rows whose columns match the record type defined by base

+jsonb_populate_recordset(base: tuple, from_json: jsonb) → tuple

Expands the outermost array of objects in from_json to a set of rows whose columns match the record type defined by base

pg_get_keywords() → tuple{string AS word, string AS catcode, string AS catdesc}

Produces a virtual table containing the keywords known to the SQL parser.

diff --git a/pkg/sql/logictest/testdata/logic_test/json b/pkg/sql/logictest/testdata/logic_test/json index f4f8d04a19e9..fbba0974709a 100644 --- a/pkg/sql/logictest/testdata/logic_test/json +++ b/pkg/sql/logictest/testdata/logic_test/json @@ -854,6 +854,13 @@ SELECT '{}'::JSONB[] {} # json_populate_record + +statement error unknown signature: json_populate_recordset\(oid, jsonb\) +SELECT json_populate_recordset(3923269572::OID, '["regression_70475"]'::JSONB) + +statement error unknown signature: jsonb_populate_recordset\(oid, jsonb\) +SELECT jsonb_populate_recordset(3923269572::OID, '["regression_70475"]'::JSONB) + query FIII colnames SELECT *, c FROM json_populate_record(((1.01, 2, 3) AS d, c, a), '{"a": 3, "c": 10, "d": 11.001}') ---- diff --git a/pkg/sql/sem/builtins/generator_builtins.go b/pkg/sql/sem/builtins/generator_builtins.go index 041203124203..addcda05bc7b 100644 --- a/pkg/sql/sem/builtins/generator_builtins.go +++ b/pkg/sql/sem/builtins/generator_builtins.go @@ -1261,7 +1261,7 @@ func makeJSONPopulateImpl(gen tree.GeneratorWithExprsFactory, info string) tree. // the default values of each field will be NULL. // The second argument can also be null, in which case the first argument // is returned as-is. - Types: tree.ArgTypes{{"base", types.Any}, {"from_json", types.Jsonb}}, + Types: tree.ArgTypes{{"base", types.AnyTuple}, {"from_json", types.Jsonb}}, ReturnType: func(args []tree.TypedExpr) *types.T { if len(args) != 2 { return tree.UnknownReturnType