Cols("*") error
when my code Cols("*") it will Gen. Sql like SELECT "*" FROM. it is no work in postgresql.
This commit is contained in:
parent
f2ff39264f
commit
4cc9187876
|
@ -782,7 +782,15 @@ func (statement *Statement) Cols(columns ...string) *Statement {
|
|||
for _, nc := range newColumns {
|
||||
statement.columnMap[strings.ToLower(nc)] = true
|
||||
}
|
||||
|
||||
// by hzm
|
||||
if len(newColumns) == 1 {
|
||||
statement.ColumnStr = newColumns
|
||||
|
||||
} else {
|
||||
statement.ColumnStr = statement.Engine.Quote(strings.Join(newColumns, statement.Engine.Quote(", ")))
|
||||
}
|
||||
|
||||
if strings.Contains(statement.ColumnStr, ".") {
|
||||
statement.ColumnStr = strings.Replace(statement.ColumnStr, ".", statement.Engine.Quote("."), -1)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue