Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 42c80c6

Browse files
committed
Assert that syscache lookups don't happen outside transactions.
Andres Freund
1 parent ac33c7e commit 42c80c6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/backend/utils/cache/catcache.c

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "access/sysattr.h"
2222
#include "access/tuptoaster.h"
2323
#include "access/valid.h"
24+
#include "access/xact.h"
2425
#include "catalog/pg_operator.h"
2526
#include "catalog/pg_type.h"
2627
#include "miscadmin.h"
@@ -1067,6 +1068,9 @@ SearchCatCache(CatCache *cache,
10671068
SysScanDesc scandesc;
10681069
HeapTuple ntp;
10691070

1071+
/* Make sure we're in a xact, even if this ends up being a cache hit */
1072+
Assert(IsTransactionState());
1073+
10701074
/*
10711075
* one-time startup overhead for each cache
10721076
*/

0 commit comments

Comments
 (0)