Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3cdb373

Browse files
committed
disallow concurrent index creation insise tx
1 parent 9bacc10 commit 3cdb373

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

multimaster.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,21 +2437,17 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24372437
case T_IndexStmt:
24382438
{
24392439
Oid relid;
2440-
LOCKMODE lockmode;
24412440
Relation rel;
2442-
24432441
IndexStmt *stmt = (IndexStmt *) parsetree;
2444-
lockmode = stmt->concurrent ? ShareUpdateExclusiveLock
2445-
: ShareLock;
2446-
relid = RangeVarGetRelidExtended(stmt->relation, lockmode,
2447-
false, false,
2448-
NULL, // ???
2449-
NULL);
2442+
bool isTopLevel = (context == PROCESS_UTILITY_TOPLEVEL);
24502443

2451-
rel = heap_open(relid, lockmode);
2444+
if (stmt->concurrent)
2445+
PreventTransactionChain(isTopLevel,
2446+
"CREATE INDEX CONCURRENTLY");
24522447

2448+
relid = RelnameGetRelid(stmt->relation->relname);
2449+
rel = heap_open(relid, ShareLock);
24532450
skipCommand = rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP;
2454-
24552451
heap_close(rel, NoLock);
24562452
}
24572453
break;

0 commit comments

Comments
 (0)