diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index a4a54d41af4..5c2809132d1 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -619,7 +619,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 }