Fix postgres bug
This commit is contained in:
parent
2ad8cfb1e8
commit
aec6c89568
|
@ -176,6 +176,10 @@ func TestReplace(t *testing.T) {
|
||||||
"UPDATE table SET `a` = ~ `a`, `b`='abc`'",
|
"UPDATE table SET `a` = ~ `a`, `b`='abc`'",
|
||||||
"UPDATE table SET [a] = ~ [a], [b]='abc`'",
|
"UPDATE table SET [a] = ~ [a], [b]='abc`'",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"INSERT INTO `insert_where` (`height`,`name`,`repo_id`,`width`,`index`) SELECT $1,$2,$3,$4,coalesce(MAX(`index`),0)+1 FROM `insert_where` WHERE (`repo_id`=$5)",
|
||||||
|
"INSERT INTO [insert_where] ([height],[name],[repo_id],[width],[index]) SELECT $1,$2,$3,$4,coalesce(MAX([index]),0)+1 FROM [insert_where] WHERE ([repo_id]=$5)",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, kase := range kases {
|
for _, kase := range kases {
|
||||||
|
|
|
@ -283,6 +283,7 @@ func (session *Session) insertStruct(bean interface{}) (int64, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
sqlStr = session.engine.dialect.Quoter().Replace(sqlStr)
|
||||||
|
|
||||||
handleAfterInsertProcessorFunc := func(bean interface{}) {
|
handleAfterInsertProcessorFunc := func(bean interface{}) {
|
||||||
if session.isAutoCommit {
|
if session.isAutoCommit {
|
||||||
|
|
Loading…
Reference in New Issue