From 3180c418c2454771181690a360a88204a2514826 Mon Sep 17 00:00:00 2001 From: fuge Date: Tue, 25 Jan 2022 13:28:46 +0800 Subject: [PATCH] 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 Reviewed-on: https://gitea.com/xorm/xorm/pulls/2105 Co-authored-by: fuge Co-committed-by: fuge --- dialects/postgres.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dialects/postgres.go b/dialects/postgres.go index 76279d32..a5b080aa 100644 --- a/dialects/postgres.go +++ b/dialects/postgres.go @@ -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):]