bugfix :Oid It's a special index. You can't put it in (#2105)

Co-authored-by: fuge <8342337@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2105
Co-authored-by: fuge <fuge@noreply.gitea.io>
Co-committed-by: fuge <fuge@noreply.gitea.io>
This commit is contained in:
fuge 2022-01-25 13:28:46 +08:00 committed by Lunny Xiao
parent 7802393d01
commit 3180c418c2
1 changed files with 13 additions and 0 deletions

View File

@ -1300,6 +1300,19 @@ func (db *postgres) GetIndexes(queryer core.Queryer, ctx context.Context, tableN
indexType = schemas.IndexType
}
colNames = getIndexColName(indexdef)
isSkip := false
//Oid It's a special index. You can't put it in
for _, element := range colNames {
if "oid" == element {
isSkip = true
break
}
}
if isSkip {
continue
}
var isRegular bool
if strings.HasPrefix(indexName, "IDX_"+tableName) || strings.HasPrefix(indexName, "UQE_"+tableName) {
newIdxName := indexName[5+len(tableName):]