diff --git a/VERSION b/VERSION index 17fcc5f5..d1a98fc7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -xorm v0.4.5.0203 +xorm v0.4.5.0204 diff --git a/session.go b/session.go index f1bb1ac0..b7ce7ff6 100644 --- a/session.go +++ b/session.go @@ -3962,7 +3962,27 @@ func (session *Session) Delete(bean interface{}) (int64, error) { condition) if len(orderSql) > 0 { - realSql += orderSql + switch session.Engine.dialect.DBType() { + case core.POSTGRES: + inSql := fmt.Sprintf("ctid IN (SELECT ctid FROM %s%s)", tableName, orderSql) + if len(condition) > 0 { + realSql += " AND " + inSql + } else { + realSql += " WHERE " + inSql + } + case core.SQLITE: + inSql := fmt.Sprintf("rowid IN (SELECT rowid FROM %s%s)", tableName, orderSql) + if len(condition) > 0 { + realSql += " AND " + inSql + } else { + realSql += " WHERE " + inSql + } + // TODO: how to handle delete limit on mssql? + case core.MSSQL: + return 0, ErrNotImplemented + default: + realSql += orderSql + } } // !oinume! Insert NowTime to the head of session.Statement.Params diff --git a/xorm.go b/xorm.go index f9ab752f..2da9949e 100644 --- a/xorm.go +++ b/xorm.go @@ -17,7 +17,7 @@ import ( ) const ( - Version string = "0.4.5.0203" + Version string = "0.4.5.0204" ) func regDrvsNDialects() bool {