mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-12-01 04:49:11 -06:00
Fix an issue where system level catalog are also displayed in PPAS server under relation of create new table like option. Fixes #1530
This commit is contained in:
parent
c336e8a743
commit
9ec05d6bb1
@ -277,7 +277,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
|
||||
self.qtIdent = driver.qtIdent
|
||||
# We need datlastsysoid to check if current table is system table
|
||||
self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
|
||||
|
||||
self.server_type = self.manager.server_type
|
||||
# If DB not connected then return error to browser
|
||||
if not self.conn.connected():
|
||||
return precondition_required(
|
||||
@ -285,10 +285,6 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
|
||||
"Connection to the server has been lost!"
|
||||
)
|
||||
)
|
||||
|
||||
# We need datlastsysoid to check if current index is system index
|
||||
self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
|
||||
|
||||
# we will set template path for sql scripts
|
||||
ver = self.manager.version
|
||||
# Template for Column node
|
||||
@ -1196,7 +1192,9 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
|
||||
res = [{'label': '', 'value': ''}]
|
||||
try:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_oftype.sql']), scid=scid)
|
||||
'get_oftype.sql']), scid=scid,
|
||||
server_type=self.server_type,
|
||||
show_sys_objects=self.blueprint.show_system_objects)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -1225,7 +1223,8 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path, 'get_inherits.sql']),
|
||||
show_system_objects=self.blueprint.show_system_objects,
|
||||
tid=tid)
|
||||
tid=tid,
|
||||
server_type=self.server_type)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -1253,7 +1252,8 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
|
||||
res = [{'label': '', 'value': ''}]
|
||||
try:
|
||||
SQL = render_template("/".join([self.template_path, 'get_relations.sql']),
|
||||
show_sys_objects=self.blueprint.show_system_objects)
|
||||
show_sys_objects=self.blueprint.show_system_objects,
|
||||
server_type=self.server_type)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
@ -1,3 +1,4 @@
|
||||
{% import 'table/sql/macros/db_catalogs.macro' as CATALOG %}
|
||||
SELECT c.oid, c.relname , nspname,
|
||||
CASE WHEN nspname NOT LIKE E'pg\_%' THEN
|
||||
quote_ident(nspname)||'.'||quote_ident(c.relname)
|
||||
@ -8,7 +9,7 @@ JOIN pg_namespace n
|
||||
ON n.oid=c.relnamespace
|
||||
WHERE relkind='r'
|
||||
{% if not show_system_objects %}
|
||||
AND (n.nspname NOT LIKE E'pg\_%' AND n.nspname NOT in ('information_schema'))
|
||||
{{ CATALOG.VALID_CATALOGS(server_type) }}
|
||||
{% endif %}
|
||||
{% if tid %}
|
||||
AND c.oid != tid
|
||||
|
@ -1,6 +1,9 @@
|
||||
{% import 'table/sql/macros/db_catalogs.macro' as CATALOG %}
|
||||
SELECT c.oid,
|
||||
quote_ident(n.nspname)||'.'||quote_ident(c.relname) AS typname
|
||||
FROM pg_namespace n, pg_class c
|
||||
WHERE c.relkind = 'c' AND c.relnamespace=n.oid
|
||||
AND NOT (n.nspname like 'pg_%' OR n.nspname='information_schema')
|
||||
{% if not show_system_objects %}
|
||||
{{ CATALOG.VALID_CATALOGS(server_type) }}
|
||||
{% endif %}
|
||||
ORDER BY typname;
|
@ -1,9 +1,9 @@
|
||||
{% import 'table/sql/macros/db_catalogs.macro' as CATALOG %}
|
||||
SELECT c.oid, quote_ident(n.nspname)||'.'||quote_ident(c.relname) AS like_relation
|
||||
FROM pg_class c, pg_namespace n
|
||||
WHERE c.relnamespace=n.oid
|
||||
AND c.relkind IN ('r', 'v', 'f')
|
||||
{% if not show_sys_objects %}
|
||||
AND n.nspname NOT LIKE E'pg\\_%'
|
||||
AND n.nspname NOT in ('information_schema', 'sys')
|
||||
{{ CATALOG.VALID_CATALOGS(server_type) }}
|
||||
{% endif %}
|
||||
ORDER BY 1;
|
@ -1,3 +1,4 @@
|
||||
{% import 'table/sql/macros/db_catalogs.macro' as CATALOG %}
|
||||
SELECT c.oid, c.relname , nspname,
|
||||
CASE WHEN nspname NOT LIKE E'pg\_%' THEN
|
||||
quote_ident(nspname)||'.'||quote_ident(c.relname)
|
||||
@ -8,7 +9,7 @@ JOIN pg_namespace n
|
||||
ON n.oid=c.relnamespace
|
||||
WHERE relkind='r'
|
||||
{% if not show_system_objects %}
|
||||
AND (n.nspname NOT LIKE E'pg\_%' AND n.nspname NOT in ('information_schema'))
|
||||
{{ CATALOG.VALID_CATALOGS(server_type) }}
|
||||
{% endif %}
|
||||
{% if tid %}
|
||||
AND c.oid != tid
|
||||
|
@ -1,6 +1,9 @@
|
||||
{% import 'table/sql/macros/db_catalogs.macro' as CATALOG %}
|
||||
SELECT c.oid,
|
||||
quote_ident(n.nspname)||'.'||quote_ident(c.relname) AS typname
|
||||
FROM pg_namespace n, pg_class c
|
||||
WHERE c.relkind = 'c' AND c.relnamespace=n.oid
|
||||
AND NOT (n.nspname like 'pg_%' OR n.nspname='information_schema')
|
||||
{% if not show_system_objects %}
|
||||
{{ CATALOG.VALID_CATALOGS(server_type) }}
|
||||
{% endif %}
|
||||
ORDER BY typname;
|
@ -1,9 +1,9 @@
|
||||
{% import 'table/sql/macros/db_catalogs.macro' as CATALOG %}
|
||||
SELECT c.oid, quote_ident(n.nspname)||'.'||quote_ident(c.relname) AS like_relation
|
||||
FROM pg_class c, pg_namespace n
|
||||
WHERE c.relnamespace=n.oid
|
||||
AND c.relkind IN ('r', 'v', 'f')
|
||||
{% if not show_sys_objects %}
|
||||
AND n.nspname NOT LIKE E'pg\\_%'
|
||||
AND n.nspname NOT in ('information_schema', 'sys')
|
||||
{{ CATALOG.VALID_CATALOGS(server_type) }}
|
||||
{% endif %}
|
||||
ORDER BY 1;
|
@ -0,0 +1,5 @@
|
||||
{% macro VALID_CATALOGS(server_type) -%}
|
||||
AND n.nspname NOT LIKE E'pg\_%' {% if server_type == 'ppas' %}
|
||||
AND n.nspname NOT IN ('information_schema', 'pgagent', 'dbo', 'sys') {% else %}
|
||||
AND n.nspname NOT IN ('information_schema') {% endif %}
|
||||
{%- endmacro %}
|
Loading…
Reference in New Issue
Block a user