Skip to content

Commit 7707ad5

Browse files
committed
fix pathman_process_utility_hook() inadequate behavior in conjunction with some other extensions
1 parent 22085cd commit 7707ad5

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/hooks.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -613,27 +613,28 @@ pathman_process_utility_hook(Node *parsetree,
613613
DestReceiver *dest,
614614
char *completionTag)
615615
{
616-
/* Call hooks set by other extensions */
617-
if (process_utility_hook_next)
618-
process_utility_hook_next(parsetree, queryString,
619-
context, params,
620-
dest, completionTag);
621-
622616
/* Override standard COPY statement if needed */
623617
if (IsPathmanReady() && is_pathman_related_copy(parsetree))
624618
{
625619
uint64 processed;
626620

621+
/* Handle our COPY case (and show a special cmd name) */
627622
PathmanDoCopy((CopyStmt *) parsetree, queryString, &processed);
628623
if (completionTag)
629624
snprintf(completionTag, COMPLETION_TAG_BUFSIZE,
630625
"PATHMAN COPY " UINT64_FORMAT, processed);
631626

632-
return; /* don't call standard_ProcessUtility() */
627+
return; /* don't call standard_ProcessUtility() or hooks */
633628
}
634629

635-
/* Call internal implementation */
636-
standard_ProcessUtility(parsetree, queryString,
637-
context, params,
638-
dest, completionTag);
630+
/* Call hooks set by other extensions if needed */
631+
if (process_utility_hook_next)
632+
process_utility_hook_next(parsetree, queryString,
633+
context, params,
634+
dest, completionTag);
635+
/* Else call internal implementation */
636+
else
637+
standard_ProcessUtility(parsetree, queryString,
638+
context, params,
639+
dest, completionTag);
639640
}

0 commit comments

Comments
 (0)