Fixed an issue where the search object is unable to locate inherited tables and constraint filters are not working. Fixes #5492

This commit is contained in:
Aditya Toshniwal 2020-06-22 11:53:00 +05:30 committed by Akshay Joshi
parent 7ce7808093
commit d6b22f1f4c
6 changed files with 98 additions and 66 deletions

View File

@ -28,6 +28,7 @@ Bug fixes
| `Issue #4226 <https://redmine.postgresql.org/issues/4226>`_ - Fixed an issue where select all checkbox only selects the first 50 tables.
| `Issue #5416 <https://redmine.postgresql.org/issues/5416>`_ - Ensure that the query tool panel gets closed when clicking on the 'Don't Save' button.
| `Issue #5465 <https://redmine.postgresql.org/issues/5465>`_ - Fixed an issue where the Edge browser version is showing wrong and warning message gets displayed.
| `Issue #5492 <https://redmine.postgresql.org/issues/5492>`_ - Fixed an issue where the search object is unable to locate inherited tables and constraint filters are not working.
| `Issue #5507 <https://redmine.postgresql.org/issues/5507>`_ - Fixed connection and version number detection issue when the database server is upgraded.
| `Issue #5521 <https://redmine.postgresql.org/issues/5521>`_ - Fixed an issue when dumping servers from a desktop pgAdmin app by providing an option '--sqlite-path'.
| `Issue #5539 <https://redmine.postgresql.org/issues/5539>`_ - Fixed typo in exception keyword.

View File

@ -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();
});

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,