forked from mirror/gorm
Ensure identifiers are quoted for `RETURNING` and `DROP INDEX` statements.
This commit is contained in:
parent
016e91db20
commit
2166649409
|
@ -66,7 +66,7 @@ func (s *postgres) PrimaryKeyTag(value reflect.Value, size int) string {
|
|||
}
|
||||
|
||||
func (s *postgres) ReturningStr(tableName, key string) string {
|
||||
return fmt.Sprintf("RETURNING \"%v\".%v", tableName, key)
|
||||
return fmt.Sprintf("RETURNING %v.%v", s.Quote(tableName), s.Quote(key))
|
||||
}
|
||||
|
||||
func (s *postgres) SelectFromDummyTable() string {
|
||||
|
@ -97,7 +97,7 @@ func (s *postgres) HasColumn(scope *Scope, tableName string, columnName string)
|
|||
}
|
||||
|
||||
func (s *postgres) RemoveIndex(scope *Scope, indexName string) {
|
||||
scope.Raw(fmt.Sprintf("DROP INDEX %v", indexName)).Exec()
|
||||
scope.Raw(fmt.Sprintf("DROP INDEX %v", s.Quote(indexName))).Exec()
|
||||
}
|
||||
|
||||
var hstoreType = reflect.TypeOf(Hstore{})
|
||||
|
|
Loading…
Reference in New Issue