-
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: new built-in function crdb_internal.active_version()
#77233
Conversation
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.
ty!
ReturnType: tree.FixedReturnType(types.Jsonb), | ||
Fn: func(ctx *tree.EvalContext, _ tree.Datums) (tree.Datum, error) { | ||
activeVersion := ctx.Settings.Version.ActiveVersionOrEmpty(ctx.Context) | ||
jsonStr, err := gojson.Marshal(&activeVersion.Version) |
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.
does this behave correctly if "empty" was returned by ActiveVersionOrEmpty
? (asking mostly to be educated, since i don't quite know when the version would be empty.)
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.
it's empty if for some reason this function is called before the cluster is done initializing. In the SQL layer, that's about impossible since we don't let SQL start before cluster init.
a71e07d
to
d434470
Compare
TFYR! bors r=rafiss |
Release justification: low risk, high benefit changes to existing functionality Release note (sql change): The new built-in scalar function `crdb_internal.active_version()` can now be used alongside `crdb_internal.is_at_least_version()` to determine which cluster version is currently active and choose client-side feature levels accordingly.
Build succeeded: |
Release justification: low risk, high benefit changes to existing functionality
Release note (sql change): The new built-in scalar function
crdb_internal.active_version()
can now be used alongsidecrdb_internal.is_at_least_version()
to determine which clusterversion is currently active and choose client-side feature levels
accordingly.