Skip to content

Commit

Permalink
sql: refactor GlobalDefault for session variables
Browse files Browse the repository at this point in the history
This commit refactors `pkg/sql/vars.go` to use globalFalse and
globalTrue as the setting GlobalDefault where possible.

Release note: None
  • Loading branch information
Neha George committed Dec 21, 2021
1 parent 3937557 commit d8a4967
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions pkg/sql/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,7 @@ var varGen = map[string]sessionVar{
Get: func(evalCtx *extendedEvalContext) (string, error) {
return formatBoolAsPostgresSetting(evalCtx.SessionData().PartiallyDistributedPlansDisabled), nil
},
GlobalDefault: func(sv *settings.Values) string {
return formatBoolAsPostgresSetting(false)
},
GlobalDefault: globalFalse,
},

// CockroachDB extension.
Expand Down Expand Up @@ -686,9 +684,7 @@ var varGen = map[string]sessionVar{
Get: func(evalCtx *extendedEvalContext) (string, error) {
return formatBoolAsPostgresSetting(evalCtx.SessionData().TestingVectorizeInjectPanics), nil
},
GlobalDefault: func(sv *settings.Values) string {
return formatBoolAsPostgresSetting(false)
},
GlobalDefault: globalFalse,
},

// CockroachDB extension.
Expand Down Expand Up @@ -990,10 +986,8 @@ var varGen = map[string]sessionVar{
GetFromSessionData: func(sd *sessiondata.SessionData) string {
return formatBoolAsPostgresSetting(sd.IsSuperuser)
},
GetStringVal: makePostgresBoolGetStringValFn("is_superuser"),
GlobalDefault: func(sv *settings.Values) string {
return "off"
},
GetStringVal: makePostgresBoolGetStringValFn("is_superuser"),
GlobalDefault: globalFalse,
},

// CockroachDB extension.
Expand Down Expand Up @@ -1512,9 +1506,7 @@ var varGen = map[string]sessionVar{
Get: func(evalCtx *extendedEvalContext) (string, error) {
return formatBoolAsPostgresSetting(true), nil
},
GlobalDefault: func(sv *settings.Values) string {
return formatBoolAsPostgresSetting(true)
},
GlobalDefault: globalTrue,
},

// CockroachDB extension.
Expand Down Expand Up @@ -1684,9 +1676,7 @@ var varGen = map[string]sessionVar{
Get: func(evalCtx *extendedEvalContext) (string, error) {
return formatBoolAsPostgresSetting(evalCtx.SessionData().NullOrderedLast), nil
},
GlobalDefault: func(sv *settings.Values) string {
return formatBoolAsPostgresSetting(false)
},
GlobalDefault: globalFalse,
},

`propagate_input_ordering`: {
Expand Down

0 comments on commit d8a4967

Please sign in to comment.