Skip to content

Commit 17bebbc

Browse files
committed
fix sys var set
1 parent 67f7944 commit 17bebbc

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

sql/planbuilder/auth_default.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func (h defaultAuthorizationHandler) HandleAuth(ctx *sql.Context, aqs sql.Author
191191
case ast.AuthType_REPLACE:
192192
privilegeTypes = []sql.PrivilegeType{sql.PrivilegeType_Insert, sql.PrivilegeType_Delete}
193193
case ast.AuthType_REPLICATION:
194-
hasPrivileges = state.db.UserHasPrivileges(ctx, sql.NewDynamicPrivilegedOperation(plan.DynamicPrivilege_ReplicationSlaveAdmin))
194+
hasPrivileges = state.db.UserHasPrivileges(ctx, sql.NewDynamicPrivilegedOperation("replication_slave_admin"))
195195
case ast.AuthType_REPLICATION_CLIENT:
196196
privilegeTypes = []sql.PrivilegeType{sql.PrivilegeType_ReplicationClient}
197197
case ast.AuthType_REVOKE_ALL:
@@ -215,7 +215,7 @@ func (h defaultAuthorizationHandler) HandleAuth(ctx *sql.Context, aqs sql.Author
215215
state.db.UserHasPrivileges(ctx, sql.NewPrivilegedOperation(subject, sql.PrivilegeType_AlterRoutine)) ||
216216
state.db.UserHasPrivileges(ctx, sql.NewPrivilegedOperation(subject, sql.PrivilegeType_Execute))
217217
case ast.AuthType_SUPER:
218-
hasPrivileges = state.db.UserHasPrivileges(ctx, sql.NewPrivilegedOperation(sql.PrivilegeCheckSubject{}, sql.PrivilegeType_Super))
218+
privilegeTypes = []sql.PrivilegeType{sql.PrivilegeType_Super}
219219
case ast.AuthType_TRIGGER:
220220
privilegeTypes = []sql.PrivilegeType{sql.PrivilegeType_Trigger}
221221
case ast.AuthType_UPDATE:

sql/rowexec/rel_iters.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ func setSystemVar(ctx *sql.Context, sysVar *expression.SystemVar, right sql.Expr
401401

402402
// Setting `character_set_connection` and `collation_connection` will set the corresponding variable
403403
// Setting `character_set_server` and `collation_server` will set the corresponding variable
404-
// Handle MariaDB binlog numeric conversions for sql_mode and collation IDs
405404
switch strings.ToLower(sysVar.Name) {
406405
case "sql_mode":
407406
val, err = sql.ConvertSqlModeBitmask(val)
@@ -425,7 +424,6 @@ func setSystemVar(ctx *sql.Context, sysVar *expression.SystemVar, right sql.Expr
425424
collationName := charset.DefaultCollation().Name()
426425
return sysVar.Scope.SetValue(ctx, "collation_connection", collationName)
427426
case "collation_connection":
428-
// Convert numeric collation ID to name (from MariaDB binlogs)
429427
val, err = sql.ConvertCollationID(val)
430428
if err != nil {
431429
return err
@@ -464,7 +462,6 @@ func setSystemVar(ctx *sql.Context, sysVar *expression.SystemVar, right sql.Expr
464462
collationName := charset.DefaultCollation().Name()
465463
return sysVar.Scope.SetValue(ctx, "collation_server", collationName)
466464
case "collation_server":
467-
// Convert numeric collation ID to name (from MariaDB binlogs)
468465
val, err = sql.ConvertCollationID(val)
469466
if err != nil {
470467
return err
@@ -488,7 +485,6 @@ func setSystemVar(ctx *sql.Context, sysVar *expression.SystemVar, right sql.Expr
488485
charsetName := collation.CharacterSet().Name()
489486
return sysVar.Scope.SetValue(ctx, "character_set_server", charsetName)
490487
case "collation_database":
491-
// Convert numeric collation ID to name (from MariaDB binlogs)
492488
val, err = sql.ConvertCollationID(val)
493489
if err != nil {
494490
return err
@@ -501,9 +497,8 @@ func setSystemVar(ctx *sql.Context, sysVar *expression.SystemVar, right sql.Expr
501497
val = fmt.Sprintf("%v", val)
502498
}
503499
return sysVar.Scope.SetValue(ctx, sysVar.Name, val)
504-
default:
505-
return sysVar.Scope.SetValue(ctx, sysVar.Name, val)
506500
}
501+
return nil
507502
}
508503

509504
func validateSystemVariableValue(sysVarName string, val interface{}) error {

0 commit comments

Comments
 (0)