From d6b22f1f4c631d969910d0ee09755fae0943785e Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Mon, 22 Jun 2020 11:53:00 +0530 Subject: [PATCH] Fixed an issue where the search object is unable to locate inherited tables and constraint filters are not working. Fixes #5492 --- docs/en_US/release_notes_4_23.rst | 1 + .../js/search_objects_dialog_wrapper.js | 15 +++++++- .../search_objects/sql/pg/10_plus/search.sql | 37 +++++++++++-------- .../search_objects/sql/pg/11_plus/search.sql | 37 +++++++++++-------- .../sql/ppas/10_plus/search.sql | 37 +++++++++++-------- .../sql/ppas/12_plus/search.sql | 37 +++++++++++-------- 6 files changed, 98 insertions(+), 66 deletions(-) diff --git a/docs/en_US/release_notes_4_23.rst b/docs/en_US/release_notes_4_23.rst index 0e8716d03..c876c4e37 100644 --- a/docs/en_US/release_notes_4_23.rst +++ b/docs/en_US/release_notes_4_23.rst @@ -28,6 +28,7 @@ Bug fixes | `Issue #4226 `_ - Fixed an issue where select all checkbox only selects the first 50 tables. | `Issue #5416 `_ - Ensure that the query tool panel gets closed when clicking on the 'Don't Save' button. | `Issue #5465 `_ - Fixed an issue where the Edge browser version is showing wrong and warning message gets displayed. +| `Issue #5492 `_ - Fixed an issue where the search object is unable to locate inherited tables and constraint filters are not working. | `Issue #5507 `_ - Fixed connection and version number detection issue when the database server is upgraded. | `Issue #5521 `_ - Fixed an issue when dumping servers from a desktop pgAdmin app by providing an option '--sqlite-path'. | `Issue #5539 `_ - Fixed typo in exception keyword. 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,