-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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 a SET CLUSTER SETTING sql.defaults deprecation notice #80548
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.
LGTM.
Might be worth adding to the release note, unless the docs team is already aware of this deprecation?
pkg/sql/set_cluster_setting.go
Outdated
|
||
if strings.Contains(n.name, "sql.defaults") { | ||
params.p.BufferClientNotice(params.ctx, | ||
pgnotice.Newf("The `SET CLUSTER SETTING sql.defaults...` syntax is deprecated, please "+ |
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.
perhaps
params.p.BufferClientNotice(
params.ctx,
errors.WithHintf(
pgnotice.Newf("`SET CLUSTER SETTING %s` syntax is deprecated", n.name),
"use `ALTER ROLE ... SET` which allows finger-grained control. See %s",
docs.URL("alter-role.html#set-default-session-variable-values-for-a-role"),
),
)
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.
i think we should use a bit softer language than "deprecated" -- usually deprecated means that we don't support it or it will go away eventually
in this case, i'd view the notice as more of a helpful hint. like
"setting a global default; use the `ALTER ROLE ... SET` syntax to control session variable defaults at a finer-grained level"
e31f7ea
to
431a4ce
Compare
pkg/sql/set_cluster_setting.go
Outdated
errors.WithHintf( | ||
pgnotice.Newf("Setting global default %s`;", n.name), | ||
"use the `ALTER ROLE ... SET` syntax to control session variable defaults at a finer-grained level. See: %s", | ||
docs.URL("https://www.cockroachlabs.com/docs/stable/alter-role.html#set-default-session-variable-values-for-a-role"), |
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.
this should just be alter-role.html#set-default-session-variable-values-for-a-role
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.
i think we should make a release note out of this as well
pkg/sql/set_cluster_setting.go
Outdated
@@ -193,6 +195,18 @@ func (p *planner) getAndValidateTypedClusterSetting( | |||
} | |||
|
|||
func (n *setClusterSettingNode) startExec(params runParams) error { | |||
|
|||
if strings.Contains(n.name, "sql.defaults") { |
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.
lets use strings.HasPrefix
pkg/sql/set_cluster_setting.go
Outdated
params.p.BufferClientNotice( | ||
params.ctx, | ||
errors.WithHintf( | ||
pgnotice.Newf("Setting global default %s`;", n.name), |
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.
nit: errors start with lowercase, so "setting global default". remove the semicolon ;
as well
pkg/sql/set_cluster_setting.go
Outdated
params.p.BufferClientNotice( | ||
params.ctx, | ||
errors.WithHintf( | ||
pgnotice.Newf("setting global default %s`", n.name), |
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.
maybe" setting global default %s is not recommended" (remove the backtick at the end)
Release note (sql change): The `ALTER ROLE` syntax` allows users to set default values for session variables making `SET CLUSTER SETTINGS sql.defaults...` redundant. This PR adds a notice to `SET CLUSTER SETTINGS sql.defaults...` that directs the user to use the `ALTER ROLE` syntax instead.
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.
Build succeeded: |
Resolves #80325
Added a deprecation notice for when
SET CLUSTER SETTINGS sql.defaults...
is used. The notice directs users to use the
ALTER ROLE
syntax insteadRelease note: None