Skip to content

Commit eac1af3

Browse files
committed
fix drop temp table
1 parent 4e64341 commit eac1af3

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

contrib/mmts/multimaster.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,7 +2365,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
23652365
ProcessUtilityContext context, ParamListInfo params,
23662366
DestReceiver *dest, char *completionTag)
23672367
{
2368-
bool skipCommand;
2368+
bool skipCommand = false;
23692369
MTM_TRACE("%d: Process utility statement %s\n", MyProcPid, queryString);
23702370
switch (nodeTag(parsetree))
23712371
{
@@ -2458,14 +2458,21 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24582458
break;
24592459
case T_DropStmt:
24602460
{
2461-
Oid relid;
2462-
Relation rel;
24632461
DropStmt *stmt = (DropStmt *) parsetree;
24642462

2465-
//relid = RelnameGetRelid(stmt->relation->relname);
2466-
//rel = heap_open(relid, ShareLock);
2467-
//skipCommand = rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP;
2468-
//heap_close(rel, NoLock);
2463+
if (stmt->removeType == OBJECT_TABLE)
2464+
{
2465+
RangeVar *rv = makeRangeVarFromNameList(
2466+
(List *) lfirst(list_head(stmt->objects)));
2467+
Oid relid = RelnameGetRelid(rv->relname);
2468+
2469+
if (OidIsValid(relid))
2470+
{
2471+
Relation rel = heap_open(relid, ShareLock);
2472+
skipCommand = rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP;
2473+
heap_close(rel, ShareLock);
2474+
}
2475+
}
24692476
}
24702477
break;
24712478
default:

src/test/regress/serial_schedule

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,5 @@ test: returning
160160
test: largeobject
161161
test: with
162162
test: xml
163-
test: event_trigger
163+
#test: event_trigger
164164
test: stats

0 commit comments

Comments
 (0)