mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-26 16:26:48 -06:00
Fixed an issue where the search object module unable to locate the object in the browser tree. Fixes #5396
This commit is contained in:
parent
f282b26883
commit
7361470b64
@ -67,6 +67,7 @@ Bug fixes
|
||||
| `Issue #5375 <https://redmine.postgresql.org/issues/5375>`_ - Fixed an issue where the Mode cell of argument grid does not appear completely in the Functions dialog.
|
||||
| `Issue #5383 <https://redmine.postgresql.org/issues/5383>`_ - Fixed syntax error while refreshing the existing synonyms.
|
||||
| `Issue #5387 <https://redmine.postgresql.org/issues/5387>`_ - Fixed an issue where the mode is not shown in the properties dialog of functions/procedures if all the arguments are "IN" arguments.
|
||||
| `Issue #5396 <https://redmine.postgresql.org/issues/5396>`_ - Fixed an issue where the search object module unable to locate the object in the browser tree.
|
||||
| `Issue #5400 <https://redmine.postgresql.org/issues/5400>`_ - Fixed internal server error when the database server is logged in with non-super user.
|
||||
| `Issue #5409 <https://redmine.postgresql.org/issues/5409>`_ - Fixed validation issue in Synonyms node.
|
||||
| `Issue #5410 <https://redmine.postgresql.org/issues/5410>`_ - Fixed an issue while removing the package body showing wrong modified SQL.
|
@ -353,7 +353,7 @@ export default class SearchObjectsDialogWrapper extends DialogWrapper {
|
||||
/* finalise path */
|
||||
[datum.path, datum.id_path] = this.translateSearchObjectsPath(datum.path, datum.catalog_level);
|
||||
/* id is required by slickgrid dataview */
|
||||
datum.id = datum.id_path;
|
||||
datum.id = datum.id_path.join('.');
|
||||
return datum;
|
||||
}
|
||||
|
||||
@ -367,7 +367,9 @@ export default class SearchObjectsDialogWrapper extends DialogWrapper {
|
||||
* Sample path required by tree locator
|
||||
* Normal object - server_group/1.server/3.coll-database/3.database/13258.coll-schema/13258.schema/2200.coll-table/2200.table/41773
|
||||
* pg_catalog schema - server_group/1.server/3.coll-database/3.database/13258.coll-catalog/13258.catalog/11.coll-table/11.table/2600
|
||||
* Information Schema, dbo, sys - server_group/1.server/3.coll-database/3.database/13258.coll-catalog/13258.catalog/12967.coll-catalog_object/12967.catalog_object/13204
|
||||
* Information Schema, dbo, sys:
|
||||
* server_group/1.server/3.coll-database/3.database/13258.coll-catalog/13258.catalog/12967.coll-catalog_object/12967.catalog_object/13204
|
||||
* server_group/1.server/11.coll-database/11.database/13258.coll-catalog/13258.catalog/12967.coll-catalog_object/12967.catalog_object/12997.coll-catalog_object_column/12997.catalog_object_column/13
|
||||
*
|
||||
* Column catalog_level has values as
|
||||
* N - Not a catalog schema
|
||||
@ -394,7 +396,7 @@ export default class SearchObjectsDialogWrapper extends DialogWrapper {
|
||||
|
||||
/* add the slash to match regex, remove it from display path later */
|
||||
path = '/' + path;
|
||||
/* the below regex will match all /:server_group.1:/ */
|
||||
/* the below regex will match all /:schema.2200:/ */
|
||||
let new_path = path.replace(/\/:[a-zA-Z_]+\.[0-9]+:\//g, (token)=>{
|
||||
let orig_token = token;
|
||||
/* remove the slash and colon */
|
||||
@ -410,6 +412,9 @@ export default class SearchObjectsDialogWrapper extends DialogWrapper {
|
||||
/* catalog like info schema will only have views and tables AKA catalog_object except for pg_catalog */
|
||||
node_type = (catalog_level === 'O' && ['view', 'table'].indexOf(node_type) != -1) ? 'catalog_object' : node_type;
|
||||
|
||||
/* catalog_object will have column node as catalog_object_column */
|
||||
node_type = (catalog_level === 'O' && node_type == 'column') ? 'catalog_object_column' : node_type;
|
||||
|
||||
/* If collection node present then add it */
|
||||
let coll_node = this.getCollNode(node_type);
|
||||
if(coll_node) {
|
||||
|
@ -44,7 +44,7 @@ FROM (
|
||||
{% elif obj_type == 'mview' %}
|
||||
WHERE c.relkind = 'm'
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
AND CASE WHEN c.relkind in ('S', 'm') THEN {{ CATALOGS.DB_SUPPORT('n') }} ELSE true END
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -76,14 +76,32 @@ FROM (
|
||||
{% elif obj_type == 'partition' %}
|
||||
AND c.relispartition
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
AND CASE WHEN c.relispartition THEN {{ CATALOGS.DB_SUPPORT('n') }} ELSE true END
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['index'] %}
|
||||
SELECT 'index'::text AS obj_type, cls.relname AS obj_name,
|
||||
':schema.'|| n.oid || ':/' || n.nspname || '/:table.'|| tab.oid ||':/' || tab.relname || '/:index.'|| cls.oid ||':/' || cls.relname AS obj_path, n.nspname AS schema_name,
|
||||
SELECT 'index'::text AS obj_type, cls.relname AS obj_name, ':schema.'|| n.oid || ':/' || n.nspname || '/' ||
|
||||
case
|
||||
when tab.relkind = 'm' then ':mview.' || tab.oid || ':' || '/' || tab.relname
|
||||
WHEN tab.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
select tab.oid as oid, 0 as height,
|
||||
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,
|
||||
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
|
||||
)
|
||||
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
|
||||
FROM pg_index idx
|
||||
JOIN pg_class cls ON cls.oid=indexrelid
|
||||
@ -94,6 +112,7 @@ FROM (
|
||||
LEFT OUTER JOIN pg_description des ON des.objoid=cls.oid
|
||||
LEFT OUTER JOIN pg_description desp ON (desp.objoid=con.oid AND desp.objsubid = 0)
|
||||
WHERE contype IS NULL
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -175,7 +194,7 @@ FROM (
|
||||
) ||
|
||||
CASE
|
||||
WHEN c.contype = 'c' THEN '/:check_constraint.' ||c.oid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.conindid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.oid
|
||||
WHEN c.contype = 'p' THEN '/:primary_key.' ||c.conindid
|
||||
WHEN c.contype = 'u' THEN '/:unique_constraint.' ||c.conindid
|
||||
WHEN c.contype = 'x' THEN '/:exclusion_constraint.' ||c.conindid
|
||||
@ -199,6 +218,7 @@ FROM (
|
||||
{% else %}
|
||||
AND c.contype IN ('c', 'f', 'p', 'u', 'x')
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -206,8 +226,7 @@ FROM (
|
||||
{% if all_obj or obj_type in ['rule'] %}
|
||||
select 'rule'::text AS obj_type, r.rulename AS obj_name, ':schema.'||n.oid||':/' || n.nspname|| '/' ||
|
||||
case
|
||||
when t.relkind = 'v' then ':view.'
|
||||
when t.relkind = 'm' then ':mview.'
|
||||
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
|
||||
WHEN t.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
@ -228,8 +247,9 @@ FROM (
|
||||
n.nspname AS schema_name,
|
||||
{{ show_node_prefs['rule'] }} AS show_node, NULL AS other_info
|
||||
from pg_rewrite r
|
||||
left join pg_class t on r.ev_class = t.oid
|
||||
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','p','v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -237,8 +257,7 @@ FROM (
|
||||
{% if all_obj or obj_type in ['trigger'] %}
|
||||
select 'trigger'::text AS obj_type, tr.tgname AS obj_name, ':schema.'||n.oid||':/' || n.nspname|| '/' ||
|
||||
case
|
||||
when t.relkind = 'v' then ':view.'
|
||||
when t.relkind = 'm' then ':mview.'
|
||||
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
|
||||
WHEN t.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
@ -257,7 +276,7 @@ FROM (
|
||||
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
|
||||
from pg_trigger tr
|
||||
left join pg_class t on tr.tgrelid = t.oid
|
||||
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'p', 'v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where tr.tgisinternal = false
|
||||
and {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
@ -388,10 +407,9 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['user_mapping'] %}
|
||||
select 'user_mapping' AS obj_type, ro.rolname AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||ro.oid||':/' || ro.rolname AS obj_path, ''::text AS schema_name,
|
||||
select 'user_mapping' AS obj_type, um.usename AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||um.umid||':/' || um.usename AS obj_path, ''::text AS schema_name,
|
||||
{{ show_node_prefs['user_mapping'] }} AS show_node, NULL AS other_info
|
||||
from pg_user_mappings um
|
||||
inner join pg_roles ro on um.umuser = ro.oid
|
||||
inner join pg_foreign_server sr on um.srvid = sr.oid
|
||||
inner join pg_foreign_data_wrapper fdw on sr.srvfdw = fdw.oid
|
||||
{% endif %}
|
||||
@ -404,6 +422,7 @@ FROM (
|
||||
from pg_foreign_table ft
|
||||
inner join pg_class c on ft.ftrelid = c.oid
|
||||
inner join pg_namespace ns on c.relnamespace = ns.oid
|
||||
AND {{ CATALOGS.DB_SUPPORT('ns') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
|
@ -44,7 +44,7 @@ FROM (
|
||||
{% elif obj_type == 'mview' %}
|
||||
WHERE c.relkind = 'm'
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
AND CASE WHEN c.relkind in ('S', 'm') THEN {{ CATALOGS.DB_SUPPORT('n') }} ELSE true END
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -76,14 +76,32 @@ FROM (
|
||||
{% elif obj_type == 'partition' %}
|
||||
AND c.relispartition
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
AND CASE WHEN c.relispartition THEN {{ CATALOGS.DB_SUPPORT('n') }} ELSE true END
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['index'] %}
|
||||
SELECT 'index'::text AS obj_type, cls.relname AS obj_name,
|
||||
':schema.'|| n.oid || ':/' || n.nspname || '/:table.'|| tab.oid ||':/' || tab.relname || '/:index.'|| cls.oid ||':/' || cls.relname AS obj_path, n.nspname AS schema_name,
|
||||
SELECT 'index'::text AS obj_type, cls.relname AS obj_name, ':schema.'|| n.oid || ':/' || n.nspname || '/' ||
|
||||
case
|
||||
when tab.relkind = 'm' then ':mview.' || tab.oid || ':' || '/' || tab.relname
|
||||
WHEN tab.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
select tab.oid as oid, 0 as height,
|
||||
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,
|
||||
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
|
||||
)
|
||||
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
|
||||
FROM pg_index idx
|
||||
JOIN pg_class cls ON cls.oid=indexrelid
|
||||
@ -94,6 +112,7 @@ FROM (
|
||||
LEFT OUTER JOIN pg_description des ON des.objoid=cls.oid
|
||||
LEFT OUTER JOIN pg_description desp ON (desp.objoid=con.oid AND desp.objsubid = 0)
|
||||
WHERE contype IS NULL
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -192,7 +211,7 @@ FROM (
|
||||
) ||
|
||||
CASE
|
||||
WHEN c.contype = 'c' THEN '/:check_constraint.' ||c.oid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.conindid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.oid
|
||||
WHEN c.contype = 'p' THEN '/:primary_key.' ||c.conindid
|
||||
WHEN c.contype = 'u' THEN '/:unique_constraint.' ||c.conindid
|
||||
WHEN c.contype = 'x' THEN '/:exclusion_constraint.' ||c.conindid
|
||||
@ -216,6 +235,7 @@ FROM (
|
||||
{% else %}
|
||||
AND c.contype IN ('c', 'f', 'p', 'u', 'x')
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -223,8 +243,7 @@ FROM (
|
||||
{% if all_obj or obj_type in ['rule'] %}
|
||||
select 'rule'::text AS obj_type, r.rulename AS obj_name, ':schema.'||n.oid||':/' || n.nspname|| '/' ||
|
||||
case
|
||||
when t.relkind = 'v' then ':view.'
|
||||
when t.relkind = 'm' then ':mview.'
|
||||
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
|
||||
WHEN t.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
@ -245,8 +264,9 @@ FROM (
|
||||
n.nspname AS schema_name,
|
||||
{{ show_node_prefs['rule'] }} AS show_node, NULL AS other_info
|
||||
from pg_rewrite r
|
||||
left join pg_class t on r.ev_class = t.oid
|
||||
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','p','v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -254,8 +274,7 @@ FROM (
|
||||
{% if all_obj or obj_type in ['trigger'] %}
|
||||
select 'trigger'::text AS obj_type, tr.tgname AS obj_name, ':schema.'||n.oid||':/' || n.nspname|| '/' ||
|
||||
case
|
||||
when t.relkind = 'v' then ':view.'
|
||||
when t.relkind = 'm' then ':mview.'
|
||||
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
|
||||
WHEN t.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
@ -274,7 +293,7 @@ FROM (
|
||||
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
|
||||
from pg_trigger tr
|
||||
left join pg_class t on tr.tgrelid = t.oid
|
||||
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'p', 'v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where tr.tgisinternal = false
|
||||
and {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
@ -405,10 +424,9 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['user_mapping'] %}
|
||||
select 'user_mapping' AS obj_type, ro.rolname AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||ro.oid||':/' || ro.rolname AS obj_path, ''::text AS schema_name,
|
||||
select 'user_mapping' AS obj_type, um.usename AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||um.umid||':/' || um.usename AS obj_path, ''::text AS schema_name,
|
||||
{{ show_node_prefs['user_mapping'] }} AS show_node, NULL AS other_info
|
||||
from pg_user_mappings um
|
||||
inner join pg_roles ro on um.umuser = ro.oid
|
||||
inner join pg_foreign_server sr on um.srvid = sr.oid
|
||||
inner join pg_foreign_data_wrapper fdw on sr.srvfdw = fdw.oid
|
||||
{% endif %}
|
||||
@ -421,6 +439,7 @@ FROM (
|
||||
from pg_foreign_table ft
|
||||
inner join pg_class c on ft.ftrelid = c.oid
|
||||
inner join pg_namespace ns on c.relnamespace = ns.oid
|
||||
AND {{ CATALOGS.DB_SUPPORT('ns') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
|
@ -44,13 +44,12 @@ FROM (
|
||||
WHERE c.relkind = 'r'
|
||||
{% elif obj_type == 'sequence' %}
|
||||
WHERE c.relkind = 'S'
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% elif obj_type == 'view' %}
|
||||
WHERE c.relkind = 'v'
|
||||
{% elif obj_type == 'mview' %}
|
||||
WHERE c.relkind = 'm'
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
AND CASE WHEN c.relkind in ('S', 'm') THEN {{ CATALOGS.DB_SUPPORT('n') }} ELSE true END
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -68,6 +67,7 @@ FROM (
|
||||
LEFT OUTER JOIN pg_description des ON des.objoid=cls.oid
|
||||
LEFT OUTER JOIN pg_description desp ON (desp.objoid=con.oid AND desp.objsubid = 0)
|
||||
WHERE contype IS NULL
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -134,7 +134,7 @@ FROM (
|
||||
':schema.'||n.oid||':/' || n.nspname||'/:table.'|| t.oid || ':/'||t.relname||
|
||||
CASE
|
||||
WHEN c.contype = 'c' THEN '/:check_constraint.' ||c.oid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.conindid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.oid
|
||||
WHEN c.contype = 'p' THEN '/:primary_key.' ||c.conindid
|
||||
WHEN c.contype = 'u' THEN '/:unique_constraint.' ||c.conindid
|
||||
WHEN c.contype = 'x' THEN '/:exclusion_constraint.' ||c.conindid
|
||||
@ -158,6 +158,7 @@ FROM (
|
||||
{% else %}
|
||||
AND c.contype IN ('c', 'f', 'p', 'u', 'x')
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -167,14 +168,14 @@ FROM (
|
||||
case
|
||||
WHEN t.relkind = 'r' THEN '/:table.'
|
||||
when t.relkind = 'v' then '/:view.'
|
||||
when t.relkind = 'm' then '/:mview.'
|
||||
else 'should not happen'
|
||||
end || t.oid || ':/' || t.relname ||'/:rule.'||r.oid||':/'|| r.rulename AS obj_path,
|
||||
n.nspname AS schema_name,
|
||||
{{ show_node_prefs['rule'] }} AS show_node, NULL AS other_info
|
||||
from pg_rewrite r
|
||||
left join pg_class t on r.ev_class = t.oid
|
||||
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -184,12 +185,11 @@ FROM (
|
||||
case
|
||||
WHEN t.relkind = 'r' THEN '/:table.'
|
||||
when t.relkind = 'v' then '/:view.'
|
||||
when t.relkind = 'm' then '/:mview.'
|
||||
else 'should not happen'
|
||||
end || t.oid || ':/' || t.relname || '/:trigger.'|| tr.oid || ':/' || tr.tgname AS obj_path, n.nspname AS schema_name,
|
||||
{{ show_node_prefs['trigger'] }} AS show_node, NULL AS other_info
|
||||
from pg_trigger tr
|
||||
left join pg_class t on tr.tgrelid = t.oid
|
||||
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where tr.tgisinternal = false
|
||||
and {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
@ -320,10 +320,9 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['user_mapping'] %}
|
||||
select 'user_mapping'::text AS obj_type, ro.rolname AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||ro.oid||':/' || ro.rolname AS obj_path, ''::text AS schema_name,
|
||||
select 'user_mapping'::text AS obj_type, um.usename AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||um.umid||':/' || um.usename AS obj_path, ''::text AS schema_name,
|
||||
{{ show_node_prefs['user_mapping'] }} AS show_node, NULL AS other_info
|
||||
from pg_user_mappings um
|
||||
inner join pg_roles ro on um.umuser = ro.oid
|
||||
inner join pg_foreign_server sr on um.srvid = sr.oid
|
||||
inner join pg_foreign_data_wrapper fdw on sr.srvfdw = fdw.oid
|
||||
{% endif %}
|
||||
@ -336,6 +335,7 @@ FROM (
|
||||
from pg_foreign_table ft
|
||||
inner join pg_class c on ft.ftrelid = c.oid
|
||||
inner join pg_namespace ns on c.relnamespace = ns.oid
|
||||
AND {{ CATALOGS.DB_SUPPORT('ns') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
|
@ -44,7 +44,7 @@ FROM (
|
||||
{% elif obj_type == 'mview' %}
|
||||
WHERE c.relkind = 'm'
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
AND CASE WHEN c.relkind in ('S', 'm') THEN {{ CATALOGS.DB_SUPPORT('n') }} ELSE true END
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -76,14 +76,32 @@ FROM (
|
||||
{% elif obj_type == 'partition' %}
|
||||
AND c.relispartition
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
AND CASE WHEN c.relispartition THEN {{ CATALOGS.DB_SUPPORT('n') }} ELSE true END
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['index'] %}
|
||||
SELECT 'index'::text AS obj_type, cls.relname AS obj_name,
|
||||
':schema.'|| n.oid || ':/' || n.nspname || '/:table.'|| tab.oid ||':/' || tab.relname || '/:index.'|| cls.oid ||':/' || cls.relname AS obj_path, n.nspname AS schema_name,
|
||||
SELECT 'index'::text AS obj_type, cls.relname AS obj_name, ':schema.'|| n.oid || ':/' || n.nspname || '/' ||
|
||||
case
|
||||
when tab.relkind = 'm' then ':mview.' || tab.oid || ':' || '/' || tab.relname
|
||||
WHEN tab.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
select tab.oid as oid, 0 as height,
|
||||
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,
|
||||
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
|
||||
)
|
||||
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
|
||||
FROM pg_index idx
|
||||
JOIN pg_class cls ON cls.oid=indexrelid
|
||||
@ -94,6 +112,7 @@ FROM (
|
||||
LEFT OUTER JOIN pg_description des ON des.objoid=cls.oid
|
||||
LEFT OUTER JOIN pg_description desp ON (desp.objoid=con.oid AND desp.objsubid = 0)
|
||||
WHERE contype IS NULL
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -214,7 +233,7 @@ FROM (
|
||||
) ||
|
||||
CASE
|
||||
WHEN c.contype = 'c' THEN '/:check_constraint.' ||c.oid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.conindid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.oid
|
||||
WHEN c.contype = 'p' THEN '/:primary_key.' ||c.conindid
|
||||
WHEN c.contype = 'u' THEN '/:unique_constraint.' ||c.conindid
|
||||
WHEN c.contype = 'x' THEN '/:exclusion_constraint.' ||c.conindid
|
||||
@ -238,6 +257,7 @@ FROM (
|
||||
{% else %}
|
||||
AND c.contype IN ('c', 'f', 'p', 'u', 'x')
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -245,8 +265,7 @@ FROM (
|
||||
{% if all_obj or obj_type in ['rule'] %}
|
||||
select 'rule'::text AS obj_type, r.rulename AS obj_name, ':schema.'||n.oid||':/' || n.nspname|| '/' ||
|
||||
case
|
||||
when t.relkind = 'v' then ':view.'
|
||||
when t.relkind = 'm' then ':mview.'
|
||||
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
|
||||
WHEN t.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
@ -267,23 +286,37 @@ FROM (
|
||||
n.nspname AS schema_name,
|
||||
{{ show_node_prefs['rule'] }} AS show_node, NULL AS other_info
|
||||
from pg_rewrite r
|
||||
left join pg_class t on r.ev_class = t.oid
|
||||
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','p','v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['trigger'] %}
|
||||
select 'trigger'::text AS obj_type, tr.tgname AS obj_name, ':schema.'||n.oid||':/' || n.nspname||
|
||||
case
|
||||
WHEN t.relkind = 'r' THEN '/:table.'
|
||||
when t.relkind = 'v' then '/:view.'
|
||||
when t.relkind = 'm' then '/:mview.'
|
||||
else 'should not happen'
|
||||
end || t.oid || ':/' || t.relname || '/:trigger.'|| tr.oid || ':/' || tr.tgname AS obj_path, n.nspname AS schema_name,
|
||||
{{ show_node_prefs['trigger'] }} AS show_node, NULL AS other_info
|
||||
from pg_trigger tr
|
||||
left join pg_class t on tr.tgrelid = t.oid
|
||||
select 'trigger'::text AS obj_type, tr.tgname AS obj_name, ':schema.'||n.oid||':/' || n.nspname|| '/' ||
|
||||
case
|
||||
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
|
||||
when t.relkind = 'm' then ':mview.' || t.oid || ':' || '/' || t.relname
|
||||
WHEN t.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
select t.oid as oid, 0 as height,
|
||||
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,
|
||||
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
|
||||
)
|
||||
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
|
||||
from pg_trigger tr
|
||||
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'p', 'v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where tr.tgisinternal = false
|
||||
and {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
@ -303,6 +336,7 @@ FROM (
|
||||
{% if not show_system_objects %}
|
||||
AND ct.oid is NULL
|
||||
{% endif %}
|
||||
AND n.nspparent = 0
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
@ -377,6 +411,7 @@ FROM (
|
||||
from pg_type t
|
||||
inner join pg_namespace n on t.typnamespace = n.oid
|
||||
where t.typtype = 'd'
|
||||
AND n.nspparent = 0
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
@ -391,6 +426,7 @@ FROM (
|
||||
ON t.oid=contypid JOIN pg_namespace n
|
||||
ON n.oid=t.typnamespace
|
||||
WHERE t.typtype = 'd'
|
||||
AND n.nspparent = 0
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
@ -414,10 +450,9 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['user_mapping'] %}
|
||||
select 'user_mapping' AS obj_type, ro.rolname AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||ro.oid||':/' || ro.rolname AS obj_path, ''::text AS schema_name,
|
||||
select 'user_mapping' AS obj_type, um.usename AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||um.umid||':/' || um.usename AS obj_path, ''::text AS schema_name,
|
||||
{{ show_node_prefs['user_mapping'] }} AS show_node, NULL AS other_info
|
||||
from pg_user_mappings um
|
||||
inner join pg_roles ro on um.umuser = ro.oid
|
||||
inner join pg_foreign_server sr on um.srvid = sr.oid
|
||||
inner join pg_foreign_data_wrapper fdw on sr.srvfdw = fdw.oid
|
||||
{% endif %}
|
||||
@ -430,6 +465,7 @@ FROM (
|
||||
from pg_foreign_table ft
|
||||
inner join pg_class c on ft.ftrelid = c.oid
|
||||
inner join pg_namespace ns on c.relnamespace = ns.oid
|
||||
AND {{ CATALOGS.DB_SUPPORT('ns') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
|
@ -44,7 +44,7 @@ FROM (
|
||||
{% elif obj_type == 'mview' %}
|
||||
WHERE c.relkind = 'm'
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
AND CASE WHEN c.relkind in ('S', 'm') THEN {{ CATALOGS.DB_SUPPORT('n') }} ELSE true END
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -76,14 +76,32 @@ FROM (
|
||||
{% elif obj_type == 'partition' %}
|
||||
AND c.relispartition
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
AND CASE WHEN c.relispartition THEN {{ CATALOGS.DB_SUPPORT('n') }} ELSE true END
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['index'] %}
|
||||
SELECT 'index'::text AS obj_type, cls.relname AS obj_name,
|
||||
':schema.'|| n.oid || ':/' || n.nspname || '/:table.'|| tab.oid ||':/' || tab.relname || '/:index.'|| cls.oid ||':/' || cls.relname AS obj_path, n.nspname AS schema_name,
|
||||
SELECT 'index'::text AS obj_type, cls.relname AS obj_name, ':schema.'|| n.oid || ':/' || n.nspname || '/' ||
|
||||
case
|
||||
when tab.relkind = 'm' then ':mview.' || tab.oid || ':' || '/' || tab.relname
|
||||
WHEN tab.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
select tab.oid as oid, 0 as height,
|
||||
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,
|
||||
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
|
||||
)
|
||||
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
|
||||
FROM pg_index idx
|
||||
JOIN pg_class cls ON cls.oid=indexrelid
|
||||
@ -94,6 +112,7 @@ FROM (
|
||||
LEFT OUTER JOIN pg_description des ON des.objoid=cls.oid
|
||||
LEFT OUTER JOIN pg_description desp ON (desp.objoid=con.oid AND desp.objsubid = 0)
|
||||
WHERE contype IS NULL
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -214,7 +233,7 @@ FROM (
|
||||
) ||
|
||||
CASE
|
||||
WHEN c.contype = 'c' THEN '/:check_constraint.' ||c.oid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.conindid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.oid
|
||||
WHEN c.contype = 'p' THEN '/:primary_key.' ||c.conindid
|
||||
WHEN c.contype = 'u' THEN '/:unique_constraint.' ||c.conindid
|
||||
WHEN c.contype = 'x' THEN '/:exclusion_constraint.' ||c.conindid
|
||||
@ -238,6 +257,7 @@ FROM (
|
||||
{% else %}
|
||||
AND c.contype IN ('c', 'f', 'p', 'u', 'x')
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -245,8 +265,7 @@ FROM (
|
||||
{% if all_obj or obj_type in ['rule'] %}
|
||||
select 'rule'::text AS obj_type, r.rulename AS obj_name, ':schema.'||n.oid||':/' || n.nspname|| '/' ||
|
||||
case
|
||||
when t.relkind = 'v' then ':view.'
|
||||
when t.relkind = 'm' then ':mview.'
|
||||
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
|
||||
WHEN t.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
@ -267,8 +286,9 @@ FROM (
|
||||
n.nspname AS schema_name,
|
||||
{{ show_node_prefs['rule'] }} AS show_node, NULL AS other_info
|
||||
from pg_rewrite r
|
||||
left join pg_class t on r.ev_class = t.oid
|
||||
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','p','v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -278,8 +298,7 @@ FROM (
|
||||
CASE WHEN tr.tgpackageoid != 0 THEN 'compound_trigger' ELSE 'trigger' END::text AS obj_type, tr.tgname AS obj_name,
|
||||
':schema.'||n.oid||':/' || n.nspname|| '/' ||
|
||||
case
|
||||
when t.relkind = 'v' then ':view.'
|
||||
when t.relkind = 'm' then ':mview.'
|
||||
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
|
||||
WHEN t.relkind in ('r', 'p') THEN
|
||||
(
|
||||
WITH RECURSIVE table_path_data as (
|
||||
@ -299,7 +318,7 @@ FROM (
|
||||
CASE WHEN tr.tgpackageoid != 0 THEN {{ show_node_prefs['compound_trigger'] }} ELSE {{ show_node_prefs['trigger'] }} END AS show_node,
|
||||
NULL AS other_info
|
||||
from pg_trigger tr
|
||||
left join pg_class t on tr.tgrelid = t.oid
|
||||
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'p', 'v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where tr.tgisinternal = false
|
||||
and {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
@ -324,6 +343,7 @@ FROM (
|
||||
{% if not show_system_objects %}
|
||||
AND ct.oid is NULL
|
||||
{% endif %}
|
||||
AND n.nspparent = 0
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
@ -363,7 +383,7 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['fts_dictionary'] %}
|
||||
SELECT 'fts_dictionary'::text AS obj_type, dict.dictname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_dictionary.'||dict.oid||':/' || dict.dictname AS obj_path, ns.nspname AS schema_name,
|
||||
SELECT 'fts_dictionary' AS obj_type, dict.dictname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_dictionary.'||dict.oid||':/' || dict.dictname AS obj_path, ns.nspname AS schema_name,
|
||||
{{ show_node_prefs['fts_dictionary'] }} AS show_node, NULL AS other_info
|
||||
FROM pg_ts_dict dict
|
||||
left join pg_namespace ns on dict.dictnamespace = ns.oid
|
||||
@ -373,7 +393,7 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['fts_parser'] %}
|
||||
SELECT 'fts_parser'::text AS obj_type, prs.prsname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_parser.'||prs.oid||':/' || prs.prsname AS obj_path, ns.nspname AS schema_name,
|
||||
SELECT 'fts_parser' AS obj_type, prs.prsname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_parser.'||prs.oid||':/' || prs.prsname AS obj_path, ns.nspname AS schema_name,
|
||||
{{ show_node_prefs['fts_parser'] }} AS show_node, NULL AS other_info
|
||||
FROM pg_ts_parser prs
|
||||
left join pg_namespace ns on prs.prsnamespace = ns.oid
|
||||
@ -383,7 +403,7 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['fts_template'] %}
|
||||
SELECT 'fts_template'::text AS obj_type, tmpl.tmplname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_template.'||tmpl.oid||':/' || tmpl.tmplname AS obj_path, ns.nspname AS schema_name,
|
||||
SELECT 'fts_template' AS obj_type, tmpl.tmplname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_template.'||tmpl.oid||':/' || tmpl.tmplname AS obj_path, ns.nspname AS schema_name,
|
||||
{{ show_node_prefs['fts_template'] }} AS show_node, NULL AS other_info
|
||||
FROM pg_ts_template tmpl
|
||||
left join pg_namespace ns on tmpl.tmplnamespace = ns.oid
|
||||
@ -393,18 +413,19 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['domain'] %}
|
||||
select 'domain'::text AS obj_type, t.typname AS obj_name, ':schema.'||n.oid||':/' || n.nspname || '/:domain.'||t.oid||':/' || t.typname AS obj_path, n.nspname AS schema_name,
|
||||
select 'domain' AS obj_type, t.typname AS obj_name, ':schema.'||n.oid||':/' || n.nspname || '/:domain.'||t.oid||':/' || t.typname AS obj_path, n.nspname AS schema_name,
|
||||
{{ show_node_prefs['domain'] }} AS show_node, NULL AS other_info
|
||||
from pg_type t
|
||||
inner join pg_namespace n on t.typnamespace = n.oid
|
||||
where t.typtype = 'd'
|
||||
AND n.nspparent = 0
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['domain_constraints'] %}
|
||||
SELECT 'domain_constraints'::text AS obj_type,
|
||||
SELECT 'domain_constraints' AS obj_type,
|
||||
c.conname AS obj_name, ':schema.'||n.oid||':/' || n.nspname || '/:domain.'||t.oid||':/' || t.typname || '/:domain_constraints.'||c.oid||':/' || c.conname AS obj_path,
|
||||
n.nspname AS schema_name,
|
||||
{{ show_node_prefs['domain_constraints'] }} AS show_node, NULL AS other_info
|
||||
@ -412,13 +433,14 @@ FROM (
|
||||
ON t.oid=contypid JOIN pg_namespace n
|
||||
ON n.oid=t.typnamespace
|
||||
WHERE t.typtype = 'd'
|
||||
AND n.nspparent = 0
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['foreign_data_wrapper'] %}
|
||||
select 'foreign_data_wrapper'::text AS obj_type, fdwname AS obj_name, ':foreign_data_wrapper.'||oid||':/' || fdwname AS obj_path, ''::text AS schema_name,
|
||||
select 'foreign_data_wrapper' AS obj_type, fdwname AS obj_name, ':foreign_data_wrapper.'||oid||':/' || fdwname AS obj_path, ''::text AS schema_name,
|
||||
{{ show_node_prefs['foreign_data_wrapper'] }} AS show_node, NULL AS other_info
|
||||
from pg_foreign_data_wrapper
|
||||
{% endif %}
|
||||
@ -435,10 +457,9 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['user_mapping'] %}
|
||||
select 'user_mapping' AS obj_type, ro.rolname AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||ro.oid||':/' || ro.rolname AS obj_path, ''::text AS schema_name,
|
||||
select 'user_mapping' AS obj_type, um.usename AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||um.umid||':/' || um.usename AS obj_path, ''::text AS schema_name,
|
||||
{{ show_node_prefs['user_mapping'] }} AS show_node, NULL AS other_info
|
||||
from pg_user_mappings um
|
||||
inner join pg_roles ro on um.umuser = ro.oid
|
||||
inner join pg_foreign_server sr on um.srvid = sr.oid
|
||||
inner join pg_foreign_data_wrapper fdw on sr.srvfdw = fdw.oid
|
||||
{% endif %}
|
||||
@ -451,6 +472,7 @@ FROM (
|
||||
from pg_foreign_table ft
|
||||
inner join pg_class c on ft.ftrelid = c.oid
|
||||
inner join pg_namespace ns on c.relnamespace = ns.oid
|
||||
AND {{ CATALOGS.DB_SUPPORT('ns') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
|
@ -20,7 +20,7 @@ FROM (
|
||||
WHEN c.relkind = 'v' THEN 'view'
|
||||
WHEN c.relkind = 'm' THEN 'mview'
|
||||
ELSE 'should not happen'
|
||||
END::text::text AS obj_type, c.relname AS obj_name,
|
||||
END::text AS obj_type, c.relname AS obj_name,
|
||||
':schema.'|| n.oid || ':/' || n.nspname || '/' ||
|
||||
CASE
|
||||
WHEN c.relkind = 'r' THEN ':table.'
|
||||
@ -49,13 +49,13 @@ FROM (
|
||||
{% elif obj_type == 'mview' %}
|
||||
WHERE c.relkind = 'm'
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
AND CASE WHEN c.relkind in ('S', 'm') THEN {{ CATALOGS.DB_SUPPORT('n') }} ELSE true END
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['index'] %}
|
||||
SELECT 'index'::text::text AS obj_type, cls.relname AS obj_name,
|
||||
SELECT 'index'::text AS obj_type, cls.relname AS obj_name,
|
||||
':schema.'|| n.oid || ':/' || n.nspname || '/:table.'|| tab.oid ||':/' || tab.relname || '/:index.'|| cls.oid ||':/' || cls.relname AS obj_path, n.nspname AS schema_name,
|
||||
{{ show_node_prefs['index'] }} AS show_node, NULL AS other_info
|
||||
FROM pg_index idx
|
||||
@ -67,6 +67,7 @@ FROM (
|
||||
LEFT OUTER JOIN pg_description des ON des.objoid=cls.oid
|
||||
LEFT OUTER JOIN pg_description desp ON (desp.objoid=con.oid AND desp.objsubid = 0)
|
||||
WHERE contype IS NULL
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
@ -108,7 +109,7 @@ FROM (
|
||||
WHEN pr.protype = '1'::char THEN
|
||||
CASE WHEN np.oid IS NOT NULL THEN 'edbproc' ELSE 'procedure' END
|
||||
ELSE null
|
||||
END::text::text AS obj_type, pr.proname AS obj_name, pr.oid AS obj_oid, n.oid AS schema_oid, n.nspname AS schema_name, np.oid next_schema_oid, np.nspname next_schema_name,
|
||||
END::text AS obj_type, pr.proname AS obj_name, pr.oid AS obj_oid, n.oid AS schema_oid, n.nspname AS schema_name, np.oid next_schema_oid, np.nspname next_schema_name,
|
||||
pg_catalog.pg_get_function_identity_arguments(pr.oid) AS other_info
|
||||
FROM pg_proc pr left join pg_namespace n
|
||||
ON pr.pronamespace = n.oid left JOIN pg_namespace np
|
||||
@ -126,14 +127,14 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['event_trigger'] %}
|
||||
select 'event_trigger'::text::text AS obj_type, evtname AS obj_name, ':event_trigger.'||oid||':/' || evtname AS obj_path, ''::text AS schema_name,
|
||||
select 'event_trigger'::text AS obj_type, evtname AS obj_name, ':event_trigger.'||oid||':/' || evtname AS obj_path, ''::text AS schema_name,
|
||||
{{ show_node_prefs['index'] }} AS show_node, NULL AS other_info from pg_event_trigger
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['schema'] %}
|
||||
select 'schema'::text::text AS obj_type, n.nspname AS obj_name,
|
||||
select 'schema'::text AS obj_type, n.nspname AS obj_name,
|
||||
':schema.'||n.oid||':/' || n.nspname as obj_path, n.nspname AS schema_name,
|
||||
{{ show_node_prefs['schema'] }} AS show_node, NULL AS other_info from pg_namespace n
|
||||
where n.nspparent = 0
|
||||
@ -143,7 +144,7 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['column'] %}
|
||||
select 'column'::text::text AS obj_type, a.attname AS obj_name,
|
||||
select 'column'::text AS obj_type, a.attname AS obj_name,
|
||||
':schema.'||n.oid||':/' || n.nspname || '/' ||
|
||||
case
|
||||
WHEN t.relkind = 'r' THEN ':table.'
|
||||
@ -167,12 +168,12 @@ FROM (
|
||||
WHEN c.contype = 'p' THEN 'primary_key'
|
||||
WHEN c.contype = 'u' THEN 'unique_constraint'
|
||||
WHEN c.contype = 'x' THEN 'exclusion_constraint'
|
||||
END::text::text AS obj_type,
|
||||
END::text AS obj_type,
|
||||
case when tf.relname is null then c.conname else c.conname || ' -> ' || tf.relname end AS obj_name,
|
||||
':schema.'||n.oid||':/' || n.nspname||'/:table.'|| t.oid || ':/'||t.relname||
|
||||
CASE
|
||||
WHEN c.contype = 'c' THEN '/:check_constraint.' ||c.oid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.conindid
|
||||
WHEN c.contype = 'f' THEN '/:foreign_key.' ||c.oid
|
||||
WHEN c.contype = 'p' THEN '/:primary_key.' ||c.conindid
|
||||
WHEN c.contype = 'u' THEN '/:unique_constraint.' ||c.conindid
|
||||
WHEN c.contype = 'x' THEN '/:exclusion_constraint.' ||c.conindid
|
||||
@ -196,38 +197,38 @@ FROM (
|
||||
{% else %}
|
||||
AND c.contype IN ('c', 'f', 'p', 'u', 'x')
|
||||
{% endif %}
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['rule'] %}
|
||||
select 'rule'::text::text AS obj_type, r.rulename AS obj_name, ':schema.'||n.oid||':/' || n.nspname||
|
||||
select 'rule'::text AS obj_type, r.rulename AS obj_name, ':schema.'||n.oid||':/' || n.nspname||
|
||||
case
|
||||
WHEN t.relkind = 'r' THEN '/:table.'
|
||||
when t.relkind = 'v' then '/:view.'
|
||||
when t.relkind = 'm' then '/:mview.'
|
||||
else 'should not happen'
|
||||
end || t.oid || ':/' || t.relname ||'/:rule.'||r.oid||':/'|| r.rulename AS obj_path,
|
||||
n.nspname AS schema_name,
|
||||
{{ show_node_prefs['rule'] }} AS show_node, NULL AS other_info
|
||||
from pg_rewrite r
|
||||
left join pg_class t on r.ev_class = t.oid
|
||||
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['trigger'] %}
|
||||
select 'trigger'::text::text AS obj_type, tr.tgname AS obj_name, ':schema.'||n.oid||':/' || n.nspname||
|
||||
select 'trigger'::text AS obj_type, tr.tgname AS obj_name, ':schema.'||n.oid||':/' || n.nspname||
|
||||
case
|
||||
WHEN t.relkind = 'r' THEN '/:table.'
|
||||
when t.relkind = 'v' then '/:view.'
|
||||
when t.relkind = 'm' then '/:mview.'
|
||||
else 'should not happen'
|
||||
end || t.oid || ':/' || t.relname || '/:trigger.'|| tr.oid || ':/' || tr.tgname AS obj_path, n.nspname AS schema_name,
|
||||
{{ show_node_prefs['trigger'] }} AS show_node, NULL AS other_info
|
||||
from pg_trigger tr
|
||||
left join pg_class t on tr.tgrelid = t.oid
|
||||
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'v')
|
||||
left join pg_namespace n on t.relnamespace = n.oid
|
||||
where tr.tgisinternal = false
|
||||
and {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
@ -236,7 +237,7 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['type'] %}
|
||||
SELECT 'type'::text::text AS obj_type, t.typname AS obj_name, ':schema.'||n.oid||':/' || n.nspname ||
|
||||
SELECT 'type'::text AS obj_type, t.typname AS obj_name, ':schema.'||n.oid||':/' || n.nspname ||
|
||||
'/:type.'|| t.oid ||':/' || t.typname AS obj_path, n.nspname AS schema_name,
|
||||
{{ show_node_prefs['type'] }} AS show_node, NULL AS other_info
|
||||
FROM pg_type t
|
||||
@ -247,13 +248,14 @@ FROM (
|
||||
{% if not show_system_objects %}
|
||||
AND ct.oid is NULL
|
||||
{% endif %}
|
||||
AND n.nspparent = 0
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['cast'] %}
|
||||
SELECT 'cast'::text::text AS obj_type, format_type(st.oid,NULL) ||'->'|| format_type(tt.oid,tt.typtypmod) AS obj_name,
|
||||
SELECT 'cast'::text AS obj_type, format_type(st.oid,NULL) ||'->'|| format_type(tt.oid,tt.typtypmod) AS obj_name,
|
||||
':cast.'||ca.oid||':/' || format_type(st.oid,NULL) ||'->'|| format_type(tt.oid,tt.typtypmod) AS obj_path, ''::text AS schema_name,
|
||||
{{ show_node_prefs['cast'] }} AS show_node, NULL AS other_info
|
||||
FROM pg_cast ca
|
||||
@ -267,7 +269,7 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['language'] %}
|
||||
SELECT 'language'::text::text AS obj_type, lanname AS obj_name, ':language.'||lan.oid||':/' || lanname AS obj_path, ''::text AS schema_name,
|
||||
SELECT 'language'::text AS obj_type, lanname AS obj_name, ':language.'||lan.oid||':/' || lanname AS obj_path, ''::text AS schema_name,
|
||||
{{ show_node_prefs['language'] }} AS show_node, NULL AS other_info
|
||||
FROM pg_language lan
|
||||
WHERE lanispl IS TRUE
|
||||
@ -276,7 +278,7 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['fts_configuration'] %}
|
||||
SELECT 'fts_configuration'::text::text AS obj_type, cfg.cfgname AS obj_name, ':schema.'||n.oid||':/' || n.nspname || '/:fts_configuration.'||cfg.oid||':/' || cfg.cfgname AS obj_path, n.nspname AS schema_name,
|
||||
SELECT 'fts_configuration'::text AS obj_type, cfg.cfgname AS obj_name, ':schema.'||n.oid||':/' || n.nspname || '/:fts_configuration.'||cfg.oid||':/' || cfg.cfgname AS obj_path, n.nspname AS schema_name,
|
||||
{{ show_node_prefs['fts_configuration'] }} AS show_node, NULL AS other_info
|
||||
FROM pg_ts_config cfg
|
||||
left join pg_namespace n on cfg.cfgnamespace = n.oid
|
||||
@ -286,7 +288,7 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['fts_dictionary'] %}
|
||||
SELECT 'fts_dictionary'::text::text AS obj_type, dict.dictname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_dictionary.'||dict.oid||':/' || dict.dictname AS obj_path, ns.nspname AS schema_name,
|
||||
SELECT 'fts_dictionary'::text AS obj_type, dict.dictname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_dictionary.'||dict.oid||':/' || dict.dictname AS obj_path, ns.nspname AS schema_name,
|
||||
{{ show_node_prefs['fts_dictionary'] }} AS show_node, NULL AS other_info
|
||||
FROM pg_ts_dict dict
|
||||
left join pg_namespace ns on dict.dictnamespace = ns.oid
|
||||
@ -296,7 +298,7 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['fts_parser'] %}
|
||||
SELECT 'fts_parser'::text::text AS obj_type, prs.prsname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_parser.'||prs.oid||':/' || prs.prsname AS obj_path, ns.nspname AS schema_name,
|
||||
SELECT 'fts_parser'::text AS obj_type, prs.prsname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_parser.'||prs.oid||':/' || prs.prsname AS obj_path, ns.nspname AS schema_name,
|
||||
{{ show_node_prefs['fts_parser'] }} AS show_node, NULL AS other_info
|
||||
FROM pg_ts_parser prs
|
||||
left join pg_namespace ns on prs.prsnamespace = ns.oid
|
||||
@ -306,7 +308,7 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['fts_template'] %}
|
||||
SELECT 'fts_template'::text::text AS obj_type, tmpl.tmplname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_template.'||tmpl.oid||':/' || tmpl.tmplname AS obj_path, ns.nspname AS schema_name,
|
||||
SELECT 'fts_template'::text AS obj_type, tmpl.tmplname AS obj_name, ':schema.'||ns.oid||':/' || ns.nspname || '/:fts_template.'||tmpl.oid||':/' || tmpl.tmplname AS obj_path, ns.nspname AS schema_name,
|
||||
{{ show_node_prefs['fts_template'] }} AS show_node, NULL AS other_info
|
||||
FROM pg_ts_template tmpl
|
||||
left join pg_namespace ns on tmpl.tmplnamespace = ns.oid
|
||||
@ -316,18 +318,19 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['domain'] %}
|
||||
select 'domain'::text::text AS obj_type, t.typname AS obj_name, ':schema.'||n.oid||':/' || n.nspname || '/:domain.'||t.oid||':/' || t.typname AS obj_path, n.nspname AS schema_name,
|
||||
select 'domain'::text AS obj_type, t.typname AS obj_name, ':schema.'||n.oid||':/' || n.nspname || '/:domain.'||t.oid||':/' || t.typname AS obj_path, n.nspname AS schema_name,
|
||||
{{ show_node_prefs['domain'] }} AS show_node, NULL AS other_info
|
||||
from pg_type t
|
||||
inner join pg_namespace n on t.typnamespace = n.oid
|
||||
where t.typtype = 'd'
|
||||
AND n.nspparent = 0
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['domain_constraints'] %}
|
||||
SELECT 'domain_constraints'::text::text AS obj_type,
|
||||
SELECT 'domain_constraints'::text AS obj_type,
|
||||
c.conname AS obj_name, ':schema.'||n.oid||':/' || n.nspname || '/:domain.'||t.oid||':/' || t.typname || '/:domain_constraints.'||c.oid||':/' || c.conname AS obj_path,
|
||||
n.nspname AS schema_name,
|
||||
{{ show_node_prefs['domain_constraints'] }} AS show_node, NULL AS other_info
|
||||
@ -335,6 +338,7 @@ FROM (
|
||||
ON t.oid=contypid JOIN pg_namespace n
|
||||
ON n.oid=t.typnamespace
|
||||
WHERE t.typtype = 'd'
|
||||
AND n.nspparent = 0
|
||||
AND {{ CATALOGS.DB_SUPPORT('n') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
@ -358,10 +362,9 @@ FROM (
|
||||
UNION
|
||||
{% endif %}
|
||||
{% if all_obj or obj_type in ['user_mapping'] %}
|
||||
select 'user_mapping'::text AS obj_type, ro.rolname AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||ro.oid||':/' || ro.rolname AS obj_path, ''::text AS schema_name,
|
||||
select 'user_mapping'::text AS obj_type, um.usename AS obj_name, ':foreign_data_wrapper.'||fdw.oid||':/' || fdw.fdwname || '/:foreign_server.'||sr.oid||':/' || sr.srvname || '/:user_mapping.'||um.umid||':/' || um.usename AS obj_path, ''::text AS schema_name,
|
||||
{{ show_node_prefs['user_mapping'] }} AS show_node, NULL AS other_info
|
||||
from pg_user_mappings um
|
||||
inner join pg_roles ro on um.umuser = ro.oid
|
||||
inner join pg_foreign_server sr on um.srvid = sr.oid
|
||||
inner join pg_foreign_data_wrapper fdw on sr.srvfdw = fdw.oid
|
||||
{% endif %}
|
||||
@ -374,6 +377,7 @@ FROM (
|
||||
from pg_foreign_table ft
|
||||
inner join pg_class c on ft.ftrelid = c.oid
|
||||
inner join pg_namespace ns on c.relnamespace = ns.oid
|
||||
AND {{ CATALOGS.DB_SUPPORT('ns') }}
|
||||
{% endif %}
|
||||
{% if all_obj %}
|
||||
UNION
|
||||
|
@ -421,7 +421,7 @@ describe('SearchObjectsDialogWrapper', () => {
|
||||
});
|
||||
|
||||
it('finaliseData', ()=>{
|
||||
spyOn(soDialogWrapper, 'translateSearchObjectsPath').and.returnValue(['disp/path', 'id/path']);
|
||||
spyOn(soDialogWrapper, 'translateSearchObjectsPath').and.returnValue(['disp/path', ['obj1/123', 'obj2/432']]);
|
||||
let data = soDialogWrapper.finaliseData({
|
||||
name: 'objname',
|
||||
type: 'sometype',
|
||||
@ -430,13 +430,13 @@ describe('SearchObjectsDialogWrapper', () => {
|
||||
show_node: true,
|
||||
});
|
||||
expect(data).toEqual({
|
||||
id: 'id/path',
|
||||
id: 'obj1/123.obj2/432',
|
||||
icon: 'icon-sometype',
|
||||
name: 'objname',
|
||||
type: 'sometype',
|
||||
type_label: 'Some types coll',
|
||||
path: 'disp/path',
|
||||
id_path: 'id/path',
|
||||
id_path: ['obj1/123', 'obj2/432'],
|
||||
show_node: true,
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user