mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 18:00:55 +00:00
orm: fix postgres returning id error
This commit is contained in:
parent
eaf38bb096
commit
3e2ffa545f
@ -123,14 +123,16 @@ func (d *dbBasePostgres) ReplaceMarks(query *string) {
|
||||
}
|
||||
|
||||
// make returning sql support for postgresql.
|
||||
func (d *dbBasePostgres) HasReturningID(mi *modelInfo, query *string) (has bool) {
|
||||
if mi.fields.pk.auto {
|
||||
func (d *dbBasePostgres) HasReturningID(mi *modelInfo, query *string) bool {
|
||||
fi := mi.fields.pk
|
||||
if fi.fieldType&IsPositiveIntegerField == 0 && fi.fieldType&IsIntegerField == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
if query != nil {
|
||||
*query = fmt.Sprintf(`%s RETURNING "%s"`, *query, mi.fields.pk.column)
|
||||
*query = fmt.Sprintf(`%s RETURNING "%s"`, *query, fi.column)
|
||||
}
|
||||
has = true
|
||||
}
|
||||
return
|
||||
return true
|
||||
}
|
||||
|
||||
// show table sql for postgresql.
|
||||
|
Loading…
Reference in New Issue
Block a user