diff --git a/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js b/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js
index d1ad3de96..925376e68 100644
--- a/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js
+++ b/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js
@@ -176,12 +176,23 @@ export default class SearchObjectsDialogWrapper extends DialogWrapper {
     };
 
     this.dataview.setFilter((item, args)=>{
-      return !(args && args.type != 'all' && item.type != args.type);
+      if(args && args.type != 'all') {
+        if(Array.isArray(args.type)) {
+          return (args.type.indexOf(item.type) != -1);
+        } else {
+          return args.type == item.type;
+        }
+      }
+      return true;
     });
 
     /* jquery required for select2 */
     this.jquery(this.typesSelect).on('change', ()=>{
-      this.dataview.setFilterArgs({ type: this.typesVal() });
+      let type = this.typesVal();
+      if(type === 'constraints') {
+        type = ['constraints', 'check_constraint', 'foreign_key', 'primary_key', 'unique_constraint', 'exclusion_constraint'];
+      }
+      this.dataview.setFilterArgs({ type: type });
       this.dataview.refresh();
     });
 
diff --git a/web/pgadmin/tools/search_objects/templates/search_objects/sql/pg/10_plus/search.sql b/web/pgadmin/tools/search_objects/templates/search_objects/sql/pg/10_plus/search.sql
index 35bc560b4..503307a87 100644
--- a/web/pgadmin/tools/search_objects/templates/search_objects/sql/pg/10_plus/search.sql
+++ b/web/pgadmin/tools/search_objects/templates/search_objects/sql/pg/10_plus/search.sql
@@ -53,17 +53,18 @@ FROM (
     SELECT CASE WHEN c.relispartition THEN 'partition' ELSE 'table' END::text AS obj_type, c.relname AS obj_name,
     ':schema.'|| n.oid || ':/' || n.nspname || '/' || (
 		WITH RECURSIVE table_path_data as (
-			select c.oid as oid, 0 as height,
+			select c.oid as oid, 0 as height, c.relkind,
 				CASE c.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || c.oid || ':/' || c.relname as path
 			union
-			select rel.oid, pt.height+1 as height,
+			select rel.oid, pt.height+1 as height, rel.relkind,
 				CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
 				|| rel.oid || ':/' || rel.relname || '/' || pt.path as path
 			from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
 			join pg_inherits inh ON inh.inhparent = rel.oid
 			join table_path_data pt ON inh.inhrelid = pt.oid
 		)
-		select path from table_path_data order by height desc limit 1
+		select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || c.oid || ':/' || c.relname END AS path
+		from table_path_data order by height desc limit 1
 	) obj_path, n.nspname AS schema_name,
 	CASE WHEN c.relispartition THEN {{ show_node_prefs['partition'] }}
 	    ELSE {{ show_node_prefs['table'] }} END AS show_node,
@@ -88,18 +89,19 @@ FROM (
             WHEN tab.relkind in ('r', 't', 'p') THEN
                 (
                     WITH RECURSIVE table_path_data as (
-                        select tab.oid as oid, 0 as height,
+                        select tab.oid as oid, 0 as height, tab.relkind,
                             CASE tab.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || tab.oid || ':/' || tab.relname as path
                         union
-                        select rel.oid, pt.height+1 as height,
+                        select rel.oid, pt.height+1 as height, rel.relkind,
                             CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                             || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                         from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                         join pg_inherits inh ON inh.inhparent = rel.oid
                         join table_path_data pt ON inh.inhrelid = pt.oid
                     )
-                    select path from table_path_data order by height desc limit 1
-                )
+                    select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || tab.oid || ':/' || tab.relname END AS path
+                    from table_path_data order by height desc limit 1
+               )
         end
         || '/:index.'|| cls.oid ||':/' || cls.relname AS obj_path, n.nspname AS schema_name,
     {{ show_node_prefs['index'] }} AS show_node, NULL AS other_info
@@ -180,17 +182,18 @@ FROM (
     ':schema.'||n.oid||':/' || n.nspname||'/'||
     (
 		WITH RECURSIVE table_path_data as (
-			select t.oid as oid, 0 as height,
+			select t.oid as oid, 0 as height, t.relkind,
 				CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
 			union
-			select rel.oid, pt.height+1 as height,
+			select rel.oid, pt.height+1 as height, rel.relkind,
 				CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
 				|| rel.oid || ':/' || rel.relname || '/' || pt.path as path
 			from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
 			join pg_inherits inh ON inh.inhparent = rel.oid
 			join table_path_data pt ON inh.inhrelid = pt.oid
 		)
-		select path from table_path_data order by height desc limit 1
+		select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+		from table_path_data order by height desc limit 1
 	) ||
     CASE
         WHEN c.contype = 'c' THEN  '/:check_constraint.' ||c.oid
@@ -230,17 +233,18 @@ FROM (
                 WHEN t.relkind in ('r', 't', 'p') THEN
                     (
                         WITH RECURSIVE table_path_data as (
-                            select t.oid as oid, 0 as height,
+                            select t.oid as oid, 0 as height, t.relkind,
                                 CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
                             union
-                            select rel.oid, pt.height+1 as height,
+                            select rel.oid, pt.height+1 as height, rel.relkind,
                                 CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                                 || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                             from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                             join pg_inherits inh ON inh.inhparent = rel.oid
                             join table_path_data pt ON inh.inhrelid = pt.oid
                         )
-                        select path from table_path_data order by height desc limit 1
+                        select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+                        from table_path_data order by height desc limit 1
                     )
             end
             ||'/:rule.'||r.oid||':/'|| r.rulename AS obj_path,
@@ -261,17 +265,18 @@ FROM (
             WHEN t.relkind in ('r', 't', 'p') THEN
             (
                 WITH RECURSIVE table_path_data as (
-                    select t.oid as oid, 0 as height,
+                    select t.oid as oid, 0 as height, t.relkind,
                         CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
                     union
-                    select rel.oid, pt.height+1 as height,
+                    select rel.oid, pt.height+1 as height, rel.relkind,
                         CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                         || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                     from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                     join pg_inherits inh ON inh.inhparent = rel.oid
                     join table_path_data pt ON inh.inhrelid = pt.oid
                 )
-                select path from table_path_data order by height desc limit 1
+                select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+                from table_path_data order by height desc limit 1
             )
         end || '/:trigger.'|| tr.oid || ':/' || tr.tgname AS obj_path, n.nspname AS schema_name,
         {{ show_node_prefs['trigger'] }} AS show_node, NULL AS other_info
diff --git a/web/pgadmin/tools/search_objects/templates/search_objects/sql/pg/11_plus/search.sql b/web/pgadmin/tools/search_objects/templates/search_objects/sql/pg/11_plus/search.sql
index bba08bc4b..ebae55a68 100644
--- a/web/pgadmin/tools/search_objects/templates/search_objects/sql/pg/11_plus/search.sql
+++ b/web/pgadmin/tools/search_objects/templates/search_objects/sql/pg/11_plus/search.sql
@@ -53,17 +53,18 @@ FROM (
     SELECT CASE WHEN c.relispartition THEN 'partition' ELSE 'table' END::text AS obj_type, c.relname AS obj_name,
     ':schema.'|| n.oid || ':/' || n.nspname || '/' || (
 		WITH RECURSIVE table_path_data as (
-			select c.oid as oid, 0 as height,
+			select c.oid as oid, 0 as height, c.relkind,
 				CASE c.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || c.oid || ':/' || c.relname as path
 			union
-			select rel.oid, pt.height+1 as height,
+			select rel.oid, pt.height+1 as height, rel.relkind,
 				CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
 				|| rel.oid || ':/' || rel.relname || '/' || pt.path as path
 			from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
 			join pg_inherits inh ON inh.inhparent = rel.oid
 			join table_path_data pt ON inh.inhrelid = pt.oid
 		)
-		select path from table_path_data order by height desc limit 1
+		select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || c.oid || ':/' || c.relname END AS path
+		from table_path_data order by height desc limit 1
 	) obj_path, n.nspname AS schema_name,
 	CASE WHEN c.relispartition THEN {{ show_node_prefs['partition'] }}
 	    ELSE {{ show_node_prefs['table'] }} END AS show_node,
@@ -88,18 +89,19 @@ FROM (
             WHEN tab.relkind in ('r', 't', 'p') THEN
                 (
                     WITH RECURSIVE table_path_data as (
-                        select tab.oid as oid, 0 as height,
+                        select tab.oid as oid, 0 as height, tab.relkind,
                             CASE tab.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || tab.oid || ':/' || tab.relname as path
                         union
-                        select rel.oid, pt.height+1 as height,
+                        select rel.oid, pt.height+1 as height, rel.relkind,
                             CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                             || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                         from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                         join pg_inherits inh ON inh.inhparent = rel.oid
                         join table_path_data pt ON inh.inhrelid = pt.oid
                     )
-                    select path from table_path_data order by height desc limit 1
-                )
+                    select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || tab.oid || ':/' || tab.relname END AS path
+                    from table_path_data order by height desc limit 1
+               )
         end
         || '/:index.'|| cls.oid ||':/' || cls.relname AS obj_path, n.nspname AS schema_name,
     {{ show_node_prefs['index'] }} AS show_node, NULL AS other_info
@@ -197,17 +199,18 @@ FROM (
     ':schema.'||n.oid||':/' || n.nspname||'/'||
     (
 		WITH RECURSIVE table_path_data as (
-			select t.oid as oid, 0 as height,
+			select t.oid as oid, 0 as height, t.relkind,
 				CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
 			union
-			select rel.oid, pt.height+1 as height,
+			select rel.oid, pt.height+1 as height, rel.relkind,
 				CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
 				|| rel.oid || ':/' || rel.relname || '/' || pt.path as path
 			from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
 			join pg_inherits inh ON inh.inhparent = rel.oid
 			join table_path_data pt ON inh.inhrelid = pt.oid
 		)
-		select path from table_path_data order by height desc limit 1
+		select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+		from table_path_data order by height desc limit 1
 	) ||
     CASE
         WHEN c.contype = 'c' THEN  '/:check_constraint.' ||c.oid
@@ -247,17 +250,18 @@ FROM (
                 WHEN t.relkind in ('r', 't', 'p') THEN
                     (
                         WITH RECURSIVE table_path_data as (
-                            select t.oid as oid, 0 as height,
+                            select t.oid as oid, 0 as height, t.relkind,
                                 CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
                             union
-                            select rel.oid, pt.height+1 as height,
+                            select rel.oid, pt.height+1 as height, rel.relkind,
                                 CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                                 || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                             from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                             join pg_inherits inh ON inh.inhparent = rel.oid
                             join table_path_data pt ON inh.inhrelid = pt.oid
                         )
-                        select path from table_path_data order by height desc limit 1
+                        select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+                        from table_path_data order by height desc limit 1
                     )
             end
             ||'/:rule.'||r.oid||':/'|| r.rulename AS obj_path,
@@ -278,17 +282,18 @@ FROM (
             WHEN t.relkind in ('r', 't', 'p') THEN
             (
                 WITH RECURSIVE table_path_data as (
-                    select t.oid as oid, 0 as height,
+                    select t.oid as oid, 0 as height, t.relkind,
                         CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
                     union
-                    select rel.oid, pt.height+1 as height,
+                    select rel.oid, pt.height+1 as height, rel.relkind,
                         CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                         || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                     from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                     join pg_inherits inh ON inh.inhparent = rel.oid
                     join table_path_data pt ON inh.inhrelid = pt.oid
                 )
-                select path from table_path_data order by height desc limit 1
+                select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+                from table_path_data order by height desc limit 1
             )
         end || '/:trigger.'|| tr.oid || ':/' || tr.tgname AS obj_path, n.nspname AS schema_name,
         {{ show_node_prefs['trigger'] }} AS show_node, NULL AS other_info
diff --git a/web/pgadmin/tools/search_objects/templates/search_objects/sql/ppas/10_plus/search.sql b/web/pgadmin/tools/search_objects/templates/search_objects/sql/ppas/10_plus/search.sql
index 5e4d44d1e..97604a794 100644
--- a/web/pgadmin/tools/search_objects/templates/search_objects/sql/ppas/10_plus/search.sql
+++ b/web/pgadmin/tools/search_objects/templates/search_objects/sql/ppas/10_plus/search.sql
@@ -53,17 +53,18 @@ FROM (
     SELECT CASE WHEN c.relispartition THEN 'partition' ELSE 'table' END::text AS obj_type, c.relname AS obj_name,
     ':schema.'|| n.oid || ':/' || n.nspname || '/' || (
 		WITH RECURSIVE table_path_data as (
-			select c.oid as oid, 0 as height,
+			select c.oid as oid, 0 as height, c.relkind,
 				CASE c.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || c.oid || ':/' || c.relname as path
 			union
-			select rel.oid, pt.height+1 as height,
+			select rel.oid, pt.height+1 as height, rel.relkind,
 				CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
 				|| rel.oid || ':/' || rel.relname || '/' || pt.path as path
 			from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
 			join pg_inherits inh ON inh.inhparent = rel.oid
 			join table_path_data pt ON inh.inhrelid = pt.oid
 		)
-		select path from table_path_data order by height desc limit 1
+		select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || c.oid || ':/' || c.relname END AS path
+		from table_path_data order by height desc limit 1
 	) obj_path, n.nspname AS schema_name,
 	CASE WHEN c.relispartition THEN {{ show_node_prefs['partition'] }}
 	    ELSE {{ show_node_prefs['table'] }} END AS show_node,
@@ -88,18 +89,19 @@ FROM (
             WHEN tab.relkind in ('r', 't', 'p') THEN
                 (
                     WITH RECURSIVE table_path_data as (
-                        select tab.oid as oid, 0 as height,
+                        select tab.oid as oid, 0 as height, tab.relkind,
                             CASE tab.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || tab.oid || ':/' || tab.relname as path
                         union
-                        select rel.oid, pt.height+1 as height,
+                        select rel.oid, pt.height+1 as height, rel.relkind,
                             CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                             || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                         from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                         join pg_inherits inh ON inh.inhparent = rel.oid
                         join table_path_data pt ON inh.inhrelid = pt.oid
                     )
-                    select path from table_path_data order by height desc limit 1
-                )
+                    select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || tab.oid || ':/' || tab.relname END AS path
+                    from table_path_data order by height desc limit 1
+               )
         end
         || '/:index.'|| cls.oid ||':/' || cls.relname AS obj_path, n.nspname AS schema_name,
     {{ show_node_prefs['index'] }} AS show_node, NULL AS other_info
@@ -219,17 +221,18 @@ FROM (
     ':schema.'||n.oid||':/' || n.nspname||'/'||
     (
 		WITH RECURSIVE table_path_data as (
-			select t.oid as oid, 0 as height,
+			select t.oid as oid, 0 as height, t.relkind,
 				CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
 			union
-			select rel.oid, pt.height+1 as height,
+			select rel.oid, pt.height+1 as height, rel.relkind,
 				CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
 				|| rel.oid || ':/' || rel.relname || '/' || pt.path as path
 			from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
 			join pg_inherits inh ON inh.inhparent = rel.oid
 			join table_path_data pt ON inh.inhrelid = pt.oid
 		)
-		select path from table_path_data order by height desc limit 1
+		select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+		from table_path_data order by height desc limit 1
 	) ||
     CASE
         WHEN c.contype = 'c' THEN  '/:check_constraint.' ||c.oid
@@ -269,17 +272,18 @@ FROM (
                 WHEN t.relkind in ('r', 't', 'p') THEN
                     (
                         WITH RECURSIVE table_path_data as (
-                            select t.oid as oid, 0 as height,
+                            select t.oid as oid, 0 as height, t.relkind,
                                 CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
                             union
-                            select rel.oid, pt.height+1 as height,
+                            select rel.oid, pt.height+1 as height, rel.relkind,
                                 CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                                 || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                             from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                             join pg_inherits inh ON inh.inhparent = rel.oid
                             join table_path_data pt ON inh.inhrelid = pt.oid
                         )
-                        select path from table_path_data order by height desc limit 1
+                        select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+                        from table_path_data order by height desc limit 1
                     )
             end
             ||'/:rule.'||r.oid||':/'|| r.rulename AS obj_path,
@@ -301,17 +305,18 @@ FROM (
             WHEN t.relkind in ('r', 't', 'p') THEN
             (
                 WITH RECURSIVE table_path_data as (
-                    select t.oid as oid, 0 as height,
+                    select t.oid as oid, 0 as height, t.relkind,
                         CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
                     union
-                    select rel.oid, pt.height+1 as height,
+                    select rel.oid, pt.height+1 as height, rel.relkind,
                         CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                         || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                     from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                     join pg_inherits inh ON inh.inhparent = rel.oid
                     join table_path_data pt ON inh.inhrelid = pt.oid
                 )
-                select path from table_path_data order by height desc limit 1
+                select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+                from table_path_data order by height desc limit 1
             )
         end || '/:trigger.'|| tr.oid || ':/' || tr.tgname AS obj_path, n.nspname AS schema_name,
         {{ show_node_prefs['trigger'] }} AS show_node, NULL AS other_info
diff --git a/web/pgadmin/tools/search_objects/templates/search_objects/sql/ppas/12_plus/search.sql b/web/pgadmin/tools/search_objects/templates/search_objects/sql/ppas/12_plus/search.sql
index 2d69ab165..e567ce496 100644
--- a/web/pgadmin/tools/search_objects/templates/search_objects/sql/ppas/12_plus/search.sql
+++ b/web/pgadmin/tools/search_objects/templates/search_objects/sql/ppas/12_plus/search.sql
@@ -53,17 +53,18 @@ FROM (
     SELECT CASE WHEN c.relispartition THEN 'partition' ELSE 'table' END::text AS obj_type, c.relname AS obj_name,
     ':schema.'|| n.oid || ':/' || n.nspname || '/' || (
 		WITH RECURSIVE table_path_data as (
-			select c.oid as oid, 0 as height,
+			select c.oid as oid, 0 as height, c.relkind,
 				CASE c.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || c.oid || ':/' || c.relname as path
 			union
-			select rel.oid, pt.height+1 as height,
+			select rel.oid, pt.height+1 as height, rel.relkind,
 				CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
 				|| rel.oid || ':/' || rel.relname || '/' || pt.path as path
 			from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
 			join pg_inherits inh ON inh.inhparent = rel.oid
 			join table_path_data pt ON inh.inhrelid = pt.oid
 		)
-		select path from table_path_data order by height desc limit 1
+		select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || c.oid || ':/' || c.relname END AS path
+		from table_path_data order by height desc limit 1
 	) obj_path, n.nspname AS schema_name,
 	CASE WHEN c.relispartition THEN {{ show_node_prefs['partition'] }}
 	    ELSE {{ show_node_prefs['table'] }} END AS show_node,
@@ -88,18 +89,19 @@ FROM (
             WHEN tab.relkind in ('r', 't', 'p') THEN
                 (
                     WITH RECURSIVE table_path_data as (
-                        select tab.oid as oid, 0 as height,
+                        select tab.oid as oid, 0 as height, tab.relkind,
                             CASE tab.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || tab.oid || ':/' || tab.relname as path
                         union
-                        select rel.oid, pt.height+1 as height,
+                        select rel.oid, pt.height+1 as height, rel.relkind,
                             CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                             || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                         from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                         join pg_inherits inh ON inh.inhparent = rel.oid
                         join table_path_data pt ON inh.inhrelid = pt.oid
                     )
-                    select path from table_path_data order by height desc limit 1
-                )
+                    select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || tab.oid || ':/' || tab.relname END AS path
+                    from table_path_data order by height desc limit 1
+               )
         end
         || '/:index.'|| cls.oid ||':/' || cls.relname AS obj_path, n.nspname AS schema_name,
     {{ show_node_prefs['index'] }} AS show_node, NULL AS other_info
@@ -219,17 +221,18 @@ FROM (
     ':schema.'||n.oid||':/' || n.nspname||'/'||
     (
 		WITH RECURSIVE table_path_data as (
-			select t.oid as oid, 0 as height,
+			select t.oid as oid, 0 as height, t.relkind,
 				CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
 			union
-			select rel.oid, pt.height+1 as height,
+			select rel.oid, pt.height+1 as height, rel.relkind,
 				CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
 				|| rel.oid || ':/' || rel.relname || '/' || pt.path as path
 			from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
 			join pg_inherits inh ON inh.inhparent = rel.oid
 			join table_path_data pt ON inh.inhrelid = pt.oid
 		)
-		select path from table_path_data order by height desc limit 1
+		select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+		from table_path_data order by height desc limit 1
 	) ||
     CASE
         WHEN c.contype = 'c' THEN  '/:check_constraint.' ||c.oid
@@ -269,17 +272,18 @@ FROM (
                 WHEN t.relkind in ('r', 't', 'p') THEN
                     (
                         WITH RECURSIVE table_path_data as (
-                            select t.oid as oid, 0 as height,
+                            select t.oid as oid, 0 as height, t.relkind,
                                 CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
                             union
-                            select rel.oid, pt.height+1 as height,
+                            select rel.oid, pt.height+1 as height, rel.relkind,
                                 CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                                 || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                             from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                             join pg_inherits inh ON inh.inhparent = rel.oid
                             join table_path_data pt ON inh.inhrelid = pt.oid
                         )
-                        select path from table_path_data order by height desc limit 1
+                        select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+                        from table_path_data order by height desc limit 1
                     )
             end
             ||'/:rule.'||r.oid||':/'|| r.rulename AS obj_path,
@@ -302,17 +306,18 @@ FROM (
             WHEN t.relkind in ('r', 't', 'p') THEN
             (
                 WITH RECURSIVE table_path_data as (
-                    select t.oid as oid, 0 as height,
+                    select t.oid as oid, 0 as height, t.relkind,
                         CASE t.relispartition WHEN true THEN ':partition.' ELSE ':table.' END || t.oid || ':/' || t.relname as path
                     union
-                    select rel.oid, pt.height+1 as height,
+                    select rel.oid, pt.height+1 as height, rel.relkind,
                         CASE rel.relispartition WHEN true THEN ':partition.' ELSE ':table.' END
                         || rel.oid || ':/' || rel.relname || '/' || pt.path as path
                     from pg_class rel JOIN pg_namespace nsp ON rel.relnamespace = nsp.oid
                     join pg_inherits inh ON inh.inhparent = rel.oid
                     join table_path_data pt ON inh.inhrelid = pt.oid
                 )
-                select path from table_path_data order by height desc limit 1
+                select CASE WHEN relkind = 'p' THEN path ELSE ':table.' || t.oid || ':/' || t.relname END AS path
+                from table_path_data order by height desc limit 1
             )
         end || CASE WHEN tr.tgpackageoid != 0 THEN '/:compound_trigger.' ELSE '/:trigger.' END || tr.oid || ':/' || tr.tgname AS obj_path, n.nspname AS schema_name,
         CASE WHEN tr.tgpackageoid != 0 THEN {{ show_node_prefs['compound_trigger'] }} ELSE {{ show_node_prefs['trigger'] }} END AS show_node,
