diff --git a/callback_query.go b/callback_query.go index 7eaf5573..f46d6ad4 100644 --- a/callback_query.go +++ b/callback_query.go @@ -22,7 +22,7 @@ func Query(scope *Scope) { if orderBy, ok := scope.InstanceGet("gorm:order_by_primary_key"); ok { if primaryKey := scope.PrimaryKey(); primaryKey != "" { - scope.Search = scope.Search.clone().order(fmt.Sprintf("%v.%v %v", scope.TableName(), primaryKey, orderBy)) + scope.Search = scope.Search.clone().order(fmt.Sprintf("%v.%v %v", scope.QuotedTableName(), primaryKey, orderBy)) } }