Ensure all object types have a System XXX? property. Fixes #1257

This commit is contained in:
Aditya Toshniwal 2020-04-23 17:31:40 +05:30 committed by Akshay Joshi
parent 2b5c90e379
commit dfb74904ed
64 changed files with 281 additions and 35 deletions

View File

@ -27,6 +27,7 @@ Housekeeping
Bug fixes
*********
| `Issue #1257 <https://redmine.postgresql.org/issues/1257>`_ - Ensure all object types have a "System XXX?" property.
| `Issue #2813 <https://redmine.postgresql.org/issues/2813>`_ - Ensure that the password prompt should not be visible if the database server is in trust authentication mode.
| `Issue #3269 <https://redmine.postgresql.org/issues/3269>`_ - Fixed an issue where slider jumps up when new rows get loaded while scrolling down in the DataView panel in the query tool.
| `Issue #3495 <https://redmine.postgresql.org/issues/3495>`_ - Fixed an issue where the query tool unable to load the file which contains the BOM marker.

View File

@ -177,6 +177,7 @@ class DatabaseView(PGChildNodeView):
if self.manager is None:
return gone(errormsg=_("Could not find the server."))
self.datlastsysoid = 0
if action and action in ["drop"]:
self.conn = self.manager.connection()
elif 'did' in kwargs:
@ -186,6 +187,7 @@ class DatabaseView(PGChildNodeView):
# provide generic connection
if kwargs['did'] in self.manager.db_info:
self._db = self.manager.db_info[kwargs['did']]
self.datlastsysoid = self._db['datlastsysoid']
if self._db['datallowconn'] is False:
self.conn = self.manager.connection()
self.db_allow_connection = False
@ -414,6 +416,8 @@ class DatabaseView(PGChildNodeView):
res = self.formatdbacl(res, defaclres['rows'])
result = res['rows'][0]
result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid)
# Fetching variable for database
SQL = render_template(
"/".join([self.template_path, 'get_variables.sql']),

View File

@ -195,6 +195,11 @@ class EventTriggerView(PGChildNodeView):
self.conn = self.manager.connection(did=kwargs['did'])
self.template_path = 'event_triggers/sql/9.3_plus'
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
return f(*args, **kwargs)
return wrap
@ -219,6 +224,7 @@ class EventTriggerView(PGChildNodeView):
if not status:
return internal_server_error(errormsg=res)
return ajax_response(
response=res['rows'],
status=200
@ -337,6 +343,7 @@ class EventTriggerView(PGChildNodeView):
)
result = res['rows'][0]
result['is_sys_obj'] = (result['oid'] <= self.datlastsysoid)
result = self._formatter(result)
return ajax_response(

View File

@ -71,6 +71,7 @@ define('pgadmin.node.event_trigger', [
oid: undefined,
name: undefined,
eventowner: undefined,
is_sys_obj: undefined,
comment: undefined,
enabled: 'O',
eventfuncoid: undefined,
@ -105,6 +106,10 @@ define('pgadmin.node.event_trigger', [
id: 'eventowner', label: gettext('Owner'), cell: 'string',
type: 'text', mode: ['properties', 'edit','create'], node: 'role',
control: Backform.NodeListByNameControl,
},{
id: 'is_sys_obj', label: gettext('System event trigger?'),
cell:'boolean', type: 'switch',
mode: ['properties'],
},{
id: 'comment', label: gettext('Comment'), type: 'multiline',
},{

View File

@ -154,6 +154,11 @@ class ExtensionView(PGChildNodeView):
self.conn = self.manager.connection(did=kwargs['did'])
self.template_path = 'extensions/sql'
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
return f(*args, **kwargs)
return wrap
@ -238,6 +243,8 @@ class ExtensionView(PGChildNodeView):
gettext("Could not find the extension information.")
)
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['eid'] <= self.datlastsysoid)
return ajax_response(
response=res['rows'][0],
status=200

View File

@ -228,8 +228,10 @@ define('pgadmin.node.extension', [
});
return res;
},
},
{
},{
id: 'is_sys_obj', label: gettext('System extension?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'comment', label: gettext('Comment'), cell: 'string',
type: 'multiline', readonly: true,
},

View File

@ -217,6 +217,10 @@ class ForeignDataWrapperView(PGChildNodeView):
)
self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent
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
# Set the template path for the SQL scripts
self.template_path = 'foreign_data_wrappers/sql/#{0}#'.format(
@ -347,6 +351,9 @@ class ForeignDataWrapperView(PGChildNodeView):
" wrapper information.")
)
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['fdwoid'] <= self.datlastsysoid)
if res['rows'][0]['fdwoptions'] is not None:
res['rows'][0]['fdwoptions'] = tokenize_options(
res['rows'][0]['fdwoptions'],

View File

@ -206,6 +206,11 @@ class ForeignServerView(PGChildNodeView):
kwargs['sid']
)
self.conn = self.manager.connection(did=kwargs['did'])
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
# Set the template path for the SQL scripts
self.template_path = "foreign_servers/sql/#{0}#".format(
self.manager.version
@ -338,6 +343,9 @@ class ForeignServerView(PGChildNodeView):
gettext("Could not find the foreign server information.")
)
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['fsrvid'] <= self.datlastsysoid)
if res['rows'][0]['fsrvoptions'] is not None:
res['rows'][0]['fsrvoptions'] = tokenize_options(
res['rows'][0]['fsrvoptions'], 'fsrvoption', 'fsrvvalue'

View File

@ -109,6 +109,7 @@ define('pgadmin.node.foreign_server', [
fsrvvalue: undefined,
fsrvoptions: [],
fsrvowner: undefined,
is_sys_obj: undefined,
description: undefined,
fsrvacl: [],
},
@ -148,6 +149,9 @@ define('pgadmin.node.foreign_server', [
},{
id: 'fsrvversion', label: gettext('Version'), cell: 'string',
group: gettext('Definition'), type: 'text',
},{
id: 'is_sys_obj', label: gettext('System foreign server?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline',

View File

@ -223,6 +223,10 @@ class UserMappingView(PGChildNodeView):
kwargs['sid']
)
self.conn = self.manager.connection(did=kwargs['did'])
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
# Set the template path for the SQL scripts
self.template_path = 'user_mappings/sql/#{0}#'.format(
@ -360,6 +364,9 @@ class UserMappingView(PGChildNodeView):
gettext("Could not find the user mapping information.")
)
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['um_oid'] <= self.datlastsysoid)
if res['rows'][0]['umoptions'] is not None:
res['rows'][0]['umoptions'] = tokenize_options(
res['rows'][0]['umoptions'],

View File

@ -108,6 +108,7 @@ define('pgadmin.node.user_mapping', [
idAttribute: 'um_oid',
defaults: {
name: undefined,
is_sys_obj: undefined,
um_options: [],
},
@ -147,6 +148,9 @@ define('pgadmin.node.user_mapping', [
},{
id: 'um_oid', label: gettext('OID'), cell: 'string',
type: 'text', mode: ['properties'],
}, {
id: 'is_sys_obj', label: gettext('System user mapping?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'umoptions', label: gettext('Options'), type: 'collection', group: gettext('Options'),
model: OptionsModel, control: 'unique-col-collection', mode: ['create', 'edit'],

View File

@ -108,6 +108,7 @@ define('pgadmin.node.foreign_data_wrapper', [
defaults: {
name: undefined,
fdwowner: undefined,
is_sys_obj: undefined,
comment: undefined,
fdwvalue: undefined,
fdwhan: undefined,
@ -146,6 +147,9 @@ define('pgadmin.node.foreign_data_wrapper', [
},{
id: 'fdwhan', label: gettext('Handler'), type: 'text', control: 'node-ajax-options',
group: gettext('Definition'), mode: ['edit', 'create', 'properties'], url:'get_handlers',
},{
id: 'is_sys_obj', label: gettext('System foreign data wrapper?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline',

View File

@ -230,6 +230,11 @@ class LanguageView(PGChildNodeView):
self.driver = get_driver(PG_DEFAULT_DRIVER)
self.manager = self.driver.connection_manager(kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did'])
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
# Set the template path for the SQL scripts
self.template_path = (
"languages/sql/#gpdb#{0}#".format(self.manager.version) if
@ -348,6 +353,9 @@ class LanguageView(PGChildNodeView):
gettext("Could not find the language information.")
)
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
sql = render_template(
"/".join([self.template_path, 'acl.sql']),
lid=lid

View File

@ -129,6 +129,9 @@ define('pgadmin.node.language', [
},{
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'],
},{
id: 'is_sys_obj', label: gettext('System language?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline',

View File

@ -139,6 +139,10 @@ def check_precondition(f):
return gone(errormsg=gettext("Could not find the server."))
self.conn = self.manager.connection(did=kwargs['did'])
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
# Set the template path for the SQL scripts
if self.manager.server_type == 'gpdb':
_temp = self.gpdb_template_path(self.manager.version)
@ -539,6 +543,8 @@ It may have been removed by another user.
# Making copy of output for future use
copy_data = dict(res['rows'][0])
copy_data['is_sys_obj'] = (
copy_data['oid'] <= self.datlastsysoid)
copy_data = self._formatter(copy_data, scid)
return ajax_response(

View File

@ -146,6 +146,10 @@ class CatalogObjectView(PGChildNodeView):
kwargs['sid']
)
self.conn = self.manager.connection(did=kwargs['did'])
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
self.template_path = 'catalog_object/sql/{0}/#{1}#'.format(
'ppas' if self.manager.server_type == 'ppas' else 'pg',
self.manager.version
@ -291,6 +295,9 @@ class CatalogObjectView(PGChildNodeView):
return gone(
gettext("""Could not find the specified catalog object."""))
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
return ajax_response(
response=res['rows'][0],
status=200

View File

@ -173,6 +173,10 @@ class CatalogObjectColumnsView(PGChildNodeView):
kwargs['sid']
)
self.conn = self.manager.connection(did=kwargs['did'])
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
self.template_path = 'catalog_object_column/sql/#{0}#'.format(
self.manager.version)
@ -273,6 +277,9 @@ class CatalogObjectColumnsView(PGChildNodeView):
if len(res['rows']) == 0:
return gone(gettext("""Could not find the specified column."""))
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['attrelid'] <= self.datlastsysoid)
return ajax_response(
response=res['rows'][0],
status=200

View File

@ -50,6 +50,7 @@ define('pgadmin.node.catalog_object_column', [
cltype: undefined,
collspcname: undefined,
attacl: undefined,
is_sys_obj: undefined,
description: undefined,
},
schema: [{
@ -70,6 +71,9 @@ define('pgadmin.node.catalog_object_column', [
},{
id: 'attacl', label: gettext('Privileges'), cell: 'string',
group: gettext('Security'), type: 'text', readonly: true,
},{
id: 'is_sys_obj', label: gettext('System column?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline', readonly: true,

View File

@ -45,6 +45,7 @@ define('pgadmin.node.catalog_object', [
name: undefined,
namespaceowner: undefined,
nspacl: undefined,
is_sys_obj: undefined,
description: undefined,
},
schema: [{
@ -56,6 +57,9 @@ define('pgadmin.node.catalog_object', [
},{
id: 'owner', label: gettext('Owner'), cell: 'string',
type: 'text', readonly: true,
},{
id: 'is_sys_obj', label: gettext('System catalog object?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline' , readonly: true,

View File

@ -197,6 +197,11 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
kwargs['sid']
)
self.conn = self.manager.connection(did=kwargs['did'])
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
# Set the template path for the SQL scripts
self.template_path = compile_template_path(
'collations/sql/',
@ -344,7 +349,8 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.template_path,
'properties.sql']),
scid=scid, coid=coid)
scid=scid, coid=coid,
datlastsysoid=self.datlastsysoid)
status, res = self.conn.execute_dict(SQL)
if not status:
@ -354,6 +360,9 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
return False, gone(gettext("Could not find the collation "
"object in the database."))
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
return True, res['rows'][0]
@check_precondition

View File

@ -137,6 +137,9 @@ define('pgadmin.node.collation', [
type: 'text', mode: ['properties', 'create', 'edit'], group: gettext('Definition'),
disabled: 'inSchemaWithModelCheck', readonly: function(m) {return !m.isNew;},
deps: ['locale', 'copy_collation'],
},{
id: 'is_sys_obj', label: gettext('System collation?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline', mode: ['properties', 'create', 'edit'],

View File

@ -265,6 +265,10 @@ class DomainView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
# Get database connection
self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent
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 = compile_template_path(

View File

@ -245,6 +245,10 @@ class DomainConstraintView(PGChildNodeView):
self.manager = driver.connection_manager(kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent
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
# Set the template path for the SQL scripts
self.template_path = 'domain_constraints/sql/#{0}#'.format(
@ -389,6 +393,8 @@ class DomainConstraintView(PGChildNodeView):
)
data = res['rows'][0]
data['is_sys_obj'] = (
data['oid'] <= self.datlastsysoid)
return ajax_response(
response=data,
status=200

View File

@ -85,6 +85,9 @@ define('pgadmin.node.domain_constraints', [
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'],
},{
id: 'is_sys_obj', label: gettext('System domain constraint?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), type: 'multiline', cell:
'string', mode: ['properties', 'create', 'edit'], min_version: 90500,

View File

@ -340,6 +340,10 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
# Get database connection
self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent
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
# Set template path for sql scripts depending
# on the server version.
@ -1094,6 +1098,8 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
return False, False
data = res['rows'][0]
data['is_sys_obj'] = (
data['oid'] <= self.datlastsysoid)
if self.manager.version >= 90200:
# Fetch privileges

View File

@ -542,6 +542,7 @@ define('pgadmin.node.foreign_table', [
oid: undefined,
owner: undefined,
basensp: undefined,
is_sys_obj: undefined,
description: undefined,
ftsrvname: undefined,
strftoptions: undefined,
@ -567,6 +568,9 @@ define('pgadmin.node.foreign_table', [
id: 'basensp', label: gettext('Schema'), cell: 'node-list-by-name',
control: 'node-list-by-name', cache_level: 'database', type: 'text',
node: 'schema', mode:['create', 'edit'],
},{
id: 'is_sys_obj', label: gettext('System foreign table?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline',

View File

@ -230,6 +230,10 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did'])
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
# Set the template path for the SQL scripts
self.template_path = 'fts_configurations/sql/#{0}#'.format(
self.manager.version)
@ -382,6 +386,9 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
"database node.")
)
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
# In edit mode fetch token/dictionary list also
sql = render_template(
"/".join([self.template_path, 'tokenDictList.sql']),

View File

@ -469,6 +469,7 @@ define('pgadmin.node.fts_configuration', [
defaults: {
name: undefined, // FTS Configuration name
owner: undefined, // FTS Configuration owner
is_sys_obj: undefined, // Is system object
description: undefined, // Comment on FTS Configuration
schema: undefined, // Schema name FTS Configuration belongs to
prsname: undefined, // FTS parser list for FTS Configuration node
@ -503,6 +504,9 @@ define('pgadmin.node.fts_configuration', [
type: 'text', mode: ['create','edit'], node: 'schema',
control: 'node-list-by-id', cache_node: 'database',
cache_level: 'database',
},{
id: 'is_sys_obj', label: gettext('System FTS configuration?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline', cellHeaderClasses: 'width_percent_50',

View File

@ -219,6 +219,11 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
self.conn = self.manager.connection(did=kwargs['did'])
driver = get_driver(PG_DEFAULT_DRIVER)
self.qtIdent = driver.qtIdent
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
# Set the template path for the SQL scripts
self.template_path = 'fts_dictionaries/sql/#{0}#'.format(
self.manager.version)
@ -390,6 +395,9 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
"Could not find the FTS Dictionary node in the database node."
))
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
# Handle templates and its schema name properly
if res['rows'][0]['template_schema'] is not None:
if res['rows'][0]['template_schema'] != "pg_catalog":

View File

@ -115,6 +115,7 @@ define('pgadmin.node.fts_dictionary', [
defaults: {
name: undefined, // FTS Dictionary name
owner: undefined, // FTS Dictionary owner
is_sys_obj: undefined, // Is system object
description: undefined, // Comment on FTS Dictionary
schema: undefined, // Schema name FTS dictionary belongs to
template: undefined, // Template list for FTS dictionary node
@ -147,6 +148,9 @@ define('pgadmin.node.fts_dictionary', [
id: 'schema', label: gettext('Schema'), cell: 'string',
type: 'text', mode: ['create','edit'], node: 'schema',
cache_node: 'database', control: 'node-list-by-id',
},{
id: 'is_sys_obj', label: gettext('System FTS dictionary?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline', cellHeaderClasses: 'width_percent_50',

View File

@ -233,6 +233,10 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did'])
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
# Set the template path for the SQL scripts
self.template_path = 'fts_parsers/sql/#{0}#'.format(
self.manager.version)
@ -348,6 +352,8 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
return False, gone(
_("Could not find the FTS Parser node in the database node."))
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
return True, res['rows'][0]
@check_precondition

View File

@ -72,6 +72,7 @@ define('pgadmin.node.fts_parser', [
idAttribute: 'oid',
defaults: {
name: undefined, // Fts parser name
is_sys_obj: undefined, // Is system object
description: undefined, // Comment on parser
schema: undefined, // Schema name to which parser belongs
prsstart: undefined, // Start function for fts parser
@ -101,6 +102,9 @@ define('pgadmin.node.fts_parser', [
type: 'text', mode: ['create','edit'], node: 'schema',
control: 'node-list-by-id', cache_node: 'database',
cache_level: 'database',
},{
id: 'is_sys_obj', label: gettext('System FTS parser?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline', cellHeaderClasses: 'width_percent_50',

View File

@ -212,6 +212,10 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did'])
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
self.template_path = 'fts_templates/sql/#{0}#'.format(
self.manager.version)
@ -325,7 +329,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
return False, gone(
gettext("Could not find the requested FTS template.")
)
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
return True, res['rows'][0]
@check_precondition

View File

@ -72,6 +72,7 @@ define('pgadmin.node.fts_template', [
idAttribute: 'oid',
defaults: {
name: undefined, // Fts template name
is_sys_obj: undefined, // Is system object
description: undefined, // Comment on template
schema: undefined, // Schema name to which template belongs
tmplinit: undefined, // Init function for fts template
@ -96,6 +97,9 @@ define('pgadmin.node.fts_template', [
type: 'text', mode: ['create','edit'], node: 'schema',
control: 'node-list-by-id', cache_node: 'database',
cache_level: 'database',
},{
id: 'is_sys_obj', label: gettext('System FTS parser?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline', cellHeaderClasses: 'width_percent_50',

View File

@ -134,7 +134,7 @@ define('pgadmin.node.trigger_function', [
node: 'schema', disabled: 'isDisabled', readonly: 'isReadonly',
mode: ['create', 'edit'],
},{
id: 'sysfunc', label: gettext('System function?'),
id: 'sysfunc', label: gettext('System trigger function?'),
cell:'boolean', type: 'switch',
mode: ['properties'], visible: 'isVisible',
},{

View File

@ -139,6 +139,10 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
self.conn = self.manager.connection(did=kwargs['did'])
else:
self.conn = self.manager.connection()
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
self.template_path = 'sequences/sql/#{0}#'.format(
self.manager.version
@ -306,6 +310,9 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
return False, gone(
_("Could not find the sequence in the database."))
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
for row in res['rows']:
SQL = render_template(
"/".join([self.template_path, 'get_def.sql']),

View File

@ -80,6 +80,7 @@ define('pgadmin.node.sequence', [
oid: undefined,
seqowner: undefined,
schema: undefined,
is_sys_obj: undefined,
comment: undefined,
increment: undefined,
start: undefined,
@ -128,6 +129,9 @@ define('pgadmin.node.sequence', [
}
return true;
}, cache_node: 'database', cache_level: 'database',
},{
id: 'is_sys_obj', label: gettext('System sequence?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'comment', label: gettext('Comment'), type: 'multiline',
mode: ['properties', 'create', 'edit'],

View File

@ -45,6 +45,7 @@ define('pgadmin.node.catalog', [
name: undefined,
namespaceowner: undefined,
nspacl: undefined,
is_sys_obj: undefined,
description: undefined,
securitylabel: [],
},
@ -70,6 +71,9 @@ define('pgadmin.node.catalog', [
},{
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'],
},{
id: 'is_sys_obj', label: gettext('System catalog?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline',

View File

@ -413,7 +413,7 @@ define('pgadmin.node.schema', [
type: 'text', control: 'node-list-by-name', node: 'role',
select2: { allowClear: false },
},{
id: 'is_sys_object', label: gettext('System schema?'),
id: 'is_sys_obj', label: gettext('System schema?'),
cell: 'switch', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',

View File

@ -195,6 +195,10 @@ class CheckConstraintView(PGChildNodeView):
self.manager = driver.connection_manager(kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent
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
# Set the template path for the SQL scripts
self.template_path = 'check_constraint/sql/#{0}#'.format(
@ -434,6 +438,8 @@ class CheckConstraintView(PGChildNodeView):
result = res
if cid:
result = res[0]
result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid)
return ajax_response(
response=result,

View File

@ -109,6 +109,9 @@ define('pgadmin.node.check_constraint', [
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'],
},{
id: 'is_sys_obj', label: gettext('System check constraint?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'comment', label: gettext('Comment'), type: 'multiline', cell:
'string', mode: ['properties', 'create', 'edit'],

View File

@ -225,6 +225,10 @@ class ExclusionConstraintView(PGChildNodeView):
kwargs['sid']
)
self.conn = self.manager.connection(did=kwargs['did'])
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
self.template_path = 'exclusion_constraint/sql/#{0}#'.format(
self.manager.version)
@ -274,6 +278,8 @@ class ExclusionConstraintView(PGChildNodeView):
result = res
if exid:
result = res[0]
result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid)
return ajax_response(
response=result,

View File

@ -655,6 +655,7 @@ define('pgadmin.node.exclusion_constraint', [
defaults: {
name: undefined,
oid: undefined,
is_sys_obj: undefined,
comment: undefined,
spcname: undefined,
amname: 'gist',
@ -672,6 +673,9 @@ define('pgadmin.node.exclusion_constraint', [
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'],
},{
id: 'is_sys_obj', label: gettext('System exclusion constraint?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'comment', label: gettext('Comment'), cell: 'string',
type: 'multiline', mode: ['properties', 'create', 'edit'],

View File

@ -233,6 +233,10 @@ class ForeignKeyConstraintView(PGChildNodeView):
kwargs['sid']
)
self.conn = self.manager.connection(did=kwargs['did'])
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
self.template_path = 'foreign_key/sql/#{0}#'.format(
self.manager.version)
@ -277,6 +281,8 @@ class ForeignKeyConstraintView(PGChildNodeView):
result = res
if fkid:
result = res[0]
result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid)
return ajax_response(
response=result,

View File

@ -690,6 +690,7 @@ define('pgadmin.node.foreign_key', [
defaults: {
name: undefined,
oid: undefined,
is_sys_obj: undefined,
comment: undefined,
condeferrable: undefined,
condeferred: undefined,
@ -715,6 +716,9 @@ define('pgadmin.node.foreign_key', [
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'],
},{
id: 'is_sys_obj', label: gettext('System foreign key?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'comment', label: gettext('Comment'), cell: 'string',
type: 'multiline', mode: ['properties', 'create', 'edit'],

View File

@ -245,6 +245,10 @@ class IndexConstraintView(PGChildNodeView):
kwargs['sid']
)
self.conn = self.manager.connection(did=kwargs['did'])
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
self.template_path = 'index_constraint/sql/#{0}#'\
.format(self.manager.version)
@ -295,6 +299,8 @@ class IndexConstraintView(PGChildNodeView):
result = res
if cid:
result = res[0]
result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid)
return ajax_response(
response=result,

View File

@ -104,6 +104,7 @@ define('pgadmin.node.primary_key', [
defaults: {
name: undefined,
oid: undefined,
is_sys_obj: undefined,
comment: undefined,
spcname: undefined,
index: undefined,
@ -123,6 +124,9 @@ define('pgadmin.node.primary_key', [
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'], editable: false,
cellHeaderClasses:'width_percent_20',
},{
id: 'is_sys_obj', label: gettext('System primary key?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'comment', label: gettext('Comment'), cell: 'string',
type: 'multiline', mode: ['properties', 'create', 'edit'],

View File

@ -90,6 +90,7 @@ define('pgadmin.node.unique_constraint', [
defaults: {
name: undefined,
oid: undefined,
is_sys_obj: undefined,
comment: undefined,
spcname: undefined,
index: undefined,
@ -109,6 +110,9 @@ define('pgadmin.node.unique_constraint', [
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'], editable: false,
cellHeaderClasses:'width_percent_20',
},{
id: 'is_sys_obj', label: gettext('System unique constraint?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'comment', label: gettext('Comment'), cell: 'string',
type: 'multiline', mode: ['properties', 'create', 'edit'],

View File

@ -377,6 +377,10 @@ define('pgadmin.node.table', [
return true;
return false;
},
},{
id: 'is_sys_table', label: gettext('System table?'), cell: 'switch',
type: 'switch', mode: ['properties'],
disabled: 'inSchema',
},{
id: 'description', label: gettext('Comment'), type: 'multiline',
mode: ['properties', 'create', 'edit'], disabled: 'inSchema',
@ -851,10 +855,6 @@ define('pgadmin.node.table', [
id: 'relhassubclass', label: gettext('Inherits tables?'), cell: 'switch',
type: 'switch', mode: ['properties'], group: gettext('advanced'),
disabled: 'inSchema',
},{
id: 'is_sys_table', label: gettext('System table?'), cell: 'switch',
type: 'switch', mode: ['properties'],
disabled: 'inSchema',
},{
type: 'nested', control: 'fieldset', label: gettext('Like'),
group: gettext('advanced'),

View File

@ -6,9 +6,6 @@ SELECT
array_to_string(nsp.nspacl::text[], ', ') as acl,
r.rolname AS namespaceowner, description,
has_schema_privilege(nsp.oid, 'CREATE') AS can_create,
CASE
WHEN nspname LIKE E'pg\\_%' THEN true
ELSE false END AS is_sys_object,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl

View File

@ -6,9 +6,6 @@ SELECT
array_to_string(nsp.nspacl::text[], ', ') as acl,
r.rolname AS namespaceowner, description,
has_schema_privilege(nsp.oid, 'CREATE') AS can_create,
CASE
WHEN nspname LIKE E'pg\\_%' THEN true
ELSE false END AS is_sys_object,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl,

View File

@ -6,9 +6,6 @@ SELECT
array_to_string(nsp.nspacl::text[], ', ') as acl,
r.rolname AS namespaceowner, description,
has_schema_privilege(nsp.oid, 'CREATE') AS can_create,
CASE
WHEN nspname LIKE E'pg\\_%' THEN true
ELSE false END AS is_sys_object,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl,

View File

@ -6,9 +6,6 @@ SELECT
array_to_string(nsp.nspacl::text[], ', ') as acl,
r.rolname AS namespaceowner, description,
has_schema_privilege(nsp.oid, 'CREATE') AS can_create,
CASE
WHEN nspname LIKE E'pg\\_%' THEN true
ELSE false END AS is_sys_object,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl,

View File

@ -9,9 +9,6 @@ SELECT
array_to_string(nsp.nspacl::text[], ', ') as acl,
r.rolname AS namespaceowner, description,
has_schema_privilege(nsp.oid, 'CREATE') AS can_create,
CASE
WHEN nspname LIKE E'pg\\_%' THEN true
ELSE false END AS is_sys_object,
{### Default ACL for Tables ###}
(SELECT array_to_string(ARRAY(
SELECT array_to_string(defaclacl::text[], ', ')

View File

@ -9,9 +9,6 @@ SELECT
array_to_string(nsp.nspacl::text[], ', ') as acl,
r.rolname AS namespaceowner, description,
has_schema_privilege(nsp.oid, 'CREATE') AS can_create,
CASE
WHEN nspname LIKE E'pg\\_%' THEN true
ELSE false END AS is_sys_object,
{### Default ACL for Tables ###}
(SELECT array_to_string(ARRAY(
SELECT array_to_string(defaclacl::text[], ', ')

View File

@ -9,9 +9,6 @@ SELECT
array_to_string(nsp.nspacl::text[], ', ') as acl,
r.rolname AS namespaceowner, description,
has_schema_privilege(nsp.oid, 'CREATE') AS can_create,
CASE
WHEN nspname LIKE E'pg\\_%' THEN true
ELSE false END AS is_sys_object,
{### Default ACL for Tables ###}
(SELECT array_to_string(ARRAY(
SELECT array_to_string(defaclacl::text[], ', ')

View File

@ -9,9 +9,6 @@ SELECT
array_to_string(nsp.nspacl::text[], ', ') as acl,
r.rolname AS namespaceowner, description,
has_schema_privilege(nsp.oid, 'CREATE') AS can_create,
CASE
WHEN nspname LIKE E'pg\\_%' THEN true
ELSE false END AS is_sys_object,
{### Default ACL for Tables ###}
(SELECT array_to_string(ARRAY(
SELECT array_to_string(defaclacl::text[], ', ')

View File

@ -279,6 +279,7 @@ define('pgadmin.node.database', [
defaults: {
name: undefined,
owner: undefined,
is_sys_obj: undefined,
comment: undefined,
encoding: 'UTF8',
template: undefined,
@ -334,6 +335,9 @@ define('pgadmin.node.database', [
},{
id: 'typeacl', label: gettext('Default TYPE privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], min_version: 90200,
},{
id: 'is_sys_obj', label: gettext('System database?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'comments', label: gettext('Comment'),
editable: false, type: 'multiline',

View File

@ -219,7 +219,11 @@ class ResourceGroupView(NodeView):
self.manager = self.driver.connection_manager(kwargs['sid'])
self.conn = self.manager.connection()
# If DB not connected then return error to browser
self.datlastsysoid = \
self.manager.db_info[self.manager.did]['datlastsysoid'] \
if self.manager.db_info is not None and \
self.manager.did in self.manager.db_info else 0
if not self.conn.connected():
return precondition_required(
gettext(
@ -336,6 +340,9 @@ class ResourceGroupView(NodeView):
if len(res['rows']) == 0:
return gone(gettext("""Could not find the resource group."""))
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
return ajax_response(
response=res['rows'][0],
status=200

View File

@ -78,6 +78,7 @@ define('pgadmin.node.resource_group', [
defaults: {
oid: undefined,
name: undefined,
is_sys_obj: undefined,
cpu_rate_limit: 0.0,
dirty_rate_limit: 0.0,
},
@ -89,6 +90,9 @@ define('pgadmin.node.resource_group', [
},{
id: 'name', label: gettext('Name'), cell: 'string',
type: 'text',
},{
id: 'is_sys_obj', label: gettext('System resource group?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'cpu_rate_limit', label: gettext('CPU rate limit (percentage)'), cell: 'string',
type: 'numeric', min:0, max:16777216,

View File

@ -469,6 +469,11 @@ rolmembership:{
_("Connection to the server has been lost.")
)
self.datlastsysoid = \
self.manager.db_info[self.manager.did]['datlastsysoid'] \
if self.manager.db_info is not None and \
self.manager.did in self.manager.db_info else 0
self.sql_path = 'roles/sql/#{0}#'.format(self.manager.version)
self.alterKeys = [
@ -683,6 +688,9 @@ rolmembership:{
if len(res['rows']) == 0:
return gone(_("Could not find the role information."))
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
return ajax_response(
response=res['rows'][0],
status=200

View File

@ -448,6 +448,9 @@ define('pgadmin.node.role', [
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
readonly: 'readonly',
},{
id: 'is_sys_obj', label: gettext('System role?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comments'), type: 'multiline',
group: null, mode: ['properties', 'edit', 'create'],

View File

@ -111,6 +111,10 @@ class TablespaceView(PGChildNodeView):
kwargs['sid']
)
self.conn = self.manager.connection()
self.datlastsysoid = \
self.manager.db_info[self.manager.did]['datlastsysoid'] \
if self.manager.db_info is not None and \
self.manager.did in self.manager.db_info else 0
# If DB not connected then return error to browser
if not self.conn.connected():
@ -267,6 +271,8 @@ class TablespaceView(PGChildNodeView):
# Making copy of output for future use
copy_data = dict(res['rows'][0])
copy_data['is_sys_obj'] = (
copy_data['oid'] <= self.datlastsysoid)
copy_data = self._formatter(copy_data, tsid)
return ajax_response(

View File

@ -319,6 +319,7 @@ define('pgadmin.node.tablespace', [
defaults: {
name: undefined,
owner: undefined,
is_sys_obj: undefined,
comment: undefined,
spclocation: undefined,
spcoptions: [],
@ -358,6 +359,9 @@ define('pgadmin.node.tablespace', [
},{
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'],
},{
id: 'is_sys_obj', label: gettext('System tablespace?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline',