diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index f0c2612087..ca283f82d2 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -699,7 +699,17 @@ AcceptInvalidationMessages(void) } } #elif defined(CLOBBER_CACHE_RECURSIVELY) - InvalidateSystemCaches(); + { + static int recursion_depth = 0; + + /* Maximum depth is arbitrary depending on your threshold of pain */ + if (recursion_depth < 3) + { + recursion_depth++; + InvalidateSystemCaches(); + recursion_depth--; + } + } #endif }