From dfb74904ed54db96f57ddae304dbc286428e943e Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Thu, 23 Apr 2020 17:31:40 +0530 Subject: [PATCH] Ensure all object types have a System XXX? property. Fixes #1257 --- docs/en_US/release_notes_4_21.rst | 1 + .../server_groups/servers/databases/__init__.py | 4 ++++ .../servers/databases/event_triggers/__init__.py | 7 +++++++ .../event_triggers/static/js/event_trigger.js | 5 +++++ .../servers/databases/extensions/__init__.py | 7 +++++++ .../databases/extensions/static/js/extension.js | 6 ++++-- .../databases/foreign_data_wrappers/__init__.py | 7 +++++++ .../foreign_data_wrappers/foreign_servers/__init__.py | 8 ++++++++ .../foreign_servers/static/js/foreign_server.js | 4 ++++ .../foreign_servers/user_mappings/__init__.py | 7 +++++++ .../user_mappings/static/js/user_mapping.js | 4 ++++ .../static/js/foreign_data_wrapper.js | 4 ++++ .../servers/databases/languages/__init__.py | 8 ++++++++ .../servers/databases/languages/static/js/language.js | 3 +++ .../servers/databases/schemas/__init__.py | 6 ++++++ .../databases/schemas/catalog_objects/__init__.py | 7 +++++++ .../schemas/catalog_objects/columns/__init__.py | 7 +++++++ .../columns/static/js/catalog_object_column.js | 4 ++++ .../catalog_objects/static/js/catalog_object.js | 4 ++++ .../servers/databases/schemas/collations/__init__.py | 11 ++++++++++- .../schemas/collations/static/js/collation.js | 3 +++ .../servers/databases/schemas/domains/__init__.py | 4 ++++ .../schemas/domains/domain_constraints/__init__.py | 6 ++++++ .../static/js/domain_constraints.js | 3 +++ .../databases/schemas/foreign_tables/__init__.py | 6 ++++++ .../schemas/foreign_tables/static/js/foreign_table.js | 4 ++++ .../databases/schemas/fts_configurations/__init__.py | 7 +++++++ .../fts_configurations/static/js/fts_configuration.js | 4 ++++ .../databases/schemas/fts_dictionaries/__init__.py | 8 ++++++++ .../fts_dictionaries/static/js/fts_dictionary.js | 4 ++++ .../servers/databases/schemas/fts_parsers/__init__.py | 6 ++++++ .../schemas/fts_parsers/static/js/fts_parser.js | 4 ++++ .../databases/schemas/fts_templates/__init__.py | 7 ++++++- .../schemas/fts_templates/static/js/fts_template.js | 4 ++++ .../schemas/functions/static/js/trigger_function.js | 2 +- .../servers/databases/schemas/sequences/__init__.py | 7 +++++++ .../databases/schemas/sequences/static/js/sequence.js | 4 ++++ .../servers/databases/schemas/static/js/catalog.js | 4 ++++ .../servers/databases/schemas/static/js/schema.js | 2 +- .../tables/constraints/check_constraint/__init__.py | 6 ++++++ .../check_constraint/static/js/check_constraint.js | 3 +++ .../constraints/exclusion_constraint/__init__.py | 6 ++++++ .../static/js/exclusion_constraint.js | 4 ++++ .../tables/constraints/foreign_key/__init__.py | 6 ++++++ .../constraints/foreign_key/static/js/foreign_key.js | 4 ++++ .../tables/constraints/index_constraint/__init__.py | 6 ++++++ .../index_constraint/static/js/primary_key.js | 4 ++++ .../index_constraint/static/js/unique_constraint.js | 4 ++++ .../databases/schemas/tables/static/js/table.js | 8 ++++---- .../templates/catalog/pg/9.1_plus/sql/properties.sql | 3 --- .../templates/catalog/pg/9.2_plus/sql/properties.sql | 3 --- .../catalog/ppas/9.1_plus/sql/properties.sql | 3 --- .../catalog/ppas/9.2_plus/sql/properties.sql | 3 --- .../templates/schemas/pg/9.2_plus/sql/properties.sql | 3 --- .../templates/schemas/pg/default/sql/properties.sql | 3 --- .../schemas/ppas/9.1_plus/sql/properties.sql | 3 --- .../schemas/ppas/9.2_plus/sql/properties.sql | 3 --- .../servers/databases/static/js/database.js | 4 ++++ .../server_groups/servers/resource_groups/__init__.py | 9 ++++++++- .../resource_groups/static/js/resource_group.js | 4 ++++ .../browser/server_groups/servers/roles/__init__.py | 8 ++++++++ .../server_groups/servers/roles/static/js/role.js | 3 +++ .../server_groups/servers/tablespaces/__init__.py | 6 ++++++ .../servers/tablespaces/static/js/tablespace.js | 4 ++++ 64 files changed, 281 insertions(+), 35 deletions(-) diff --git a/docs/en_US/release_notes_4_21.rst b/docs/en_US/release_notes_4_21.rst index 57411dd03..a4196db87 100644 --- a/docs/en_US/release_notes_4_21.rst +++ b/docs/en_US/release_notes_4_21.rst @@ -27,6 +27,7 @@ Housekeeping Bug fixes ********* +| `Issue #1257 `_ - Ensure all object types have a "System XXX?" property. | `Issue #2813 `_ - Ensure that the password prompt should not be visible if the database server is in trust authentication mode. | `Issue #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 `_ - Fixed an issue where the query tool unable to load the file which contains the BOM marker. diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py index 0d1581f5f..9216f2164 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py @@ -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']), diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py index 22fe68963..2b249423b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py @@ -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( diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js index add08f08a..149da0d68 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js +++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger.js @@ -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', },{ diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py index 21b314083..41a5f2f36 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension.js b/web/pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension.js index b2127c4b0..e66cc5037 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension.js +++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension.js @@ -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, }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py index dc1f63fa8..848ff1f92 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py @@ -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'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py index 6286ed94e..ed63f525d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py @@ -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' diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js index ad6f1f76b..9c6c01379 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server.js @@ -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', diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py index 61743eb65..44561fbcf 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py @@ -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'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js index 400a6722f..6a2849e4f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/static/js/user_mapping.js @@ -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'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js index ff412dcbc..391600f50 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper.js @@ -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', diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py index ecd6e3cc1..ebf533f47 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js b/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js index f3a9f497b..d7be560e1 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js +++ b/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js @@ -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', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py index a13402fff..070804999 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py @@ -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( diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/__init__.py index 1bf2a4af3..5ab563a02 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/__init__.py @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/__init__.py index add698f6a..02e8682fd 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/__init__.py @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.js index 9bf003fa6..b52d3ae17 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.js @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/static/js/catalog_object.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/static/js/catalog_object.js index dcf37e801..cfc27589c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/static/js/catalog_object.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/static/js/catalog_object.js @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py index 8c0537bf0..0d63a7b3c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/static/js/collation.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/static/js/collation.js index 721df9f35..070a22f58 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/static/js/collation.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/static/js/collation.js @@ -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'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py index a5b2ffbfe..ba622131c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py @@ -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( diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py index b599425e9..dfecf8fa6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/static/js/domain_constraints.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/static/js/domain_constraints.js index bf53fb65b..59e7dd1fd 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/static/js/domain_constraints.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/static/js/domain_constraints.js @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py index 163388f04..370bf0926 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.js index 15cdf9428..081855a69 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.js @@ -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', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py index d17f511ca..0f0b6df1f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py @@ -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']), diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js index 7a4ed5edc..dd82f327f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js @@ -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', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py index 805bd0efa..81a4f8a53 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py @@ -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": diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/static/js/fts_dictionary.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/static/js/fts_dictionary.js index 08666e80c..548908b3b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/static/js/fts_dictionary.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/static/js/fts_dictionary.js @@ -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', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py index ce5d82aed..18c6d693a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/static/js/fts_parser.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/static/js/fts_parser.js index d143a1d34..ae58a09cd 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/static/js/fts_parser.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/static/js/fts_parser.js @@ -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', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py index 1e760b637..9d5e2ff34 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/static/js/fts_template.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/static/js/fts_template.js index 0e2f49f29..aa7080c0d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/static/js/fts_template.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/static/js/fts_template.js @@ -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', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js index ff694555a..64d01a5ac 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js @@ -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', },{ diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py index c5f6c4e9b..09fd18315 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py @@ -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']), diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/static/js/sequence.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/static/js/sequence.js index aa628c4f2..8e9f20e27 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/static/js/sequence.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/static/js/sequence.js @@ -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'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/catalog.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/catalog.js index 4f6d544d2..ae448937b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/catalog.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/catalog.js @@ -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', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/schema.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/schema.js index 613941637..084e4cd9e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/schema.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/static/js/schema.js @@ -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', diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py index 58ccb2f0c..cc3bfd07e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/static/js/check_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/static/js/check_constraint.js index 9e86c67b0..cb79d8e6f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/static/js/check_constraint.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/static/js/check_constraint.js @@ -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'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py index 5204fe635..73010b913 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js index 47afa399f..37594608d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint.js @@ -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'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py index 503c77e81..dcc89ec0a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js index 66083151f..764b69b9d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js @@ -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'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py index 05cfe3050..9685bb372 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js index 5ff6b30a3..dff4aacbd 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key.js @@ -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'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js index c23fc054f..38a1bc687 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint.js @@ -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'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js index f1dd27dc5..5d3d11f4a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js @@ -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'), diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.1_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.1_plus/sql/properties.sql index 922e3c12b..3b4ca1fce 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.1_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.1_plus/sql/properties.sql @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/properties.sql index d9bd89360..7a88e8b83 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/properties.sql @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.1_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.1_plus/sql/properties.sql index 2c4892974..65bf873fd 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.1_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.1_plus/sql/properties.sql @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.2_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.2_plus/sql/properties.sql index 85c9c529e..bc7023b8d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.2_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.2_plus/sql/properties.sql @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/properties.sql index a99e05093..e07626d80 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/properties.sql @@ -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[], ', ') diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/properties.sql index 9335cd100..50c8a25ad 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/properties.sql @@ -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[], ', ') diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/properties.sql index 965e27af2..f9a3ca719 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/properties.sql @@ -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[], ', ') diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/properties.sql index 5d2f3682b..72b36f071 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/properties.sql @@ -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[], ', ') diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js index 297116d24..f458d6974 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js +++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js @@ -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', diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py index 913dad50c..3269243e5 100644 --- a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js b/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js index 03e38b142..5715eb1a1 100644 --- a/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js +++ b/web/pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group.js @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/roles/__init__.py b/web/pgadmin/browser/server_groups/servers/roles/__init__.py index fe1ba684f..26533d944 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/roles/__init__.py @@ -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 diff --git a/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js b/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js index c7bb247ec..359910b16 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js +++ b/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js @@ -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'], diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py index 8e2f7f8a9..057759785 100644 --- a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py @@ -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( diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js b/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js index fe214d4b1..792571939 100644 --- a/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js +++ b/web/pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace.js @@ -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',