Merge pull request #987 from moberemk/patch-1

Properly quotes column names in post-insert SELECT
This commit is contained in:
Jinzhu 2016-05-04 21:04:23 +08:00
commit 1073563f1e
1 changed files with 1 additions and 1 deletions

View File

@ -52,7 +52,7 @@ func createCallback(scope *Scope) {
if field.IsNormal { if field.IsNormal {
if !field.IsPrimaryKey || !field.IsBlank { if !field.IsPrimaryKey || !field.IsBlank {
if field.IsBlank && field.HasDefaultValue { if field.IsBlank && field.HasDefaultValue {
blankColumnsWithDefaultValue = append(blankColumnsWithDefaultValue, field.DBName) blankColumnsWithDefaultValue = append(blankColumnsWithDefaultValue, scope.Quote(field.DBName))
scope.InstanceSet("gorm:blank_columns_with_default_value", blankColumnsWithDefaultValue) scope.InstanceSet("gorm:blank_columns_with_default_value", blankColumnsWithDefaultValue)
} else { } else {
columns = append(columns, scope.Quote(field.DBName)) columns = append(columns, scope.Quote(field.DBName))