diff --git a/callback_query.go b/callback_query.go index 0eea6f89..825caac1 100644 --- a/callback_query.go +++ b/callback_query.go @@ -18,7 +18,7 @@ func Query(scope *Scope) { if orderBy, ok := scope.Get("gorm:order_by_primary_key"); ok { if primaryKey := scope.PrimaryKey(); primaryKey != "" { - scope.Search.Order(fmt.Sprintf("%v.%v %v", scope.QuotedTableName(), primaryKey, orderBy)) + scope.Search.Order(fmt.Sprintf("%v.%v %v", scope.QuotedTableName(), scope.Quote(primaryKey), orderBy)) } }