File tree Expand file tree Collapse file tree 3 files changed +20
-14
lines changed
Expand file tree Collapse file tree 3 files changed +20
-14
lines changed Original file line number Diff line number Diff line change @@ -850,6 +850,9 @@ LockAcquireExtended(const LOCKTAG *locktag,
850850 LWLock * partitionLock ;
851851 bool found_conflict ;
852852 bool log_lock = false;
853+ bool is_temp_relation_lock = pltsql_get_tsql_enr_from_oid_hook && locktag -> locktag_type == LOCKTAG_RELATION &&
854+ (* pltsql_get_tsql_enr_from_oid_hook )(locktag -> locktag_field2 );
855+ bool is_temp_object_lock = find_object_in_enr_hook && locktag -> locktag_type == LOCKTAG_OBJECT && (* find_object_in_enr_hook ) (locktag -> locktag_field2 , locktag -> locktag_field3 );
853856
854857 if (lockmethodid <= 0 || lockmethodid >= lengthof (LockMethods ))
855858 elog (ERROR , "unrecognized lock method: %d" , lockmethodid );
@@ -867,8 +870,7 @@ LockAcquireExtended(const LOCKTAG *locktag,
867870 lockMethodTable -> lockModeNames [lockmode ]),
868871 errhint ("Only RowExclusiveLock or less can be acquired on database objects during recovery." )));
869872
870- if (pltsql_get_tsql_enr_from_oid_hook && locktag -> locktag_type == LOCKTAG_RELATION &&
871- (* pltsql_get_tsql_enr_from_oid_hook )(locktag -> locktag_field2 ))
873+ if (is_temp_relation_lock || is_temp_object_lock )
872874 {
873875 /*
874876 * Normally, opening a relation with AccessExclusiveLock will automatically trigger for an XID
Original file line number Diff line number Diff line change 5656#define NUM_ENR_CATALOGS 11
5757
5858pltsql_get_tsql_enr_from_oid_hook_type pltsql_get_tsql_enr_from_oid_hook = NULL ;
59-
60- /*
61- * Private state of a query environment.
62- */
63- struct QueryEnvironment
64- {
65- List * namedRelList ;
66- List * dropped_namedRelList ;
67- List * savedCatcacheMessages ;
68- struct QueryEnvironment * parentEnv ;
69- MemoryContext memctx ;
70- };
59+ find_object_in_enr_hook_type find_object_in_enr_hook = NULL ;
7160
7261/*
7362 * This list must match ENRCatalogTupleType in queryenvironment.h.
Original file line number Diff line number Diff line change @@ -28,6 +28,18 @@ typedef enum EphemeralNameRelationType
2828 ENR_TSQL_TEMP , /* Temp table created in procedure/function */
2929} EphemeralNameRelationType ;
3030
31+ /*
32+ * Private state of a query environment.
33+ */
34+ struct QueryEnvironment
35+ {
36+ List * namedRelList ;
37+ List * dropped_namedRelList ;
38+ List * savedCatcacheMessages ;
39+ struct QueryEnvironment * parentEnv ;
40+ MemoryContext memctx ;
41+ };
42+
3143typedef enum ENRCatalogTupleType
3244{
3345 ENR_CATTUP_CLASS = 0 ,
@@ -171,4 +183,7 @@ extern bool has_existing_enr_relations(void);
171183typedef EphemeralNamedRelation (* pltsql_get_tsql_enr_from_oid_hook_type ) (Oid oid );
172184extern PGDLLIMPORT pltsql_get_tsql_enr_from_oid_hook_type pltsql_get_tsql_enr_from_oid_hook ;
173185
186+ typedef EphemeralNamedRelation (* find_object_in_enr_hook_type ) (Oid catalog_oid , Oid object_id );
187+ extern PGDLLIMPORT find_object_in_enr_hook_type find_object_in_enr_hook ;
188+
174189#endif /* QUERYENVIRONMENT_H */
You can’t perform that action at this time.
0 commit comments