Fix ReturningStr when with schema name, fixes #650

This commit is contained in:
Jinzhu 2015-09-11 06:36:17 +08:00
parent 447885d98f
commit b46ca62c18
3 changed files with 4 additions and 4 deletions

View File

@ -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),
))
}

View File

@ -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 {

View File

@ -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 {