queryDesc->operation == CMD_SELECT &&
queryDesc->plannedstmt->planTree &&
queryDesc->plannedstmt->planTree->targetlist &&
- list_length(queryDesc->plannedstmt->planTree->targetlist) == 1 &&
- IsA(linitial(queryDesc->plannedstmt->planTree->targetlist), TargetEntry)
+ list_length(queryDesc->plannedstmt->planTree->targetlist) == 1
))
return NULL;
fe->funcretset == false &&
fe->funcresulttype == VOIDOID &&
fe->funcvariadic == false &&
- list_length(fe->args) == 1 &&
- IsA(linitial(fe->args), Const)
+ list_length(fe->args) == 1
))
return NULL;
}
-
extern PGDLLIMPORT void onlineAnalyzeHooker(QueryDesc *queryDesc);
void
onlineAnalyzeHooker(QueryDesc *queryDesc)
standard_ExecutorEnd(queryDesc);
}
+static List *toremove = NIL;
+
+/*
+ * removeTable called on transaction end, see call RegisterXactCallback() below
+ */
static void
removeTable(XactEvent event, void *arg)
{
- List *toremove = arg;
ListCell *cell;
- if (event != XACT_EVENT_COMMIT)
- return;
+ switch(event)
+ {
+ case XACT_EVENT_COMMIT:
+ break;
+ case XACT_EVENT_ABORT:
+ toremove = NIL;
+ default:
+ return;
+ }
foreach(cell, toremove)
{
hash_search(relstats, &relOid, HASH_REMOVE, NULL);
}
+
+ toremove = NIL;
}
((DropStmt*)parsetree)->removeType == OBJECT_TABLE)
{
ListCell *cell;
- List *toremove = NIL;
foreach(cell, ((DropStmt*)parsetree)->objects)
{
MemoryContextSwitchTo(ctx);
}
}
-
- if (list_length(toremove) > 0)
- RegisterXactCallback(removeTable, toremove);
}
else if (IsA(parsetree, VacuumStmt))
{
NULL
);
+ RegisterXactCallback(removeTable, NULL);
}
void _PG_fini(void);