-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: add json{,b}_populate_record{,set} #70115
Conversation
36f78ec
to
a0a6d1a
Compare
a0a6d1a
to
4d23574
Compare
|
||
func (j *jsonPopulateRecordGenerator) Start(_ context.Context, _ *kv.Txn) error { | ||
if j.target != tree.DNull && j.target.(*tree.DJSON).JSON.Type() != json.ArrayJSONType { | ||
return pgerror.Newf(pgcode.InvalidParameterValue, "argument of json_populate_recordset must be an array") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be moved to makeJSONPopulateRecordSetGenerator
?
4d23574
to
e3baff8
Compare
e3baff8
to
6b735ef
Compare
Thanks for the suggestions, RFAL |
6b735ef
to
943f25d
Compare
These generator builtins permit type-safe transformation of JSON to table data. They're added for compatibility with PostgreSQL. Release note (sql change): add the json_populate_record, jsonb_populate_record functions, json_populate_recordset, and jsonb_populate_recordset functions, which transform JSON into row tuples based on the labels in a record type.
943f25d
to
1bccee6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
TFTR! bors r+ |
Build failed: |
Flake bors r+ |
Build failed (retrying...): |
Build succeeded: |
The `Overload.GeneratorWithExprs` field was added in cockroachdb#70115. This commit makes usage of this field safer by introducing the `IsGenerator` method which can be used to determine if an overload is an SRF. This commit also adds guardrails to prevent future issues with `GeneratorWithExprs`in the `ConvertZipArraysToValues` normalization rule. Release note: None
70699: sql: make builtin generators with GeneratorWithExprs safer r=mgartner a=mgartner The `Overload.GeneratorWithExprs` field was added in #70115. This commit makes usage of this field safer by introducing the `IsGenerator` method which can be used to determine if an overload is an SRF. This commit also adds guardrails to prevent future issues with `GeneratorWithExprs`in the `ConvertZipArraysToValues` normalization rule. Release note: None Co-authored-by: Marcus Gartner <[email protected]>
Updates #69010
Updates #70037
These generator builtins permit type-safe transformation of JSON to
table data. They're added for compatibility with PostgreSQL.
Release note (sql change): add the json_populate_record,
jsonb_populate_record functions, json_populate_recordset, and
jsonb_populate_recordset functions, which transform JSON into row tuples
based on the labels in a record type.