forked from mirror/gorm
Fix ReturningStr when with schema name, fixes #650
This commit is contained in:
parent
447885d98f
commit
b46ca62c18
|
@ -54,7 +54,7 @@ func Create(scope *Scope) {
|
|||
if len(columns) == 0 {
|
||||
scope.Raw(fmt.Sprintf("INSERT INTO %v DEFAULT VALUES %v",
|
||||
scope.QuotedTableName(),
|
||||
scope.Dialect().ReturningStr(scope.TableName(), returningKey),
|
||||
scope.Dialect().ReturningStr(scope.QuotedTableName(), returningKey),
|
||||
))
|
||||
} else {
|
||||
scope.Raw(fmt.Sprintf(
|
||||
|
@ -62,7 +62,7 @@ func Create(scope *Scope) {
|
|||
scope.QuotedTableName(),
|
||||
strings.Join(columns, ","),
|
||||
strings.Join(sqls, ","),
|
||||
scope.Dialect().ReturningStr(scope.TableName(), returningKey),
|
||||
scope.Dialect().ReturningStr(scope.QuotedTableName(), returningKey),
|
||||
))
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ func (foundation) SqlTag(value reflect.Value, size int, autoIncrease bool) strin
|
|||
}
|
||||
|
||||
func (s foundation) ReturningStr(tableName, key string) string {
|
||||
return fmt.Sprintf("RETURNING %v.%v", s.Quote(tableName), key)
|
||||
return fmt.Sprintf("RETURNING %v.%v", tableName, key)
|
||||
}
|
||||
|
||||
func (s foundation) HasTable(scope *Scope, tableName string) bool {
|
||||
|
|
|
@ -60,7 +60,7 @@ func (postgres) SqlTag(value reflect.Value, size int, autoIncrease bool) string
|
|||
}
|
||||
|
||||
func (s postgres) ReturningStr(tableName, key string) string {
|
||||
return fmt.Sprintf("RETURNING %v.%v", s.Quote(tableName), key)
|
||||
return fmt.Sprintf("RETURNING %v.%v", tableName, key)
|
||||
}
|
||||
|
||||
func (s postgres) HasTable(scope *Scope, tableName string) bool {
|
||||
|
|
Loading…
Reference in New Issue