Skip to content

Commit 3f3082c

Browse files
committed
Fix unhandled xact_event in postgres_fdw
1 parent 369bb0c commit 3f3082c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

contrib/postgres_fdw/connection.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,20 @@ pgfdw_xact_callback(XactEvent event, void *arg)
593593
HASH_SEQ_STATUS scan;
594594
ConnCacheEntry *entry;
595595

596+
/* Do nothing for this events */
597+
switch (event)
598+
{
599+
case XACT_EVENT_START:
600+
case XACT_EVENT_POST_PREPARE:
601+
case XACT_EVENT_COMMIT_PREPARED:
602+
case XACT_EVENT_PRE_COMMIT_PREPARED:
603+
case XACT_EVENT_ABORT_PREPARED:
604+
case XACT_EVENT_COMMIT_COMMAND:
605+
return;
606+
default:
607+
break;
608+
}
609+
596610
/* Quick exit if no connections were touched in this transaction. */
597611
if (!xact_got_connection)
598612
return;
@@ -714,6 +728,18 @@ pgfdw_xact_callback(XactEvent event, void *arg)
714728
entry->have_error = false;
715729
}
716730
break;
731+
case XACT_EVENT_START:
732+
case XACT_EVENT_POST_PREPARE:
733+
case XACT_EVENT_COMMIT_PREPARED:
734+
case XACT_EVENT_PRE_COMMIT_PREPARED:
735+
case XACT_EVENT_ABORT_PREPARED:
736+
case XACT_EVENT_COMMIT_COMMAND:
737+
/*
738+
* New event can break our state machine, so let's list
739+
* them here explicitely and force compiler warning in
740+
* case of unhandled event.
741+
*/
742+
break;
717743
}
718744
}
719745

0 commit comments

Comments
 (0)