From cac8a47bbe793722d93e4b6a3f4c8548126c52c2 Mon Sep 17 00:00:00 2001 From: ycc Date: Wed, 3 Nov 2021 15:11:48 +0100 Subject: [PATCH] sort split on empty string terurnt array of one empty string --- pg.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pg.go b/pg.go index fefbe93..74a043a 100755 --- a/pg.go +++ b/pg.go @@ -232,7 +232,7 @@ func (t *TableInfo) buildSelect(key string, columns []string, restriction string if restriction != "" { query += " where " + restriction } - if len(sortkeys) > 0 { + if len(sortkeys) > 0 && len(sortkeys[0]) > 0 { query += " order by " + strings.Join(sortkeys, ",") } if len(dir) > 0 {