@@ -157,6 +157,8 @@ extern bool ENRGetSystableScan(Relation rel, Oid indexoid, int nkeys, ScanKey ke
157157extern bool ENRAddTuple (Relation rel , HeapTuple tup );
158158extern bool ENRDropTuple (Relation rel , HeapTuple tup );
159159extern bool ENRUpdateTuple (Relation rel , HeapTuple tup );
160+ extern Oid get_toast_parent_oid (const char * relname );
161+ extern QueryEnvironment * find_ENR_queryEnv (Oid relid );
160162
161163extern void ENRDropEntry (Oid id );
162164extern PGDLLEXPORT void ENRDropTempTables (QueryEnvironment * queryEnv );
@@ -188,51 +190,4 @@ extern PGDLLIMPORT find_object_in_enr_hook_type find_object_in_enr_hook;
188190typedef bool (* is_enr_to_sys_object_dependency_hook_type ) (const ObjectAddress * depender , const ObjectAddress * referenced );
189191extern PGDLLIMPORT is_enr_to_sys_object_dependency_hook_type is_enr_to_sys_object_dependency_hook ;
190192
191- /*
192- * Babelfish toast table name prefixes and length.
193- * Toast tables for temp tables are named "#pg_toast_<parent_rel_oid>".
194- * Toast tables for table variables are named "@pg_toast_<parent_rel_oid>".
195- * Both prefixes have the same length (10 characters).
196- */
197- #define BBF_TEMP_TOAST_PREFIX "#pg_toast_"
198- #define BBF_TABLEVAR_TOAST_PREFIX "@pg_toast_"
199- #define BBF_TOAST_PREFIX_LEN 10
200-
201- /*
202- * Extract parent table OID from temp toast table name.
203- * Toast table names follow the pattern "#pg_toast_<parent_rel_oid>" for temp tables
204- * or "@pg_toast_<parent_rel_oid>" for table variables.
205- * Returns the parent OID, or InvalidOid if the name doesn't match either pattern.
206- */
207- static inline Oid
208- get_toast_parent_oid (const char * relname )
209- {
210- if (strncmp (relname , BBF_TEMP_TOAST_PREFIX , BBF_TOAST_PREFIX_LEN ) == 0 ||
211- strncmp (relname , BBF_TABLEVAR_TOAST_PREFIX , BBF_TOAST_PREFIX_LEN ) == 0 )
212- return (Oid ) strtoul (relname + BBF_TOAST_PREFIX_LEN , NULL , 10 );
213- return InvalidOid ;
214- }
215-
216- /*
217- * find_ENR_queryEnv
218- *
219- * Find the query environment where an ENR with the given OID is registered.
220- * Searches from currentQueryEnv up through parent environments.
221- * Returns the queryEnv where the ENR is found, or NULL if not found.
222- */
223- static inline QueryEnvironment *
224- find_ENR_queryEnv (Oid relid )
225- {
226- QueryEnvironment * qe = currentQueryEnv ;
227-
228- while (qe )
229- {
230- if (get_ENR_withoid (qe , relid , ENR_TSQL_TEMP , false))
231- return qe ;
232- qe = qe -> parentEnv ;
233- }
234-
235- return NULL ;
236- }
237-
238- #endif /* QUERYENVIRONMENT_H */
193+ #endif /* QUERYENVIRONMENT_H */
0 commit comments