idiomatic use of CacheMemoryContext suggests to check its existence and create if not already created

pull/7236/head
Nils Dijk 2023-09-27 13:42:21 +00:00
parent c405f4e723
commit c964ab47ac
1 changed files with 7 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include "distributed/version_compat.h"
#include "nodes/pg_list.h"
#include "storage/lockdefs.h"
#include "utils/catcache.h"
#include "utils/fmgroids.h"
#include "utils/hsearch.h"
#include "common/hashfn.h"
@ -332,6 +333,12 @@ CreateForeignConstraintRelationshipGraph()
*/
if (ForeignConstraintRelationshipMemoryContext == NULL)
{
/* make sure we've initialized CacheMemoryContext */
if (CacheMemoryContext == NULL)
{
CreateCacheMemoryContext();
}
ForeignConstraintRelationshipMemoryContext = AllocSetContextCreate(
CacheMemoryContext,
"Foreign Constraint Relationship Graph Context",