diff --git a/sql/load_sql_context.sql b/sql/load_sql_context.sql
index 565e4e3..40cd99e 100644
--- a/sql/load_sql_context.sql
+++ b/sql/load_sql_context.sql
@@ -95,6 +95,8 @@ select
                     pg_type pt
                     left join pg_class tabs
                         on pt.typrelid = tabs.oid
+                    join search_path_oids spo
+                        on pt.typnamespace = spo.schema_oid or pt.typnamespace = 'pg_catalog'::regnamespace::oid
             ),
             jsonb_build_object()
         ),
@@ -111,6 +113,8 @@ select
                     pg_type pt
                     join pg_class tabs
                         on pt.typrelid = tabs.oid
+                    join search_path_oids spo
+                        on pt.typnamespace = spo.schema_oid or pt.typnamespace = 'pg_catalog'::regnamespace::oid
                 where
                     pt.typcategory = 'C'
                     and tabs.relkind = 'c'
@@ -420,4 +424,4 @@ select
             jsonb_build_array()
         )
 
-    )
+    );
