mirror of https://github.com/go-gorm/gorm.git
Merge pull request #987 from moberemk/patch-1
Properly quotes column names in post-insert SELECT
This commit is contained in:
commit
1073563f1e
|
@ -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