Fixed an issue where the search object not able to locate pg_toast_* tables in the pg_toast schema. Fixes #5441

This commit is contained in:
Aditya Toshniwal 2020-04-27 19:51:56 +05:30 committed by Akshay Joshi
parent 18748846ef
commit 99d1068f70
9 changed files with 61 additions and 56 deletions

View File

@ -91,3 +91,4 @@ Bug fixes
| `Issue #5430 <https://redmine.postgresql.org/issues/5430>`_ - Added title to the login page.
| `Issue #5432 <https://redmine.postgresql.org/issues/5432>`_ - Fixed an issue where an internal user is not created if the authentication source is set to internal and ldap.
| `Issue #5439 <https://redmine.postgresql.org/issues/5439>`_ - Fixed an issue where the user is not able to create a server if login with an LDAP account.
| `Issue #5441 <https://redmine.postgresql.org/issues/5441>`_ - Fixed an issue where the search object not able to locate pg_toast_* tables in the pg_toast schema.

View File

@ -237,6 +237,10 @@ export class Tree {
findNodeWithToggle(path) {
let tree = this;
if(path == null || !Array.isArray(path)) {
return Promise.reject();
}
path = path.join('.');
let onCorrectPath = function(matchPath) {

View File

@ -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.join('.');
datum.id = datum.id_path ? datum.id_path.join('.') : _.uniqueId(datum.name);
/* Esacpe XSS */
datum.name = _.escape(datum.name);
@ -384,7 +384,7 @@ export default class SearchObjectsDialogWrapper extends DialogWrapper {
*/
translateSearchObjectsPath(path, catalog_level) {
if (path === null) {
return path;
return [null, null];
}
catalog_level = catalog_level || 'N';

View File

@ -70,7 +70,7 @@ FROM (
NULL AS other_info
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind in ('p','r')
WHERE c.relkind in ('p','r','t')
{% if obj_type == 'table' %}
AND NOT c.relispartition
{% elif obj_type == 'partition' %}
@ -85,7 +85,7 @@ FROM (
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
WHEN tab.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select tab.oid as oid, 0 as height,
@ -153,14 +153,14 @@ FROM (
select 'column'::text AS obj_type, a.attname AS obj_name,
':schema.'||n.oid||':/' || n.nspname || '/' ||
case
WHEN t.relkind in ('r', 'p') THEN ':table.'
WHEN t.relkind in ('r', 't', 'p') THEN ':table.'
WHEN t.relkind = 'v' THEN ':view.'
WHEN t.relkind = 'm' THEN ':mview.'
else 'should not happen'
end || t.oid || ':/' || t.relname || '/:column.'|| a.attnum ||':/' || a.attname AS obj_path, n.nspname AS schema_name,
{{ show_node_prefs['column'] }} AS show_node, NULL AS other_info
from pg_attribute a
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r','p','v','m')
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r','t','p','v','m')
left join pg_namespace n on t.relnamespace = n.oid where a.attnum > 0
and not t.relispartition
{% endif %}
@ -227,7 +227,7 @@ FROM (
select 'rule'::text AS obj_type, r.rulename AS obj_name, ':schema.'||n.oid||':/' || n.nspname|| '/' ||
case
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
WHEN t.relkind in ('r', 'p') THEN
WHEN t.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select t.oid as oid, 0 as height,
@ -247,7 +247,7 @@ FROM (
n.nspname AS schema_name,
{{ show_node_prefs['rule'] }} AS show_node, NULL AS other_info
from pg_rewrite r
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','p','v')
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','t','p','v')
left join pg_namespace n on t.relnamespace = n.oid
where {{ CATALOGS.DB_SUPPORT('n') }}
{% endif %}
@ -258,7 +258,7 @@ FROM (
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 in ('r', 'p') THEN
WHEN t.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select t.oid as oid, 0 as height,
@ -276,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
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'p', 'v')
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 't', 'p', 'v')
left join pg_namespace n on t.relnamespace = n.oid
where tr.tgisinternal = false
and {{ CATALOGS.DB_SUPPORT('n') }}

View File

@ -70,7 +70,7 @@ FROM (
NULL AS other_info
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind in ('p','r')
WHERE c.relkind in ('p','r','t')
{% if obj_type == 'table' %}
AND NOT c.relispartition
{% elif obj_type == 'partition' %}
@ -85,7 +85,7 @@ FROM (
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
WHEN tab.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select tab.oid as oid, 0 as height,
@ -170,14 +170,14 @@ FROM (
select 'column'::text AS obj_type, a.attname AS obj_name,
':schema.'||n.oid||':/' || n.nspname || '/' ||
case
WHEN t.relkind in ('r', 'p') THEN ':table.'
WHEN t.relkind in ('r', 't', 'p') THEN ':table.'
WHEN t.relkind = 'v' THEN ':view.'
WHEN t.relkind = 'm' THEN ':mview.'
else 'should not happen'
end || t.oid || ':/' || t.relname || '/:column.'|| a.attnum ||':/' || a.attname AS obj_path, n.nspname AS schema_name,
{{ show_node_prefs['column'] }} AS show_node, NULL AS other_info
from pg_attribute a
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r','p','v','m')
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r','t','p','v','m')
left join pg_namespace n on t.relnamespace = n.oid where a.attnum > 0
and not t.relispartition
{% endif %}
@ -244,7 +244,7 @@ FROM (
select 'rule'::text AS obj_type, r.rulename AS obj_name, ':schema.'||n.oid||':/' || n.nspname|| '/' ||
case
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
WHEN t.relkind in ('r', 'p') THEN
WHEN t.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select t.oid as oid, 0 as height,
@ -264,7 +264,7 @@ FROM (
n.nspname AS schema_name,
{{ show_node_prefs['rule'] }} AS show_node, NULL AS other_info
from pg_rewrite r
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','p','v')
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','t','p','v')
left join pg_namespace n on t.relnamespace = n.oid
where {{ CATALOGS.DB_SUPPORT('n') }}
{% endif %}
@ -275,7 +275,7 @@ FROM (
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 in ('r', 'p') THEN
WHEN t.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select t.oid as oid, 0 as height,
@ -293,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
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'p', 'v')
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 't', 'p', 'v')
left join pg_namespace n on t.relnamespace = n.oid
where tr.tgisinternal = false
and {{ CATALOGS.DB_SUPPORT('n') }}

View File

@ -15,7 +15,7 @@ FROM (
{% if all_obj or obj_type in ['table', 'sequence', 'view', 'mview'] %}
SELECT
CASE
WHEN c.relkind = 'r' THEN 'table'
WHEN c.relkind in ('r', 't') THEN 'table'
WHEN c.relkind = 'S' THEN 'sequence'
WHEN c.relkind = 'v' THEN 'view'
WHEN c.relkind = 'm' THEN 'mview'
@ -23,14 +23,14 @@ FROM (
END::text AS obj_type, c.relname AS obj_name,
':schema.'|| n.oid || ':/' || n.nspname || '/' ||
CASE
WHEN c.relkind = 'r' THEN ':table.'
WHEN c.relkind in ('r', 't') THEN ':table.'
WHEN c.relkind = 'S' THEN ':sequence.'
WHEN c.relkind = 'v' THEN ':view.'
WHEN c.relkind = 'm' THEN ':mview.'
ELSE 'should not happen'
END || c.oid ||':/' || c.relname AS obj_path, n.nspname AS schema_name,
CASE
WHEN c.relkind = 'r' THEN {{ show_node_prefs['table'] }}
WHEN c.relkind in ('r', 't') THEN {{ show_node_prefs['table'] }}
WHEN c.relkind = 'S' THEN {{ show_node_prefs['sequence'] }}
WHEN c.relkind = 'v' THEN {{ show_node_prefs['view'] }}
WHEN c.relkind = 'm' THEN {{ show_node_prefs['mview'] }}
@ -39,9 +39,9 @@ FROM (
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
{% if all_obj %}
WHERE c.relkind in ('r','S','v','m')
WHERE c.relkind in ('r','t','S','v','m')
{% elif obj_type == 'table' %}
WHERE c.relkind = 'r'
WHERE c.relkind in ('r', 't')
{% elif obj_type == 'sequence' %}
WHERE c.relkind = 'S'
{% elif obj_type == 'view' %}
@ -108,14 +108,14 @@ FROM (
select 'column'::text AS obj_type, a.attname AS obj_name,
':schema.'||n.oid||':/' || n.nspname || '/' ||
case
WHEN t.relkind = 'r' THEN ':table.'
WHEN t.relkind in ('r', 't') THEN ':table.'
WHEN t.relkind = 'v' THEN ':view.'
WHEN t.relkind = 'm' THEN ':mview.'
else 'should not happen'
end || t.oid || ':/' || t.relname || '/:column.'|| a.attnum ||':/' || a.attname AS obj_path, n.nspname AS schema_name,
{{ show_node_prefs['column'] }} AS show_node, NULL AS other_info
from pg_attribute a
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r','v','m')
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r', 't','v','m')
left join pg_namespace n on t.relnamespace = n.oid where a.attnum > 0
{% endif %}
{% if all_obj %}
@ -166,14 +166,14 @@ 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 = 'r' THEN '/:table.'
WHEN t.relkind in ('r', 't') THEN '/:table.'
when t.relkind = 'v' then '/:view.'
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
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','v')
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r', 't','v')
left join pg_namespace n on t.relnamespace = n.oid
where {{ CATALOGS.DB_SUPPORT('n') }}
{% endif %}
@ -183,13 +183,13 @@ 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 = 'r' THEN '/:table.'
WHEN t.relkind in ('r', 't') THEN '/:table.'
when t.relkind = 'v' then '/:view.'
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
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'v')
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 't', 'v')
left join pg_namespace n on t.relnamespace = n.oid
where tr.tgisinternal = false
and {{ CATALOGS.DB_SUPPORT('n') }}

View File

@ -70,7 +70,7 @@ FROM (
NULL AS other_info
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind in ('p','r')
WHERE c.relkind in ('p','r','t')
{% if obj_type == 'table' %}
AND NOT c.relispartition
{% elif obj_type == 'partition' %}
@ -85,7 +85,7 @@ FROM (
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
WHEN tab.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select tab.oid as oid, 0 as height,
@ -192,14 +192,14 @@ FROM (
select 'column'::text AS obj_type, a.attname AS obj_name,
':schema.'||n.oid||':/' || n.nspname || '/' ||
case
WHEN t.relkind in ('r', 'p') THEN ':table.'
WHEN t.relkind in ('r', 't', 'p') THEN ':table.'
WHEN t.relkind = 'v' THEN ':view.'
WHEN t.relkind = 'm' THEN ':mview.'
else 'should not happen'
end || t.oid || ':/' || t.relname || '/:column.'|| a.attnum ||':/' || a.attname AS obj_path, n.nspname AS schema_name,
{{ show_node_prefs['column'] }} AS show_node, NULL AS other_info
from pg_attribute a
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r','p','v','m')
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r','t','p','v','m')
left join pg_namespace n on t.relnamespace = n.oid where a.attnum > 0
and not t.relispartition
{% endif %}
@ -266,7 +266,7 @@ FROM (
select 'rule'::text AS obj_type, r.rulename AS obj_name, ':schema.'||n.oid||':/' || n.nspname|| '/' ||
case
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
WHEN t.relkind in ('r', 'p') THEN
WHEN t.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select t.oid as oid, 0 as height,
@ -286,7 +286,7 @@ FROM (
n.nspname AS schema_name,
{{ show_node_prefs['rule'] }} AS show_node, NULL AS other_info
from pg_rewrite r
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','p','v')
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','t','p','v')
left join pg_namespace n on t.relnamespace = n.oid
where {{ CATALOGS.DB_SUPPORT('n') }}
{% endif %}
@ -298,7 +298,7 @@ FROM (
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
WHEN t.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select t.oid as oid, 0 as height,
@ -316,7 +316,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
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'p', 'v')
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 't', 'p', 'v')
left join pg_namespace n on t.relnamespace = n.oid
where tr.tgisinternal = false
and {{ CATALOGS.DB_SUPPORT('n') }}

View File

@ -70,7 +70,7 @@ FROM (
NULL AS other_info
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind in ('p','r')
WHERE c.relkind in ('p','r','t')
{% if obj_type == 'table' %}
AND NOT c.relispartition
{% elif obj_type == 'partition' %}
@ -85,7 +85,7 @@ FROM (
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
WHEN tab.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select tab.oid as oid, 0 as height,
@ -192,14 +192,14 @@ FROM (
select 'column'::text AS obj_type, a.attname AS obj_name,
':schema.'||n.oid||':/' || n.nspname || '/' ||
case
WHEN t.relkind in ('r', 'p') THEN ':table.'
WHEN t.relkind in ('r', 't', 'p') THEN ':table.'
WHEN t.relkind = 'v' THEN ':view.'
WHEN t.relkind = 'm' THEN ':mview.'
else 'should not happen'
end || t.oid || ':/' || t.relname || '/:column.'|| a.attnum ||':/' || a.attname AS obj_path, n.nspname AS schema_name,
{{ show_node_prefs['column'] }} AS show_node, NULL AS other_info
from pg_attribute a
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r','p','v','m')
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r','t','p','v','m')
left join pg_namespace n on t.relnamespace = n.oid where a.attnum > 0
and not t.relispartition
{% endif %}
@ -266,7 +266,7 @@ FROM (
select 'rule'::text AS obj_type, r.rulename AS obj_name, ':schema.'||n.oid||':/' || n.nspname|| '/' ||
case
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
WHEN t.relkind in ('r', 'p') THEN
WHEN t.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select t.oid as oid, 0 as height,
@ -286,7 +286,7 @@ FROM (
n.nspname AS schema_name,
{{ show_node_prefs['rule'] }} AS show_node, NULL AS other_info
from pg_rewrite r
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','p','v')
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','t','p','v')
left join pg_namespace n on t.relnamespace = n.oid
where {{ CATALOGS.DB_SUPPORT('n') }}
{% endif %}
@ -299,7 +299,7 @@ FROM (
':schema.'||n.oid||':/' || n.nspname|| '/' ||
case
when t.relkind = 'v' then ':view.' || t.oid || ':' || '/' || t.relname
WHEN t.relkind in ('r', 'p') THEN
WHEN t.relkind in ('r', 't', 'p') THEN
(
WITH RECURSIVE table_path_data as (
select t.oid as oid, 0 as height,
@ -318,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
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'p', 'v')
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 't', 'p', 'v')
left join pg_namespace n on t.relnamespace = n.oid
where tr.tgisinternal = false
and {{ CATALOGS.DB_SUPPORT('n') }}

View File

@ -15,7 +15,7 @@ FROM (
{% if all_obj or obj_type in ['table', 'sequence', 'view', 'mview'] %}
SELECT
CASE
WHEN c.relkind = 'r' THEN 'table'
WHEN c.relkind in ('r', 't') THEN 'table'
WHEN c.relkind = 'S' THEN 'sequence'
WHEN c.relkind = 'v' THEN 'view'
WHEN c.relkind = 'm' THEN 'mview'
@ -23,14 +23,14 @@ FROM (
END::text AS obj_type, c.relname AS obj_name,
':schema.'|| n.oid || ':/' || n.nspname || '/' ||
CASE
WHEN c.relkind = 'r' THEN ':table.'
WHEN c.relkind in ('r', 't') THEN ':table.'
WHEN c.relkind = 'S' THEN ':sequence.'
WHEN c.relkind = 'v' THEN ':view.'
WHEN c.relkind = 'm' THEN ':mview.'
ELSE 'should not happen'
END || c.oid ||':/' || c.relname AS obj_path, n.nspname AS schema_name,
CASE
WHEN c.relkind = 'r' THEN {{ show_node_prefs['table'] }}
WHEN c.relkind in ('r', 't') THEN {{ show_node_prefs['table'] }}
WHEN c.relkind = 'S' THEN {{ show_node_prefs['sequence'] }}
WHEN c.relkind = 'v' THEN {{ show_node_prefs['view'] }}
WHEN c.relkind = 'm' THEN {{ show_node_prefs['mview'] }}
@ -39,9 +39,9 @@ FROM (
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
{% if all_obj %}
WHERE c.relkind in ('r','S','v','m')
WHERE c.relkind in ('r','t','S','v','m')
{% elif obj_type == 'table' %}
WHERE c.relkind = 'r'
WHERE c.relkind in ('r', 't')
{% elif obj_type == 'sequence' %}
WHERE c.relkind = 'S'
{% elif obj_type == 'view' %}
@ -147,14 +147,14 @@ FROM (
select 'column'::text AS obj_type, a.attname AS obj_name,
':schema.'||n.oid||':/' || n.nspname || '/' ||
case
WHEN t.relkind = 'r' THEN ':table.'
WHEN t.relkind in ('r', 't') THEN ':table.'
WHEN t.relkind = 'v' THEN ':view.'
WHEN t.relkind = 'm' THEN ':mview.'
else 'should not happen'
end || t.oid || ':/' || t.relname || '/:column.'|| a.attnum ||':/' || a.attname AS obj_path, n.nspname AS schema_name,
{{ show_node_prefs['column'] }} AS show_node, NULL AS other_info
from pg_attribute a
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r','v','m')
inner join pg_class t on a.attrelid = t.oid and t.relkind in ('r', 't','v','m')
left join pg_namespace n on t.relnamespace = n.oid where a.attnum > 0
{% endif %}
{% if all_obj %}
@ -205,14 +205,14 @@ 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 = 'r' THEN '/:table.'
WHEN t.relkind in ('r', 't') THEN '/:table.'
when t.relkind = 'v' then '/:view.'
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
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r','v')
inner join pg_class t on r.ev_class = t.oid and t.relkind in ('r', 't','v')
left join pg_namespace n on t.relnamespace = n.oid
where {{ CATALOGS.DB_SUPPORT('n') }}
{% endif %}
@ -222,13 +222,13 @@ 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 = 'r' THEN '/:table.'
WHEN t.relkind in ('r', 't') THEN '/:table.'
when t.relkind = 'v' then '/:view.'
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
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 'v')
inner join pg_class t on tr.tgrelid = t.oid and t.relkind in ('r', 't', 'v')
left join pg_namespace n on t.relnamespace = n.oid
where tr.tgisinternal = false
and {{ CATALOGS.DB_SUPPORT('n') }}