From facd84deecf1cfdb034ccc851e77a9e72544bc87 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Sat, 13 Sep 2014 16:11:49 +0800 Subject: [PATCH] Quote table name when order by primary key --- callback_query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)) } }