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

Commit 8b0be38

Browse files
committed
fix drop temp table
1 parent 875743b commit 8b0be38

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

multimaster.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,7 +2379,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
23792379
ProcessUtilityContext context, ParamListInfo params,
23802380
DestReceiver *dest, char *completionTag)
23812381
{
2382-
bool skipCommand;
2382+
bool skipCommand = false;
23832383
MTM_TRACE("%d: Process utility statement %s\n", MyProcPid, queryString);
23842384
switch (nodeTag(parsetree))
23852385
{
@@ -2469,14 +2469,21 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24692469
break;
24702470
case T_DropStmt:
24712471
{
2472-
Oid relid;
2473-
Relation rel;
24742472
DropStmt *stmt = (DropStmt *) parsetree;
24752473

2476-
//relid = RelnameGetRelid(stmt->relation->relname);
2477-
//rel = heap_open(relid, ShareLock);
2478-
//skipCommand = rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP;
2479-
//heap_close(rel, NoLock);
2474+
if (stmt->removeType == OBJECT_TABLE)
2475+
{
2476+
RangeVar *rv = makeRangeVarFromNameList(
2477+
(List *) lfirst(list_head(stmt->objects)));
2478+
Oid relid = RelnameGetRelid(rv->relname);
2479+
2480+
if (OidIsValid(relid))
2481+
{
2482+
Relation rel = heap_open(relid, ShareLock);
2483+
skipCommand = rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP;
2484+
heap_close(rel, ShareLock);
2485+
}
2486+
}
24802487
}
24812488
break;
24822489
default:

0 commit comments

Comments
 (0)