forked from mirror/gorm
Properly quotes column names in post-insert SELECT
This commit closes #979 by fixing the post-insert SELECT call
This commit is contained in:
parent
465f8ea05b
commit
3b85ddcc9a
|
@ -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))
|
||||||
|
|
Loading…
Reference in New Issue