Fixed following issues for 1257:

1. For synonyms, the property is shown as "Public Synonym".
 2. For system procedure, the flag should be True but it is displaying as False.
 3. For both views and materialized views, the property is "System View".
 4. For FTS templates, the property is showing as "System FTS Parser".

Fixes #1257
This commit is contained in:
Aditya Toshniwal 2020-04-24 16:35:59 +05:30 committed by Akshay Joshi
parent 6de1d3f7de
commit aec64aa582
8 changed files with 19 additions and 12 deletions

View File

@ -98,7 +98,7 @@ define('pgadmin.node.fts_template', [
control: 'node-list-by-id', cache_node: 'database',
cache_level: 'database',
},{
id: 'is_sys_obj', label: gettext('System FTS parser?'),
id: 'is_sys_obj', label: gettext('System FTS template?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',

View File

@ -1365,6 +1365,11 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
if fnid <= self.manager.db_info[did]['datlastsysoid']:
resp_data['sysfunc'] = True
# Set System Functions Status
resp_data['sysproc'] = False
if fnid <= self.manager.db_info[did]['datlastsysoid']:
resp_data['sysproc'] = True
# Get formatted Security Labels
if 'seclabels' in resp_data:
resp_data.update(parse_sec_labels_from_db(resp_data['seclabels']))

View File

@ -208,6 +208,11 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
)
)
self.datlastsysoid = \
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
if self.manager.db_info is not None and \
kwargs['did'] in self.manager.db_info else 0
# we will set template path for sql scripts
self.template_path = 'synonyms/sql/#{0}#'.format(
self.manager.version)
@ -420,6 +425,8 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
gettext('The specified synonym could not be found.')
)
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
return True, res['rows'][0]
except Exception as e:
return internal_server_error(errormsg=str(e))

View File

@ -195,10 +195,8 @@ define('pgadmin.node.synonym', [
return false;
},
},{
id: 'is_public_synonym', label: gettext('Public synonym?'),
type: 'switch', mode: ['properties'], cell: 'switch',
options: { onText: gettext('Yes'), offText: gettext('No'), onColor: 'success',
offColor: 'ternary', size: 'mini'},
id: 'is_sys_obj', label: gettext('System synonym?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},
],
validate: function() {

View File

@ -21,8 +21,7 @@ SELECT synname AS name, pg_get_userbyid(synowner) AS owner,
AND nspname = synobjname
AND nspobjecttype = 0),
-- Default s = Synonym
's') AS targettype,
CASE WHEN ns.nspname = 'public' THEN true ELSE false END AS is_public_synonym
's') AS targettype
FROM pg_synonym s JOIN pg_namespace ns ON s.synnamespace = ns.oid
WHERE s.synnamespace={{scid}}::oid
{% if syid %}

View File

@ -21,8 +21,7 @@ SELECT s.oid, synname AS name, pg_get_userbyid(synowner) AS owner,
AND nspname = synobjname
AND nspobjecttype = 0),
-- Default s = Synonym
's') AS targettype,
CASE WHEN ns.nspname = 'public' THEN true ELSE false END AS is_public_synonym
's') AS targettype
FROM pg_synonym s JOIN pg_namespace ns ON s.synnamespace = ns.oid
WHERE s.synnamespace={{scid}}::oid
{% if syid %}

View File

@ -9,8 +9,7 @@ SELECT synname AS name, pg_get_userbyid(synowner) AS owner,
FROM pg_proc p, pg_namespace n
WHERE p.pronamespace = n.oid
AND n.nspname = synobjschema
AND p.proname = synobjname LIMIT 1), 's') AS targettype, -- Default s = Synonym
CASE WHEN ns.nspname = 'public' THEN true ELSE false END AS is_public_synonym
AND p.proname = synobjname LIMIT 1), 's') AS targettype -- Default s = Synonym
FROM pg_synonym s JOIN pg_namespace ns ON s.synnamespace = ns.oid
WHERE s.synnamespace={{scid}}::oid
{% if syid %}

View File

@ -160,7 +160,7 @@ define('pgadmin.node.mview', [
node: 'schema', mode: ['create', 'edit'], cache_node: 'database',
disabled: 'inSchema', select2: { allowClear: false },
},{
id: 'system_view', label: gettext('System view?'), cell: 'string',
id: 'system_view', label: gettext('System materialized view?'), cell: 'string',
type: 'switch', mode: ['properties'],
}, pgBrowser.SecurityGroupSchema, {
id: 'acl', label: gettext('Privileges'),