The following are the initial fixes for PG15:

1) From PG 15 onward, the datlastsysoid has been removed from the table pg_database.
    We have added the constant _DATABASE_LAST_SYSTEM_OID = 16383, all the objects below
    this value are considered to be system objects. Modified the pgAdmin logic accordingly.

 2) Concatenation operator '||' needs a specific typecast to be applied to query variables. Modified SQL's accordingly.

Fixes #7283
This commit is contained in:
Akshay Joshi
2022-05-17 20:32:17 +05:30
parent 6465dc951c
commit b36004b702
81 changed files with 247 additions and 425 deletions

View File

@@ -14,6 +14,7 @@ Housekeeping
************ ************
| `Issue #7337 <https://redmine.postgresql.org/issues/7337>`_ - Port connect server password dialog to React. | `Issue #7337 <https://redmine.postgresql.org/issues/7337>`_ - Port connect server password dialog to React.
| `Issue #7283 <https://redmine.postgresql.org/issues/7283>`_ - PG 15 compatibility issues fixed.
Bug fixes Bug fixes
********* *********

View File

@@ -182,7 +182,6 @@ class DatabaseView(PGChildNodeView):
if self.manager is None: if self.manager is None:
return gone(errormsg=_("Could not find the server.")) return gone(errormsg=_("Could not find the server."))
self.datlastsysoid = 0
self.datistemplate = False self.datistemplate = False
if action and action in ["drop"]: if action and action in ["drop"]:
self.conn = self.manager.connection() self.conn = self.manager.connection()
@@ -193,8 +192,7 @@ class DatabaseView(PGChildNodeView):
# provide generic connection # provide generic connection
if kwargs['did'] in self.manager.db_info: if kwargs['did'] in self.manager.db_info:
self._db = self.manager.db_info[kwargs['did']] self._db = self.manager.db_info[kwargs['did']]
self.datlastsysoid, self.datistemplate, \ self.datistemplate, datallowconn = \
datallowconn = \
get_attributes_from_db_info(self.manager, kwargs) get_attributes_from_db_info(self.manager, kwargs)
if datallowconn is False: if datallowconn is False:
@@ -252,14 +250,10 @@ class DatabaseView(PGChildNodeView):
def retrieve_last_system_oid(self): def retrieve_last_system_oid(self):
last_system_oid = 0 last_system_oid = 0
if self.blueprint.show_system_objects:
last_system_oid = 0 if not self.blueprint.show_system_objects:
elif ( last_system_oid = self._DATABASE_LAST_SYSTEM_OID
self.manager.db_info is not None and
self.manager.did in self.manager.db_info
):
last_system_oid = (self.manager.db_info[self.manager.did])[
'datlastsysoid']
return last_system_oid return last_system_oid
def get_nodes(self, gid, sid, is_schema_diff=False): def get_nodes(self, gid, sid, is_schema_diff=False):
@@ -269,8 +263,7 @@ class DatabaseView(PGChildNodeView):
# if is_schema_diff then no need to show system templates. # if is_schema_diff then no need to show system templates.
if is_schema_diff and self.manager.db_info is not None and \ if is_schema_diff and self.manager.db_info is not None and \
self.manager.did in self.manager.db_info: self.manager.did in self.manager.db_info:
last_system_oid = \ last_system_oid = self._DATABASE_LAST_SYSTEM_OID
self.manager.db_info[self.manager.did]['datlastsysoid']
server_node_res = self.manager server_node_res = self.manager
@@ -436,7 +429,8 @@ class DatabaseView(PGChildNodeView):
result = res['rows'][0] result = res['rows'][0]
result['is_sys_obj'] = ( result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid or self.datistemplate) result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
# Fetching variable for database # Fetching variable for database
SQL = render_template( SQL = render_template(
"/".join([self.template_path, 'get_variables.sql']), "/".join([self.template_path, 'get_variables.sql']),

View File

@@ -210,11 +210,6 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
# Set template path for the SQL scripts # Set template path for the SQL scripts
self.template_path = 'casts/sql/#{0}#'.format(self.manager.version) self.template_path = 'casts/sql/#{0}#'.format(self.manager.version)
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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -238,7 +233,7 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
:return: :return:
""" """
last_system_oid = 0 if self.blueprint.show_system_objects else \ last_system_oid = 0 if self.blueprint.show_system_objects else \
self.datlastsysoid self._DATABASE_LAST_SYSTEM_OID
sql = render_template( sql = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
datlastsysoid=last_system_oid, datlastsysoid=last_system_oid,
@@ -270,7 +265,7 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = [] res = []
last_system_oid = 0 if self.blueprint.show_system_objects else \ last_system_oid = 0 if self.blueprint.show_system_objects else \
self.datlastsysoid self._DATABASE_LAST_SYSTEM_OID
sql = render_template( sql = render_template(
"/".join([self.template_path, self._NODES_SQL]), "/".join([self.template_path, self._NODES_SQL]),
@@ -348,7 +343,7 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
:return: :return:
""" """
last_system_oid = 0 if not self.blueprint.show_system_objects else \ last_system_oid = 0 if not self.blueprint.show_system_objects else \
self.datlastsysoid self._DATABASE_LAST_SYSTEM_OID
sql = render_template( sql = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
cid=cid, cid=cid,
@@ -407,7 +402,7 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
# we need oid to add object in tree at browser, below sql will # we need oid to add object in tree at browser, below sql will
# gives the same # gives the same
last_system_oid = 0 if self.blueprint.show_system_objects else \ last_system_oid = 0 if self.blueprint.show_system_objects else \
self.datlastsysoid self._DATABASE_LAST_SYSTEM_OID
sql = render_template( sql = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
srctyp=data['srctyp'], srctyp=data['srctyp'],
@@ -584,7 +579,7 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
if cid is not None: if cid is not None:
last_system_oid = 0 if self.blueprint.show_system_objects else \ last_system_oid = 0 if self.blueprint.show_system_objects else \
self.datlastsysoid self._DATABASE_LAST_SYSTEM_OID
sql = render_template( sql = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
cid=cid, cid=cid,
@@ -769,13 +764,9 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = dict() res = dict()
last_system_oid = 0
if self.manager.db_info is not None and did in self.manager.db_info:
last_system_oid = (self.manager.db_info[did])['datlastsysoid']
sql = render_template( sql = render_template(
"/".join([self.template_path, self._NODES_SQL]), "/".join([self.template_path, self._NODES_SQL]),
datlastsysoid=last_system_oid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
showsysobj=self.blueprint.show_system_objects, showsysobj=self.blueprint.show_system_objects,
schema_diff=True schema_diff=True
) )

View File

@@ -196,11 +196,6 @@ class EventTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
self.template_path = 'event_triggers/sql/9.3_plus' 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
self.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -370,7 +365,7 @@ class EventTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
result = res['rows'][0] result = res['rows'][0]
result['is_sys_obj'] = ( result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid or result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate) self.datistemplate)
result = self._formatter(result) result = self._formatter(result)

View File

@@ -139,11 +139,6 @@ class ExtensionView(PGChildNodeView, SchemaDiffObjectCompare):
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
self.template_path = self.EXT_TEMPLATE_PATH self.template_path = self.EXT_TEMPLATE_PATH
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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -257,7 +252,8 @@ class ExtensionView(PGChildNodeView, SchemaDiffObjectCompare):
) )
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return True, res['rows'][0] return True, res['rows'][0]

View File

@@ -216,11 +216,6 @@ class ForeignDataWrapperView(PGChildNodeView, SchemaDiffObjectCompare):
) )
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent 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
self.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -380,7 +375,8 @@ class ForeignDataWrapperView(PGChildNodeView, SchemaDiffObjectCompare):
) )
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
if res['rows'][0]['fdwoptions'] is not None: if res['rows'][0]['fdwoptions'] is not None:
res['rows'][0]['fdwoptions'] = tokenize_options( res['rows'][0]['fdwoptions'] = tokenize_options(

View File

@@ -207,11 +207,6 @@ class ForeignServerView(PGChildNodeView, SchemaDiffObjectCompare):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -369,7 +364,8 @@ class ForeignServerView(PGChildNodeView, SchemaDiffObjectCompare):
return False, gone(self.not_found_error_msg()) return False, gone(self.not_found_error_msg())
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
if res['rows'][0]['fsrvoptions'] is not None: if res['rows'][0]['fsrvoptions'] is not None:
res['rows'][0]['fsrvoptions'] = tokenize_options( res['rows'][0]['fsrvoptions'] = tokenize_options(

View File

@@ -225,11 +225,6 @@ class UserMappingView(PGChildNodeView, SchemaDiffObjectCompare):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -388,7 +383,8 @@ class UserMappingView(PGChildNodeView, SchemaDiffObjectCompare):
return False, gone(self.not_found_error_msg()) return False, gone(self.not_found_error_msg())
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
if res['rows'][0]['umoptions'] is not None: if res['rows'][0]['umoptions'] is not None:
res['rows'][0]['umoptions'] = tokenize_options( res['rows'][0]['umoptions'] = tokenize_options(

View File

@@ -230,11 +230,6 @@ class LanguageView(PGChildNodeView, SchemaDiffObjectCompare):
self.driver = get_driver(PG_DEFAULT_DRIVER) self.driver = get_driver(PG_DEFAULT_DRIVER)
self.manager = self.driver.connection_manager(kwargs['sid']) self.manager = self.driver.connection_manager(kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -378,7 +373,8 @@ class LanguageView(PGChildNodeView, SchemaDiffObjectCompare):
return False, gone(self._NOT_FOUND_LANG_INFORMATION) return False, gone(self._NOT_FOUND_LANG_INFORMATION)
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
sql = render_template( sql = render_template(
"/".join([self.template_path, self._ACL_SQL]), "/".join([self.template_path, self._ACL_SQL]),

View File

@@ -221,10 +221,6 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
self.driver = get_driver(PG_DEFAULT_DRIVER) self.driver = get_driver(PG_DEFAULT_DRIVER)
self.manager = self.driver.connection_manager(kwargs['sid']) self.manager = self.driver.connection_manager(kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did']) 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 # Set the template path for the SQL scripts
self.template_path = ( self.template_path = (
"publications/sql/#{0}#".format(self.manager.version) "publications/sql/#{0}#".format(self.manager.version)

View File

@@ -140,11 +140,6 @@ def check_precondition(f):
return gone(errormsg=gettext("Could not find the server.")) return gone(errormsg=gettext("Could not find the server."))
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -571,7 +566,8 @@ It may have been removed by another user.
# Making copy of output for future use # Making copy of output for future use
copy_data = dict(res['rows'][0]) copy_data = dict(res['rows'][0])
copy_data['is_sys_obj'] = ( copy_data['is_sys_obj'] = (
copy_data['oid'] <= self.datlastsysoid or self.datistemplate) copy_data['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
copy_data = self._formatter(copy_data, scid) copy_data = self._formatter(copy_data, scid)
return ajax_response( return ajax_response(

View File

@@ -155,11 +155,6 @@ class AggregateView(PGChildNodeView):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -317,7 +312,7 @@ class AggregateView(PGChildNodeView):
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
scid=scid, agid=agid, scid=scid, agid=agid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -327,7 +322,8 @@ class AggregateView(PGChildNodeView):
return False, gone(self.not_found_error_msg()) return False, gone(self.not_found_error_msg())
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return True, res['rows'][0] return True, res['rows'][0]

View File

@@ -146,11 +146,6 @@ class CatalogObjectView(PGChildNodeView):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -306,7 +301,8 @@ class CatalogObjectView(PGChildNodeView):
gettext("""Could not find the specified catalog object.""")) gettext("""Could not find the specified catalog object."""))
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return ajax_response( return ajax_response(
response=res['rows'][0], response=res['rows'][0],

View File

@@ -173,11 +173,6 @@ class CatalogObjectColumnsView(PGChildNodeView):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -288,7 +283,7 @@ class CatalogObjectColumnsView(PGChildNodeView):
return gone(gettext("""Could not find the specified column.""")) return gone(gettext("""Could not find the specified column."""))
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['attrelid'] <= self.datlastsysoid or res['rows'][0]['attrelid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate) self.datistemplate)
return ajax_response( return ajax_response(

View File

@@ -192,11 +192,6 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -354,7 +349,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
scid=scid, coid=coid, scid=scid, coid=coid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -364,7 +359,8 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
return False, gone(self.not_found_error_msg()) return False, gone(self.not_found_error_msg())
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return True, res['rows'][0] return True, res['rows'][0]

View File

@@ -282,11 +282,6 @@ class DomainView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
# Get database connection # Get database connection
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent 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
self.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -458,7 +453,7 @@ It may have been removed by another user or moved to another schema.
# Set System Domain Status # Set System Domain Status
data['sysdomain'] = False data['sysdomain'] = False
if doid <= self.manager.db_info[did]['datlastsysoid'] or \ if doid <= self._DATABASE_LAST_SYSTEM_OID or \
self.datistemplate: self.datistemplate:
data['sysdomain'] = True data['sysdomain'] = True

View File

@@ -260,11 +260,6 @@ class DomainConstraintView(PGChildNodeView):
self.manager = driver.connection_manager(kwargs['sid']) self.manager = driver.connection_manager(kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent 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
self.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -413,7 +408,8 @@ class DomainConstraintView(PGChildNodeView):
data = res['rows'][0] data = res['rows'][0]
data['is_sys_obj'] = ( data['is_sys_obj'] = (
data['oid'] <= self.datlastsysoid or self.datistemplate) data['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return ajax_response( return ajax_response(
response=data, response=data,
status=200 status=200

View File

@@ -383,11 +383,6 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
# Get database connection # Get database connection
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent 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
self.datistemplate = \ self.datistemplate = \
self.manager.db_info[kwargs['did']]['datistemplate'] \ self.manager.db_info[kwargs['did']]['datistemplate'] \
if self.manager.db_info is not None and \ if self.manager.db_info is not None and \
@@ -1191,7 +1186,8 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
data = res['rows'][0] data = res['rows'][0]
data['is_sys_obj'] = ( data['is_sys_obj'] = (
data['oid'] <= self.datlastsysoid or self.datistemplate) data['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
if self.manager.version >= 90200: if self.manager.version >= 90200:
# Fetch privileges # Fetch privileges

View File

@@ -226,11 +226,6 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager( self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
kwargs['sid']) kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -393,7 +388,8 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
) )
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
# In edit mode fetch token/dictionary list also # In edit mode fetch token/dictionary list also
sql = render_template( sql = render_template(
@@ -782,7 +778,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
if not status: if not status:
return internal_server_error(errormsg=rset) return internal_server_error(errormsg=rset)
datlastsysoid = self.manager.db_info[did]['datlastsysoid'] datlastsysoid = self._DATABASE_LAST_SYSTEM_OID
# Empty set is added before actual list as initially it will be visible # Empty set is added before actual list as initially it will be visible
# at parser control while creating a new FTS Configuration # at parser control while creating a new FTS Configuration
@@ -817,7 +813,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
if not status: if not status:
return internal_server_error(errormsg=rset) return internal_server_error(errormsg=rset)
datlastsysoid = self.manager.db_info[did]['datlastsysoid'] datlastsysoid = self._DATABASE_LAST_SYSTEM_OID
# Empty set is added before actual list as initially it will be visible # Empty set is added before actual list as initially it will be visible
# at copy_config control while creating a new FTS Configuration # at copy_config control while creating a new FTS Configuration

View File

@@ -215,11 +215,6 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
driver = get_driver(PG_DEFAULT_DRIVER) driver = get_driver(PG_DEFAULT_DRIVER)
self.qtIdent = driver.qtIdent 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
self.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -401,7 +396,8 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
)) ))
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
# Handle templates and its schema name properly # Handle templates and its schema name properly
if res['rows'][0]['template_schema'] is not None and \ if res['rows'][0]['template_schema'] is not None and \

View File

@@ -229,11 +229,6 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager( self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
kwargs['sid']) kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -358,7 +353,8 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
_("Could not find the FTS Parser node in the database node.")) _("Could not find the FTS Parser node in the database node."))
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return True, res['rows'][0] return True, res['rows'][0]
@check_precondition @check_precondition

View File

@@ -209,11 +209,6 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager( self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
kwargs['sid']) kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -332,7 +327,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
if len(res['rows']) == 0: if len(res['rows']) == 0:
return False, gone(self.not_found_error_msg()) return False, gone(self.not_found_error_msg())
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return True, res['rows'][0] return True, res['rows'][0]
@check_precondition @check_precondition

View File

@@ -1609,12 +1609,12 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
# Set System Functions Status # Set System Functions Status
resp_data['sysfunc'] = False resp_data['sysfunc'] = False
if fnid <= self.manager.db_info[did]['datlastsysoid']: if fnid <= self._DATABASE_LAST_SYSTEM_OID:
resp_data['sysfunc'] = True resp_data['sysfunc'] = True
# Set System Functions Status # Set System Functions Status
resp_data['sysproc'] = False resp_data['sysproc'] = False
if fnid <= self.manager.db_info[did]['datlastsysoid']: if fnid <= self._DATABASE_LAST_SYSTEM_OID:
resp_data['sysproc'] = True resp_data['sysproc'] = True
# Get formatted Security Labels # Get formatted Security Labels

View File

@@ -154,11 +154,6 @@ class OperatorView(PGChildNodeView):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -316,7 +311,7 @@ class OperatorView(PGChildNodeView):
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
scid=scid, opid=opid, scid=scid, opid=opid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -326,7 +321,8 @@ class OperatorView(PGChildNodeView):
return False, gone(self.not_found_error_msg()) return False, gone(self.not_found_error_msg())
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return True, res['rows'][0] return True, res['rows'][0]

View File

@@ -139,10 +139,6 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
else: else:
self.conn = self.manager.connection() 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -320,7 +316,8 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
return False, gone(self.not_found_error_msg()) return False, gone(self.not_found_error_msg())
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
for row in res['rows']: for row in res['rows']:
sql = render_template( sql = render_template(

View File

@@ -206,10 +206,6 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
) )
) )
self.datlastsysoid = \
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
if self.manager.db_info is not None and \
kwargs['did'] in self.manager.db_info else 0
self.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -428,7 +424,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
return False, gone(self.not_found_error_msg()) return False, gone(self.not_found_error_msg())
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate) self.datistemplate)
return True, res['rows'][0] return True, res['rows'][0]
except Exception as e: except Exception as e:

View File

@@ -306,7 +306,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
SQL = render_template( SQL = render_template(
"/".join([self.table_template_path, self._PROPERTIES_SQL]), "/".join([self.table_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, did=did, scid=scid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -1059,7 +1059,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
SQL = render_template( SQL = render_template(
"/".join([self.table_template_path, self._PROPERTIES_SQL]), "/".join([self.table_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1111,7 +1111,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
SQL = render_template( SQL = render_template(
"/".join([self.table_template_path, self._PROPERTIES_SQL]), "/".join([self.table_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1150,7 +1150,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
SQL = render_template( SQL = render_template(
"/".join([self.table_template_path, self._PROPERTIES_SQL]), "/".join([self.table_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1219,7 +1219,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
SQL = render_template( SQL = render_template(
"/".join([self.table_template_path, self._PROPERTIES_SQL]), "/".join([self.table_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1369,7 +1369,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
SQL = render_template( SQL = render_template(
"/".join([self.table_template_path, self._PROPERTIES_SQL]), "/".join([self.table_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1417,7 +1417,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
SQL = render_template( SQL = render_template(
"/".join([self.table_template_path, self._PROPERTIES_SQL]), "/".join([self.table_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1468,7 +1468,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
SQL = render_template( SQL = render_template(
"/".join([self.table_template_path, self._PROPERTIES_SQL]), "/".join([self.table_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1521,7 +1521,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
SQL = render_template( SQL = render_template(
"/".join([self.table_template_path, self._PROPERTIES_SQL]), "/".join([self.table_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1601,7 +1601,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
SQL = render_template("/".join( SQL = render_template("/".join(
[self.table_template_path, self._PROPERTIES_SQL]), [self.table_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
sql = '' sql = ''

View File

@@ -263,13 +263,6 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
# We need datlastsysoid to check if current compound trigger
# is system trigger
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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -451,7 +444,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
tid=tid, trid=trid, tid=tid, trid=trid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -575,10 +568,10 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
# We will first fetch the compound trigger name for # We will first fetch the compound trigger name for
# current request so that we create template for # current request so that we create template for
# dropping compound trigger # dropping compound trigger
SQL = render_template("/".join([self.template_path, SQL = render_template(
self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
tid=tid, trid=trid, tid=tid, trid=trid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -637,7 +630,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
data['table'] = self.table data['table'] = self.table
SQL, name = compound_trigger_utils.get_sql( SQL, name = compound_trigger_utils.get_sql(
self.conn, data, tid, trid, self.datlastsysoid) self.conn, data, tid, trid, self._DATABASE_LAST_SYSTEM_OID)
if not isinstance(SQL, str): if not isinstance(SQL, str):
return SQL return SQL
SQL = SQL.strip('\n').strip(' ') SQL = SQL.strip('\n').strip(' ')
@@ -659,7 +652,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
tid=tid, trid=new_trid, tid=tid, trid=new_trid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -716,7 +709,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
try: try:
sql, name = compound_trigger_utils.get_sql( sql, name = compound_trigger_utils.get_sql(
self.conn, data, tid, trid, self.datlastsysoid) self.conn, data, tid, trid, self._DATABASE_LAST_SYSTEM_OID)
if not isinstance(sql, str): if not isinstance(sql, str):
return sql return sql
sql = sql.strip('\n').strip(' ') sql = sql.strip('\n').strip(' ')
@@ -747,7 +740,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
try: try:
SQL = compound_trigger_utils.get_reverse_engineered_sql( SQL = compound_trigger_utils.get_reverse_engineered_sql(
self.conn, schema=self.schema, table=self.table, tid=tid, self.conn, schema=self.schema, table=self.table, tid=tid,
trid=trid, datlastsysoid=self.datlastsysoid) trid=trid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
except Exception as e: except Exception as e:
return internal_server_error(errormsg=str(e)) return internal_server_error(errormsg=str(e))
@@ -780,7 +773,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
tid=tid, trid=trid, tid=tid, trid=trid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -885,10 +878,8 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
target_schema = kwargs.get('target_schema', None) target_schema = kwargs.get('target_schema', None)
if data: if data:
sql, name = compound_trigger_utils.get_sql(self.conn, sql, name = compound_trigger_utils.get_sql(
data, self.conn, data, tid, oid, self._DATABASE_LAST_SYSTEM_OID)
tid, oid,
self.datlastsysoid)
if not isinstance(sql, str): if not isinstance(sql, str):
return sql return sql
sql = sql.strip('\n').strip(' ') sql = sql.strip('\n').strip(' ')
@@ -898,10 +889,10 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
scid=scid, tid=tid, scid=scid, tid=tid,
trid=oid, only_sql=True) trid=oid, only_sql=True)
else: else:
sql = render_template("/".join([self.template_path, sql = render_template(
self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
tid=tid, trid=oid, tid=tid, trid=oid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
if not status: if not status:
@@ -935,11 +926,8 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
if target_schema: if target_schema:
data['schema'] = target_schema data['schema'] = target_schema
sql, name = compound_trigger_utils.get_sql(self.conn, sql, name = compound_trigger_utils.get_sql(
data, self.conn, data, tid, None, self._DATABASE_LAST_SYSTEM_OID)
tid,
None,
self.datlastsysoid)
# If compound trigger is disbaled then add sql # If compound trigger is disbaled then add sql
# code for the same # code for the same

View File

@@ -196,11 +196,6 @@ class CheckConstraintView(PGChildNodeView):
self.manager = driver.connection_manager(kwargs['sid']) self.manager = driver.connection_manager(kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent 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
self.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -449,7 +444,8 @@ class CheckConstraintView(PGChildNodeView):
if cid: if cid:
result = res[0] result = res[0]
result['is_sys_obj'] = ( result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid or self.datistemplate) result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return ajax_response( return ajax_response(
response=result, response=result,

View File

@@ -222,11 +222,6 @@ class ExclusionConstraintView(PGChildNodeView):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -285,7 +280,8 @@ class ExclusionConstraintView(PGChildNodeView):
if exid: if exid:
result = res[0] result = res[0]
result['is_sys_obj'] = ( result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid or self.datistemplate) result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return ajax_response( return ajax_response(
response=result, response=result,

View File

@@ -229,11 +229,6 @@ class ForeignKeyConstraintView(PGChildNodeView):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -288,7 +283,8 @@ class ForeignKeyConstraintView(PGChildNodeView):
if fkid: if fkid:
result = res[0] result = res[0]
result['is_sys_obj'] = ( result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid or self.datistemplate) result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return ajax_response( return ajax_response(
response=result, response=result,

View File

@@ -242,11 +242,6 @@ class IndexConstraintView(PGChildNodeView):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) 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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -304,7 +299,8 @@ class IndexConstraintView(PGChildNodeView):
if cid: if cid:
result = res[0] result = res[0]
result['is_sys_obj'] = ( result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid or self.datistemplate) result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return ajax_response( return ajax_response(
response=result, response=result,

View File

@@ -246,12 +246,6 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
# We need datlastsysoid to check if current index is system index
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.table_template_path = compile_template_path( self.table_template_path = compile_template_path(
'tables/sql', 'tables/sql',
self.manager.server_type, self.manager.server_type,
@@ -514,7 +508,8 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
SQL = render_template( SQL = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
did=did, tid=tid, idx=idx, datlastsysoid=self.datlastsysoid did=did, tid=tid, idx=idx,
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -700,7 +695,8 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
# so that we create template for dropping index # so that we create template for dropping index
SQL = render_template( SQL = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
did=did, tid=tid, idx=idx, datlastsysoid=self.datlastsysoid did=did, tid=tid, idx=idx,
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -757,7 +753,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
try: try:
SQL, name = index_utils.get_sql( SQL, name = index_utils.get_sql(
self.conn, data=data, did=did, tid=tid, idx=idx, self.conn, data=data, did=did, tid=tid, idx=idx,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
if not isinstance(SQL, str): if not isinstance(SQL, str):
return SQL return SQL
SQL = SQL.strip('\n').strip(' ') SQL = SQL.strip('\n').strip(' ')
@@ -808,7 +804,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
try: try:
sql, name = index_utils.get_sql( sql, name = index_utils.get_sql(
self.conn, data=data, did=did, tid=tid, idx=idx, self.conn, data=data, did=did, tid=tid, idx=idx,
datlastsysoid=self.datlastsysoid, mode='create') datlastsysoid=self._DATABASE_LAST_SYSTEM_OID, mode='create')
if not isinstance(sql, str): if not isinstance(sql, str):
return sql return sql
sql = sql.strip('\n').strip(' ') sql = sql.strip('\n').strip(' ')
@@ -837,7 +833,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = index_utils.get_reverse_engineered_sql( SQL = index_utils.get_reverse_engineered_sql(
self.conn, schema=self.schema, table=self.table, did=did, self.conn, schema=self.schema, table=self.table, did=did,
tid=tid, idx=idx, datlastsysoid=self.datlastsysoid, tid=tid, idx=idx, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
add_not_exists_clause=True add_not_exists_clause=True
) )
@@ -868,7 +864,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
sql, name = index_utils.get_sql( sql, name = index_utils.get_sql(
self.conn, data=data, did=did, tid=tid, idx=idx, self.conn, data=data, did=did, tid=tid, idx=idx,
datlastsysoid=self.datlastsysoid, mode='create') datlastsysoid=self._DATABASE_LAST_SYSTEM_OID, mode='create')
sql = sql.strip('\n').strip(' ') sql = sql.strip('\n').strip(' ')
@@ -876,7 +872,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
sql = index_utils.get_reverse_engineered_sql( sql = index_utils.get_reverse_engineered_sql(
self.conn, schema=target_schema, self.conn, schema=target_schema,
table=self.table, did=did, tid=tid, idx=idx, table=self.table, did=did, tid=tid, idx=idx,
datlastsysoid=self.datlastsysoid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
template_path=None, with_header=False, template_path=None, with_header=False,
add_not_exists_clause=True add_not_exists_clause=True
) )
@@ -973,7 +969,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = render_template( SQL = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
did=did, tid=tid, idx=idx, did=did, tid=tid, idx=idx,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:

View File

@@ -263,7 +263,7 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.partition_template_path, SQL = render_template("/".join([self.partition_template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -372,7 +372,8 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.partition_template_path, SQL = render_template("/".join([self.partition_template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
ptid=ptid, datlastsysoid=self.datlastsysoid) ptid=ptid,
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)
@@ -408,7 +409,8 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.partition_template_path, SQL = render_template("/".join([self.partition_template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
ptid=ptid, datlastsysoid=self.datlastsysoid) ptid=ptid,
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, result = self.conn.execute_dict(SQL) status, result = self.conn.execute_dict(SQL)
if not status: if not status:
current_app.logger.error(result) current_app.logger.error(result)
@@ -428,11 +430,11 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
return False return False
for row in partitions['rows']: for row in partitions['rows']:
SQL = render_template("/".join([self.partition_template_path, SQL = render_template(
self._PROPERTIES_SQL]), "/".join([self.partition_template_path,
did=did, scid=scid, tid=tid, self._PROPERTIES_SQL]),
ptid=row['oid'], did=did, scid=scid, tid=tid, ptid=row['oid'],
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, result = self.conn.execute_dict(SQL) status, result = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -712,7 +714,8 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.partition_template_path, SQL = render_template("/".join([self.partition_template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
ptid=ptid, datlastsysoid=self.datlastsysoid) ptid=ptid,
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)
@@ -750,7 +753,7 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
"/".join([self.partition_template_path, "/".join([self.partition_template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, ptid=ptid, did=did, scid=scid, tid=tid, ptid=ptid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -804,7 +807,7 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
SQL = render_template( SQL = render_template(
"/".join([self.partition_template_path, self._PROPERTIES_SQL]), "/".join([self.partition_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, ptid=ptid, did=did, scid=scid, tid=tid, ptid=ptid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:

View File

@@ -198,10 +198,6 @@ class RowSecurityView(PGChildNodeView):
schema, table = row_security_policies_utils.get_parent(self.conn, schema, table = row_security_policies_utils.get_parent(self.conn,
kwargs[ kwargs[
'tid']) 'tid'])
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.schema = schema self.schema = schema
self.table = table self.table = table
# Set template path for the sql scripts # Set template path for the sql scripts
@@ -315,7 +311,7 @@ class RowSecurityView(PGChildNodeView):
sql = render_template("/".join( sql = render_template("/".join(
[self.template_path, self._PROPERTIES_SQL] [self.template_path, self._PROPERTIES_SQL]
), plid=plid, scid=scid, policy_table_id=tid, ), plid=plid, scid=scid, policy_table_id=tid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
if not status: if not status:
@@ -555,7 +551,8 @@ class RowSecurityView(PGChildNodeView):
SQL = row_security_policies_utils.get_reverse_engineered_sql( SQL = row_security_policies_utils.get_reverse_engineered_sql(
self.conn, schema=self.schema, table=self.table, scid=scid, self.conn, schema=self.schema, table=self.table, scid=scid,
plid=plid, policy_table_id=tid, datlastsysoid=self.datlastsysoid) plid=plid, policy_table_id=tid,
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
return ajax_response(response=SQL) return ajax_response(response=SQL)
@@ -632,7 +629,8 @@ class RowSecurityView(PGChildNodeView):
sql = row_security_policies_utils.get_reverse_engineered_sql( sql = row_security_policies_utils.get_reverse_engineered_sql(
self.conn, schema=schema, table=self.table, scid=scid, self.conn, schema=schema, table=self.table, scid=scid,
plid=oid, policy_table_id=tid, plid=oid, policy_table_id=tid,
datlastsysoid=self.datlastsysoid, with_header=False) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
with_header=False)
drop_sql = '' drop_sql = ''
if drop_req: if drop_req:

View File

@@ -197,10 +197,6 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
self.manager = get_driver( self.manager = get_driver(
PG_DEFAULT_DRIVER).connection_manager(kwargs['sid']) PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did']) 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 = 'rules/sql' self.template_path = 'rules/sql'
self.table_template_path = compile_template_path( self.table_template_path = compile_template_path(
'tables/sql', 'tables/sql',
@@ -310,7 +306,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
SQL = render_template("/".join( SQL = render_template("/".join(
[self.template_path, self._PROPERTIES_SQL] [self.template_path, self._PROPERTIES_SQL]
), rid=rid, datlastsysoid=self.datlastsysoid) ), rid=rid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:

View File

@@ -11,6 +11,7 @@ import os
from regression.python_test_utils.template_helper import file_as_template from regression.python_test_utils.template_helper import file_as_template
from regression.python_test_utils.sql_template_test_base import \ from regression.python_test_utils.sql_template_test_base import \
SQLTemplateTestBase SQLTemplateTestBase
from pgadmin.utils.constants import DATABASE_LAST_SYSTEM_OID
class TestTablesPropertiesSql(SQLTemplateTestBase): class TestTablesPropertiesSql(SQLTemplateTestBase):
@@ -46,7 +47,7 @@ class TestTablesPropertiesSql(SQLTemplateTestBase):
public_schema_id = 2200 public_schema_id = 2200
sql = template.render(scid=public_schema_id, sql = template.render(scid=public_schema_id,
did=self.database_id, did=self.database_id,
datlastsysoid=self.last_system_oid, datlastsysoid=DATABASE_LAST_SYSTEM_OID,
tid=self.table_id tid=self.table_id
) )
return sql return sql
@@ -54,12 +55,12 @@ class TestTablesPropertiesSql(SQLTemplateTestBase):
def test_setup(self, connection, cursor): def test_setup(self, connection, cursor):
cursor.execute(""" cursor.execute("""
SELECT SELECT
db.oid as did, datlastsysoid db.oid as did
FROM FROM
pg_catalog.pg_database db pg_catalog.pg_database db
WHERE db.datname = '{0}'""".format(self.database_name) WHERE db.datname = '{0}'""".format(self.database_name)
) )
self.database_id, self.last_system_oid = cursor.fetchone() self.database_id = cursor.fetchone()[0]
cursor.execute("SELECT oid FROM pg_catalog.pg_class where relname=" cursor.execute("SELECT oid FROM pg_catalog.pg_class where relname="
"'test_table'") "'test_table'")

View File

@@ -262,13 +262,6 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
# We need datlastsysoid to check if current trigger is system
# trigger
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 # we will set template path for sql scripts
self.table_template_path = compile_template_path( self.table_template_path = compile_template_path(
'tables/sql', 'tables/sql',
@@ -543,7 +536,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
tid=tid, trid=trid, tid=tid, trid=trid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -668,10 +661,10 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
for trid in data['ids']: for trid in data['ids']:
# We will first fetch the trigger name for current request # We will first fetch the trigger name for current request
# so that we create template for dropping trigger # so that we create template for dropping trigger
SQL = render_template("/".join([self.template_path, SQL = render_template(
self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
tid=tid, trid=trid, tid=tid, trid=trid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -730,7 +723,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
SQL, name = trigger_utils.get_sql( SQL, name = trigger_utils.get_sql(
self.conn, data=data, tid=tid, trid=trid, self.conn, data=data, tid=tid, trid=trid,
datlastsysoid=self.datlastsysoid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_system_objects=self.blueprint.show_system_objects) show_system_objects=self.blueprint.show_system_objects)
if not isinstance(SQL, str): if not isinstance(SQL, str):
@@ -754,7 +747,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
tid=tid, trid=new_trid, tid=tid, trid=new_trid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -812,7 +805,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
try: try:
sql, name = trigger_utils.get_sql( sql, name = trigger_utils.get_sql(
self.conn, data=data, tid=tid, trid=trid, self.conn, data=data, tid=tid, trid=trid,
datlastsysoid=self.datlastsysoid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_system_objects=self.blueprint.show_system_objects) show_system_objects=self.blueprint.show_system_objects)
if not isinstance(sql, str): if not isinstance(sql, str):
return sql return sql
@@ -843,7 +836,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = trigger_utils.get_reverse_engineered_sql( SQL = trigger_utils.get_reverse_engineered_sql(
self.conn, schema=self.schema, table=self.table, tid=tid, self.conn, schema=self.schema, table=self.table, tid=tid,
trid=trid, datlastsysoid=self.datlastsysoid, trid=trid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_system_objects=self.blueprint.show_system_objects) show_system_objects=self.blueprint.show_system_objects)
return ajax_response(response=SQL) return ajax_response(response=SQL)
@@ -868,7 +861,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
if data: if data:
SQL, name = trigger_utils.get_sql( SQL, name = trigger_utils.get_sql(
self.conn, data=data, tid=tid, trid=oid, self.conn, data=data, tid=tid, trid=oid,
datlastsysoid=self.datlastsysoid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_system_objects=self.blueprint.show_system_objects, show_system_objects=self.blueprint.show_system_objects,
is_schema_diff=True) is_schema_diff=True)
@@ -887,7 +880,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = trigger_utils.get_reverse_engineered_sql( SQL = trigger_utils.get_reverse_engineered_sql(
self.conn, schema=schema, table=self.table, tid=tid, self.conn, schema=schema, table=self.table, tid=tid,
trid=oid, datlastsysoid=self.datlastsysoid, trid=oid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_system_objects=self.blueprint.show_system_objects, show_system_objects=self.blueprint.show_system_objects,
template_path=None, with_header=False) template_path=None, with_header=False)
@@ -918,7 +911,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
tid=tid, trid=trid, tid=tid, trid=trid,
datlastsysoid=self.datlastsysoid) datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:

View File

@@ -113,11 +113,6 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent self.qtIdent = driver.qtIdent
self.qtTypeIdent = driver.qtTypeIdent self.qtTypeIdent = driver.qtTypeIdent
# We need datlastsysoid to check if current table is system table
self.datlastsysoid = self.manager.db_info[
did
]['datlastsysoid'] if self.manager.db_info is not None and \
did in self.manager.db_info else 0
ver = self.manager.version ver = self.manager.version
server_type = self.manager.server_type server_type = self.manager.server_type
@@ -577,7 +572,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
sql = render_template( sql = render_template(
"/".join([self.table_template_path, self._PROPERTIES_SQL]), "/".join([self.table_template_path, self._PROPERTIES_SQL]),
did=did, scid=scid, tid=tid, did=did, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
if not status: if not status:
@@ -748,7 +743,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
index_sql = index_utils.get_reverse_engineered_sql( index_sql = index_utils.get_reverse_engineered_sql(
self.conn, schema=schema, table=table, did=did, tid=tid, self.conn, schema=schema, table=table, did=did, tid=tid,
idx=row['oid'], datlastsysoid=self.datlastsysoid, idx=row['oid'], datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
template_path=None, with_header=json_resp, template_path=None, with_header=json_resp,
add_not_exists_clause=add_not_exists_clause add_not_exists_clause=add_not_exists_clause
) )
@@ -780,7 +775,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
get_reverse_engineered_sql( get_reverse_engineered_sql(
self.conn, schema=schema, table=table, scid=scid, self.conn, schema=schema, table=table, scid=scid,
plid=row['oid'], policy_table_id=tid, plid=row['oid'], policy_table_id=tid,
datlastsysoid=self.datlastsysoid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
template_path=None, with_header=json_resp) template_path=None, with_header=json_resp)
policy_sql = "\n" + policy_sql policy_sql = "\n" + policy_sql
@@ -806,7 +801,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
for row in rset['rows']: for row in rset['rows']:
trigger_sql = trigger_utils.get_reverse_engineered_sql( trigger_sql = trigger_utils.get_reverse_engineered_sql(
self.conn, schema=schema, table=table, tid=tid, self.conn, schema=schema, table=table, tid=tid,
trid=row['oid'], datlastsysoid=self.datlastsysoid, trid=row['oid'], datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_system_objects=self.blueprint.show_system_objects, show_system_objects=self.blueprint.show_system_objects,
template_path=None, with_header=json_resp) template_path=None, with_header=json_resp)
trigger_sql = "\n" + trigger_sql trigger_sql = "\n" + trigger_sql
@@ -837,7 +832,8 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
compound_trigger_sql = \ compound_trigger_sql = \
compound_trigger_utils.get_reverse_engineered_sql( compound_trigger_utils.get_reverse_engineered_sql(
self.conn, schema=schema, table=table, tid=tid, self.conn, schema=schema, table=table, tid=tid,
trid=row['oid'], datlastsysoid=self.datlastsysoid) trid=row['oid'],
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
compound_trigger_sql = "\n" + compound_trigger_sql compound_trigger_sql = "\n" + compound_trigger_sql
# Add into main sql # Add into main sql
@@ -864,7 +860,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
rules_sql = '\n' rules_sql = '\n'
sql = render_template("/".join( sql = render_template("/".join(
[self.rules_template_path, self._PROPERTIES_SQL] [self.rules_template_path, self._PROPERTIES_SQL]
), rid=row['oid'], datlastsysoid=self.datlastsysoid) ), rid=row['oid'], datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
if not status: if not status:

View File

@@ -4,7 +4,7 @@ SELECT
WHEN 'S' THEN 'defseqacl' WHEN 'S' THEN 'defseqacl'
WHEN 'f' THEN 'deffuncacl' WHEN 'f' THEN 'deffuncacl'
WHEN 'T' THEN 'deftypeacl' WHEN 'T' THEN 'deftypeacl'
ELSE 'UNKNOWN - ' || a.deftype ELSE 'UNKNOWN - ' || a.deftype::text
END AS deftype, END AS deftype,
COALESCE(gt.rolname, 'PUBLIC') grantee, g.rolname grantor, pg_catalog.array_agg(a.privilege_type) as privileges, pg_catalog.array_agg(a.is_grantable) as grantable COALESCE(gt.rolname, 'PUBLIC') grantee, g.rolname grantor, pg_catalog.array_agg(a.privilege_type) as privileges, pg_catalog.array_agg(a.is_grantable) as grantable
FROM FROM

View File

@@ -3,7 +3,7 @@ SELECT
WHEN 'r' THEN 'deftblacl' WHEN 'r' THEN 'deftblacl'
WHEN 'S' THEN 'defseqacl' WHEN 'S' THEN 'defseqacl'
WHEN 'f' THEN 'deffuncacl' WHEN 'f' THEN 'deffuncacl'
ELSE 'UNKNOWN - ' || a.deftype ELSE 'UNKNOWN - ' || a.deftype::text
END AS deftype, END AS deftype,
COALESCE(gt.rolname, 'PUBLIC') grantee, g.rolname grantor, pg_catalog.array_agg(a.privilege_type) as privileges, pg_catalog.array_agg(a.is_grantable) as grantable COALESCE(gt.rolname, 'PUBLIC') grantee, g.rolname grantor, pg_catalog.array_agg(a.privilege_type) as privileges, pg_catalog.array_agg(a.is_grantable) as grantable
FROM FROM

View File

@@ -3,7 +3,7 @@ SELECT
WHEN 'r' THEN 'deftblacl' WHEN 'r' THEN 'deftblacl'
WHEN 'S' THEN 'defseqacl' WHEN 'S' THEN 'defseqacl'
WHEN 'f' THEN 'deffuncacl' WHEN 'f' THEN 'deffuncacl'
ELSE 'UNKNOWN - ' || a.deftype ELSE 'UNKNOWN - ' || a.deftype::text
END AS deftype, END AS deftype,
COALESCE(gt.rolname, 'PUBLIC') grantee, g.rolname grantor, pg_catalog.array_agg(a.privilege_type) as privileges, pg_catalog.array_agg(a.is_grantable) as grantable COALESCE(gt.rolname, 'PUBLIC') grantee, g.rolname grantor, pg_catalog.array_agg(a.privilege_type) as privileges, pg_catalog.array_agg(a.is_grantable) as grantable
FROM FROM

View File

@@ -4,7 +4,7 @@ SELECT
WHEN 'S' THEN 'defseqacl' WHEN 'S' THEN 'defseqacl'
WHEN 'f' THEN 'deffuncacl' WHEN 'f' THEN 'deffuncacl'
WHEN 'T' THEN 'deftypeacl' WHEN 'T' THEN 'deftypeacl'
ELSE 'UNKNOWN - ' || a.deftype ELSE 'UNKNOWN - ' || a.deftype::text
END AS deftype, END AS deftype,
COALESCE(gt.rolname, 'PUBLIC') grantee, COALESCE(gt.rolname, 'PUBLIC') grantee,
g.rolname grantor, g.rolname grantor,

View File

@@ -235,15 +235,6 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
kwargs['sid']) kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
# We need datlastsysoid to check if current type is system type
self.datlastsysoid = 0
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info
):
self.datlastsysoid = self.manager.db_info[kwargs['did']][
'datlastsysoid']
# Declare allows acl on type # Declare allows acl on type
self.acl = ['U'] self.acl = ['U']
@@ -278,7 +269,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
SQL = render_template( SQL = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
scid=scid, scid=scid,
datlastsysoid=self.datlastsysoid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_system_objects=self.blueprint.show_system_objects) show_system_objects=self.blueprint.show_system_objects)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -604,7 +595,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
"/".join([self.template_path, "/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
scid=scid, tid=tid, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_system_objects=self.blueprint.show_system_objects show_system_objects=self.blueprint.show_system_objects
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -1157,7 +1148,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
"/".join([self.template_path, "/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
scid=scid, tid=tid, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_system_objects=self.blueprint.show_system_objects show_system_objects=self.blueprint.show_system_objects
) )
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
@@ -1363,7 +1354,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
"/".join([self.template_path, "/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
scid=scid, tid=tid, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_system_objects=self.blueprint.show_system_objects show_system_objects=self.blueprint.show_system_objects
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -1431,7 +1422,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
"/".join([self.template_path, "/".join([self.template_path,
self._PROPERTIES_SQL]), self._PROPERTIES_SQL]),
scid=scid, tid=tid, scid=scid, tid=tid,
datlastsysoid=self.datlastsysoid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
show_system_objects=self.blueprint.show_system_objects show_system_objects=self.blueprint.show_system_objects
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -1551,7 +1542,8 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
res = dict() res = dict()
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), self._NODES_SQL]),
scid=scid, datlastsysoid=self.datlastsysoid, scid=scid,
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
schema_diff=True) schema_diff=True)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:

View File

@@ -226,14 +226,6 @@ def check_precondition(f):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection(did=kwargs['did']) self.conn = self.manager.connection(did=kwargs['did'])
self.datlastsysoid = 0
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info
):
self.datlastsysoid = self.manager.db_info[kwargs['did']][
'datlastsysoid']
# Set template path for sql scripts # Set template path for sql scripts
if self.manager.server_type == 'ppas': if self.manager.server_type == 'ppas':
_temp = self.ppas_template_path(self.manager.version) _temp = self.ppas_template_path(self.manager.version)
@@ -401,7 +393,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
""" """
SQL = render_template("/".join( SQL = render_template("/".join(
[self.template_path, self._SQL_PREFIX + self._NODES_SQL]), [self.template_path, self._SQL_PREFIX + self._NODES_SQL]),
vid=vid, datlastsysoid=self.datlastsysoid) vid=vid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:
return internal_server_error(errormsg=rset) return internal_server_error(errormsg=rset)
@@ -474,7 +466,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
""" """
SQL = render_template("/".join( SQL = render_template("/".join(
[self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL] [self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL]
), vid=vid, datlastsysoid=self.datlastsysoid) ), vid=vid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
return False, internal_server_error(errormsg=res) return False, internal_server_error(errormsg=res)
@@ -649,7 +641,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
self._SQL_PREFIX + self._PROPERTIES_SQL]), self._SQL_PREFIX + self._PROPERTIES_SQL]),
did=did, did=did,
vid=vid, vid=vid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res_data = self.conn.execute_dict(SQL) status, res_data = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -774,7 +766,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
[self.template_path, [self.template_path,
self._SQL_PREFIX + self._PROPERTIES_SQL]), self._SQL_PREFIX + self._PROPERTIES_SQL]),
vid=vid, vid=vid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
if not status: if not status:
@@ -1371,7 +1363,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
SQL = render_template("/".join( SQL = render_template("/".join(
[self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL]), [self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL]),
vid=vid, vid=vid,
datlastsysoid=self.datlastsysoid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
@@ -1534,7 +1526,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL
]), ]),
scid=scid, vid=vid, did=did, scid=scid, vid=vid, did=did,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1548,7 +1540,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
self.column_template_path, self._PROPERTIES_SQL self.column_template_path, self._PROPERTIES_SQL
]), ]),
scid=scid, tid=vid, scid=scid, tid=vid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, data = self.conn.execute_dict(SQL) status, data = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1593,7 +1585,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL
]), ]),
scid=scid, vid=vid, did=did, scid=scid, vid=vid, did=did,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1608,7 +1600,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
self.column_template_path, self._PROPERTIES_SQL self.column_template_path, self._PROPERTIES_SQL
]), ]),
scid=scid, tid=vid, scid=scid, tid=vid,
datlastsysoid=self.datlastsysoid datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, data = self.conn.execute_dict(SQL) status, data = self.conn.execute_dict(SQL)
if not status: if not status:
@@ -1653,7 +1645,8 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
if not oid: if not oid:
SQL = render_template("/".join( SQL = render_template("/".join(
[self.template_path, self._SQL_PREFIX + self._NODES_SQL]), [self.template_path, self._SQL_PREFIX + self._NODES_SQL]),
did=did, scid=scid, datlastsysoid=self.datlastsysoid, did=did, scid=scid,
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
schema_diff=True) schema_diff=True)
status, views = self.conn.execute_2darray(SQL) status, views = self.conn.execute_2darray(SQL)
if not status: if not status:
@@ -2063,7 +2056,7 @@ class MViewNode(ViewNode, VacuumSettings):
""" """
SQL = render_template("/".join( SQL = render_template("/".join(
[self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL] [self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL]
), did=did, vid=vid, datlastsysoid=self.datlastsysoid) ), did=did, vid=vid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
status, res = self.conn.execute_dict(SQL) status, res = self.conn.execute_dict(SQL)
if not status: if not status:
return False, internal_server_error(errormsg=res) return False, internal_server_error(errormsg=res)
@@ -2287,7 +2280,7 @@ class MViewNode(ViewNode, VacuumSettings):
res = dict() res = dict()
SQL = render_template("/".join( SQL = render_template("/".join(
[self.template_path, self._SQL_PREFIX + self._NODES_SQL]), [self.template_path, self._SQL_PREFIX + self._NODES_SQL]),
did=did, scid=scid, datlastsysoid=self.datlastsysoid, did=did, scid=scid, datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
schema_diff=True) schema_diff=True)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:

View File

@@ -231,10 +231,6 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
self.driver = get_driver(PG_DEFAULT_DRIVER) self.driver = get_driver(PG_DEFAULT_DRIVER)
self.manager = self.driver.connection_manager(kwargs['sid']) self.manager = self.driver.connection_manager(kwargs['sid'])
self.conn = self.manager.connection(did=kwargs['did']) 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 # Set the template path for the SQL scripts
self.template_path = ( self.template_path = (
"subscriptions/sql/#{0}#".format(self.manager.version) "subscriptions/sql/#{0}#".format(self.manager.version)

View File

@@ -32,7 +32,7 @@ FROM pg_catalog.pg_database db
WHERE {% if did %} WHERE {% if did %}
db.oid = {{ did|qtLiteral }}::OID{% else %}{% if name %} db.oid = {{ did|qtLiteral }}::OID{% else %}{% if name %}
db.datname = {{ name|qtLiteral }}::text{% else %} db.datname = {{ name|qtLiteral }}::text{% else %}
db.oid > {{ last_system_oid|qtLiteral }}::OID db.oid > {{ last_system_oid|qtLiteral }}::OID OR db.datname IN ('postgres', 'edb')
{% endif %}{% endif %} {% endif %}{% endif %}
{% if db_restrictions %} {% if db_restrictions %}

View File

@@ -39,7 +39,7 @@ FROM pg_catalog.pg_database db
WHERE {% if did %} WHERE {% if did %}
db.oid = {{ did|qtLiteral }}::OID{% else %}{% if name %} db.oid = {{ did|qtLiteral }}::OID{% else %}{% if name %}
db.datname = {{ name|qtLiteral }}::text{% else %} db.datname = {{ name|qtLiteral }}::text{% else %}
db.oid > {{ last_system_oid|qtLiteral }}::OID db.oid > {{ last_system_oid|qtLiteral }}::OID OR db.datname IN ('postgres', 'edb')
{% endif %}{% endif %} {% endif %}{% endif %}
{% if db_restrictions %} {% if db_restrictions %}

View File

@@ -6,7 +6,7 @@ FROM
LEFT OUTER JOIN pg_catalog.pg_tablespace ta ON db.dattablespace = ta.oid LEFT OUTER JOIN pg_catalog.pg_tablespace ta ON db.dattablespace = ta.oid
WHERE {% if did %} WHERE {% if did %}
db.oid = {{ did|qtLiteral }}::OID{% else %} db.oid = {{ did|qtLiteral }}::OID{% else %}
db.oid > {{ last_system_oid }}::OID db.oid > {{ last_system_oid }}::OID OR db.datname IN ('postgres', 'edb')
{% endif %} {% endif %}
{% if db_restrictions %} {% if db_restrictions %}

View File

@@ -23,7 +23,7 @@ FROM pg_catalog.pg_database db
WHERE {% if did %} WHERE {% if did %}
db.oid = {{ did|qtLiteral }}::OID{% else %}{% if name %} db.oid = {{ did|qtLiteral }}::OID{% else %}{% if name %}
db.datname = {{ name|qtLiteral }}::text{% else %} db.datname = {{ name|qtLiteral }}::text{% else %}
db.oid > {{ last_system_oid|qtLiteral }}::OID db.oid > {{ last_system_oid|qtLiteral }}::OID OR db.datname IN ('postgres', 'edb')
{% endif %}{% endif %} {% endif %}{% endif %}
{% if db_restrictions %} {% if db_restrictions %}

View File

@@ -118,13 +118,11 @@ def get_attributes_from_db_info(manager, kwargs):
if 'did' in kwargs and kwargs['did'] in manager.db_info: if 'did' in kwargs and kwargs['did'] in manager.db_info:
datlastsysoid = manager.db_info[kwargs['did']]['datlastsysoid'] \
if 'datlastsysoid' in manager.db_info[kwargs['did']] else 0
datistemplate = manager.db_info[kwargs['did']]['datistemplate'] \ datistemplate = manager.db_info[kwargs['did']]['datistemplate'] \
if 'datistemplate' in manager.db_info[kwargs['did']] else False if 'datistemplate' in manager.db_info[kwargs['did']] else False
datallowconn = manager.db_info[kwargs['did']]['datallowconn'] \ datallowconn = manager.db_info[kwargs['did']]['datallowconn'] \
if 'datallowconn' in manager.db_info[kwargs['did']] else False if 'datallowconn' in manager.db_info[kwargs['did']] else False
return datlastsysoid, datistemplate, datallowconn return datistemplate, datallowconn
else: else:
return 0, False, True return False, True

View File

@@ -220,11 +220,6 @@ class ResourceGroupView(NodeView):
self.manager = self.driver.connection_manager(kwargs['sid']) self.manager = self.driver.connection_manager(kwargs['sid'])
self.conn = self.manager.connection() 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
self.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -351,7 +346,8 @@ class ResourceGroupView(NodeView):
return gone(gettext("""Could not find the resource group.""")) return gone(gettext("""Could not find the resource group."""))
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return ajax_response( return ajax_response(
response=res['rows'][0], response=res['rows'][0],

View File

@@ -665,10 +665,6 @@ rolmembership:{
_("Connection to the server has been lost.") _("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.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -843,7 +839,8 @@ rolmembership:{
return gone(self.not_found_error_msg()) return gone(self.not_found_error_msg())
res['rows'][0]['is_sys_obj'] = ( res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate) res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
return ajax_response( return ajax_response(
response=res['rows'][0], response=res['rows'][0],
@@ -1129,7 +1126,7 @@ rolmembership:{
query = render_template( query = render_template(
"/".join([self.sql_path, 'dependents.sql']), "/".join([self.sql_path, 'dependents.sql']),
fetch_dependents=True, rid=rid, fetch_dependents=True, rid=rid,
lastsysoid=db_row['datlastsysoid'] lastsysoid=self._DATABASE_LAST_SYSTEM_OID
) )
status, result = temp_conn.execute_dict(query) status, result = temp_conn.execute_dict(query)

View File

@@ -1,10 +1,10 @@
{% if fetch_database %} {% if fetch_database %}
SELECT 'd' as type, datname, SELECT 'd' as type, datname,
datallowconn AND pg_catalog.has_database_privilege(datname, 'CONNECT') AS datallowconn, datallowconn AND pg_catalog.has_database_privilege(datname, 'CONNECT') AS datallowconn,
datdba, datlastsysoid datdba
FROM pg_catalog.pg_database db FROM pg_catalog.pg_database db
UNION UNION
SELECT 'M', spcname, null, null, null SELECT 'M', spcname, null, null
FROM pg_catalog.pg_tablespace where spcowner= {{rid}}::oid FROM pg_catalog.pg_tablespace where spcowner= {{rid}}::oid
ORDER BY 1, 2 ORDER BY 1, 2
{% endif %} {% endif %}

View File

@@ -1,10 +1,10 @@
{% if fetch_database %} {% if fetch_database %}
SELECT 'd' as type, datname, SELECT 'd' as type, datname,
datallowconn AND pg_catalog.has_database_privilege(datname, 'CONNECT') AS datallowconn, datallowconn AND pg_catalog.has_database_privilege(datname, 'CONNECT') AS datallowconn,
datdba, datlastsysoid datdba
FROM pg_catalog.pg_database db FROM pg_catalog.pg_database db
UNION UNION
SELECT 'M', spcname, null, null, null SELECT 'M', spcname, null, null
FROM pg_catalog.pg_tablespace where spcowner={{rid}}::oid FROM pg_catalog.pg_tablespace where spcowner={{rid}}::oid
ORDER BY 1, 2 ORDER BY 1, 2
{% endif %} {% endif %}

View File

@@ -106,10 +106,6 @@ class TablespaceView(PGChildNodeView):
kwargs['sid'] kwargs['sid']
) )
self.conn = self.manager.connection() 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
self.datistemplate = False self.datistemplate = False
if ( if (
self.manager.db_info is not None and self.manager.db_info is not None and
@@ -275,7 +271,8 @@ class TablespaceView(PGChildNodeView):
# Making copy of output for future use # Making copy of output for future use
copy_data = dict(res['rows'][0]) copy_data = dict(res['rows'][0])
copy_data['is_sys_obj'] = ( copy_data['is_sys_obj'] = (
copy_data['oid'] <= self.datlastsysoid or self.datistemplate) copy_data['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
self.datistemplate)
copy_data = self._formatter(copy_data, tsid) copy_data = self._formatter(copy_data, tsid)
return ajax_response( return ajax_response(

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN 'n'::text WHEN ns.oid IS NOT NULL THEN 'n'::text
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin,
WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
@@ -74,7 +74,7 @@ refclassid IN ( SELECT oid FROM pg_catalog.pg_class WHERE relname IN
'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension', 'pg_policy')) 'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension', 'pg_policy'))
UNION UNION
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
ELSE '' END AS type, ELSE '' END AS type,
NULL AS ownertable, NULL AS ownertable,
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '') CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.objsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.objsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN 'n'::text WHEN ns.oid IS NOT NULL THEN 'n'::text
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, pg_catalog.pg_get_expr(ad.adbin, ad.adrelid) as adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, pg_catalog.pg_get_expr(ad.adbin, ad.adrelid) as adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN 'n'::text WHEN ns.oid IS NOT NULL THEN 'n'::text
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin,
WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
@@ -74,7 +74,7 @@ refclassid IN ( SELECT oid FROM pg_catalog.pg_class WHERE relname IN
'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension', 'pg_policy')) 'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension', 'pg_policy'))
UNION UNION
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, pg_catalog.pg_get_expr(ad.adbin, ad.adrelid) as adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, pg_catalog.pg_get_expr(ad.adbin, ad.adrelid) as adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
ELSE '' END AS type, ELSE '' END AS type,
NULL AS ownertable, NULL AS ownertable,
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '') CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, pg_get_expr(ad.adbin, ad.adrelid) as adsrc, SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, pg_get_expr(ad.adbin, ad.adrelid) as adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.objsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.objsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN 'n'::text WHEN ns.oid IS NOT NULL THEN 'n'::text
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, pg_get_expr(ad.a
WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN 'n'::text WHEN ns.oid IS NOT NULL THEN 'n'::text
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
@@ -70,7 +70,7 @@ refclassid IN ( SELECT oid FROM pg_catalog.pg_class WHERE relname IN
'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension')) 'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension'))
UNION UNION
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
ELSE '' END AS type, ELSE '' END AS type,
NULL AS ownertable, NULL AS ownertable,
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '') CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.objsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.objsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN 'n'::text WHEN ns.oid IS NOT NULL THEN 'n'::text
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN 'n'::text WHEN ns.oid IS NOT NULL THEN 'n'::text
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
@@ -72,7 +72,7 @@ refclassid IN ( SELECT oid FROM pg_catalog.pg_class WHERE relname IN
'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension')) 'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension'))
UNION UNION
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
ELSE '' END AS type, ELSE '' END AS type,
NULL AS ownertable, NULL AS ownertable,
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '') CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.objsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.objsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN 'n'::text WHEN ns.oid IS NOT NULL THEN 'n'::text
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN 'n'::text WHEN ns.oid IS NOT NULL THEN 'n'::text
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
@@ -74,7 +74,7 @@ refclassid IN ( SELECT oid FROM pg_catalog.pg_class WHERE relname IN
'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension', 'pg_policy')) 'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension', 'pg_policy'))
UNION UNION
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
ELSE '' END AS type, ELSE '' END AS type,
NULL AS ownertable, NULL AS ownertable,
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '') CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.objsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.objsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN 'n'::text WHEN ns.oid IS NOT NULL THEN 'n'::text
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin,
WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
@@ -78,7 +78,7 @@ refclassid IN ( SELECT oid FROM pg_catalog.pg_class WHERE relname IN
'pg_synonym', 'pg_policy')) 'pg_synonym', 'pg_policy'))
UNION UNION
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
ELSE '' END AS type, ELSE '' END AS type,
NULL AS ownertable, NULL AS ownertable,
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '') CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.objsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.objsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, pg_catalog.pg_get_expr(ad.adbin, ad.adrelid) as adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, pg_catalog.pg_get_expr(ad.adbin, ad.adrelid) as adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN CASE WHEN tg.tgpackageoid != 0 THEN 'Tc'::text ELSE 'Tr'::text END WHEN tg.oid IS NOT NULL THEN CASE WHEN tg.tgpackageoid != 0 THEN 'Tc'::text ELSE 'Tr'::text END
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 AND ns.nspcompoundtrigger = false THEN 'Pa'::text ELSE 'n'::text END WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 AND ns.nspcompoundtrigger = false THEN 'Pa'::text ELSE 'n'::text END
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin,
WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
@@ -78,7 +78,7 @@ refclassid IN ( SELECT oid FROM pg_catalog.pg_class WHERE relname IN
'pg_synonym', 'pg_policy')) 'pg_synonym', 'pg_policy'))
UNION UNION
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, pg_catalog.pg_get_expr(ad.adbin, ad.adrelid) as adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, pg_catalog.pg_get_expr(ad.adbin, ad.adrelid) as adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
ELSE '' END AS type, ELSE '' END AS type,
NULL AS ownertable, NULL AS ownertable,
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '') CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, pg_get_expr(ad.adbin, ad.adrelid) as adsrc, SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, pg_get_expr(ad.adbin, ad.adrelid) as adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.objsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.objsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN CASE WHEN tg.tgpackageoid != 0 THEN 'Tc'::text ELSE 'Tr'::text END WHEN tg.oid IS NOT NULL THEN CASE WHEN tg.tgpackageoid != 0 THEN 'Tc'::text ELSE 'Tr'::text END
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 AND ns.nspcompoundtrigger = false THEN 'Pa'::text ELSE 'n'::text END WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 AND ns.nspcompoundtrigger = false THEN 'Pa'::text ELSE 'n'::text END
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, pg_get_expr(ad.a
WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END WHEN pr.oid IS NOT NULL THEN CASE WHEN pr.prokind = 'p' THEN 'Pp'::text ELSE 'Pf'::text END
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
@@ -74,7 +74,7 @@ refclassid IN ( SELECT oid FROM pg_catalog.pg_class WHERE relname IN
'pg_synonym')) 'pg_synonym'))
UNION UNION
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
ELSE '' END AS type, ELSE '' END AS type,
NULL AS ownertable, NULL AS ownertable,
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '') CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.objsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.objsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
@@ -76,7 +76,7 @@ refclassid IN ( SELECT oid FROM pg_catalog.pg_class WHERE relname IN
'pg_synonym')) 'pg_synonym'))
UNION UNION
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
ELSE '' END AS type, ELSE '' END AS type,
NULL AS ownertable, NULL AS ownertable,
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '') CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.objsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.objsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
@@ -78,7 +78,7 @@ refclassid IN ( SELECT oid FROM pg_catalog.pg_class WHERE relname IN
'pg_synonym', 'pg_policy')) 'pg_synonym', 'pg_policy'))
UNION UNION
SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.refclassid, dep.refobjid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.refobjsubid::text, '') ELSE cl.relkind::text END
ELSE '' END AS type, ELSE '' END AS type,
NULL AS ownertable, NULL AS ownertable,
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '') CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')

View File

@@ -1,5 +1,5 @@
SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc, SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind || COALESCE(dep.objsubid::text, '') ELSE cl.relkind END CASE WHEN cl.relkind IS NOT NULL THEN CASE WHEN cl.relkind = 'r' THEN cl.relkind::text || COALESCE(dep.objsubid::text, '') ELSE cl.relkind::text END
WHEN tg.oid IS NOT NULL THEN 'Tr'::text WHEN tg.oid IS NOT NULL THEN 'Tr'::text
WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END WHEN ty.oid IS NOT NULL THEN CASE WHEN ty.typtype = 'd' THEN 'd'::text ELSE 'Ty'::text END
WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END WHEN ns.oid IS NOT NULL THEN CASE WHEN ns.nspparent != 0 THEN 'Pa'::text ELSE 'n'::text END
@@ -7,7 +7,7 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
WHEN pr.oid IS NOT NULL THEN 'Pf'::text WHEN pr.oid IS NOT NULL THEN 'Pf'::text
WHEN la.oid IS NOT NULL THEN 'l'::text WHEN la.oid IS NOT NULL THEN 'l'::text
WHEN rw.oid IS NOT NULL THEN 'Rl'::text WHEN rw.oid IS NOT NULL THEN 'Rl'::text
WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype END WHEN co.oid IS NOT NULL THEN CASE WHEN co.contypid > 0 THEN 'Cd' ELSE 'C'::text || contype::text END
WHEN ad.oid IS NOT NULL THEN 'A'::text WHEN ad.oid IS NOT NULL THEN 'A'::text
WHEN fs.oid IS NOT NULL THEN 'Fs'::text WHEN fs.oid IS NOT NULL THEN 'Fs'::text
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text WHEN fdw.oid IS NOT NULL THEN 'Fw'::text

View File

@@ -21,6 +21,7 @@ from pgadmin.utils.ajax import make_json_response, precondition_required,\
internal_server_error internal_server_error
from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost,\ from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost,\
CryptKeyMissing CryptKeyMissing
from pgadmin.utils.constants import DATABASE_LAST_SYSTEM_OID
def underscore_escape(text): def underscore_escape(text):
@@ -391,6 +392,7 @@ class PGChildNodeView(NodeView):
_GET_SUBTYPES_SQL = 'get_subtypes.sql' _GET_SUBTYPES_SQL = 'get_subtypes.sql'
_GET_EXTERNAL_FUNCTIONS_SQL = 'get_external_functions.sql' _GET_EXTERNAL_FUNCTIONS_SQL = 'get_external_functions.sql'
_GET_TABLE_FOR_PUBLICATION = 'get_tables.sql' _GET_TABLE_FOR_PUBLICATION = 'get_tables.sql'
_DATABASE_LAST_SYSTEM_OID = DATABASE_LAST_SYSTEM_OID
def get_children_nodes(self, manager, **kwargs): def get_children_nodes(self, manager, **kwargs):
""" """

View File

@@ -12,6 +12,7 @@ from flask_babel import gettext
from pgadmin.utils.driver import get_driver from pgadmin.utils.driver import get_driver
from config import PG_DEFAULT_DRIVER from config import PG_DEFAULT_DRIVER
from pgadmin.utils.constants import DATABASE_LAST_SYSTEM_OID
def get_node_blueprint(node_type): def get_node_blueprint(node_type):
@@ -111,9 +112,7 @@ class SearchObjectsHelper:
def search(self, text, obj_type=None): def search(self, text, obj_type=None):
skip_obj_type = [] skip_obj_type = []
conn = self.manager.connection(did=self.did) conn = self.manager.connection(did=self.did)
last_system_oid = (self.manager.db_info[self.did])['datlastsysoid'] \ last_system_oid = DATABASE_LAST_SYSTEM_OID
if self.manager.db_info is not None and self.did in \
self.manager.db_info else 0
show_node_prefs = self.get_show_node_prefs() show_node_prefs = self.get_show_node_prefs()
node_labels = self.get_supported_types(skip_check=True) node_labels = self.get_supported_types(skip_check=True)

View File

@@ -113,3 +113,4 @@ UTILITIES_ARRAY = ['pg_dump', 'pg_dumpall', 'pg_restore', 'psql']
ENTER_EMAIL_ADDRESS = "Email address: " ENTER_EMAIL_ADDRESS = "Email address: "
USER_NOT_FOUND = gettext("The specified user ID (%s) could not be found.") USER_NOT_FOUND = gettext("The specified user ID (%s) could not be found.")
DATABASE_LAST_SYSTEM_OID = 16383

View File

@@ -526,7 +526,7 @@ class Connection(BaseConnection):
SELECT SELECT
db.oid as did, db.datname, db.datallowconn, db.oid as did, db.datname, db.datallowconn,
pg_encoding_to_char(db.encoding) AS serverencoding, pg_encoding_to_char(db.encoding) AS serverencoding,
has_database_privilege(db.oid, 'CREATE') as cancreate, datlastsysoid, has_database_privilege(db.oid, 'CREATE') as cancreate,
datistemplate datistemplate
FROM FROM
pg_catalog.pg_database db pg_catalog.pg_database db

View File

@@ -217,7 +217,7 @@ SELECT
db.oid as did, db.datname, db.datallowconn, db.oid as did, db.datname, db.datallowconn,
pg_catalog.pg_encoding_to_char(db.encoding) AS serverencoding, pg_catalog.pg_encoding_to_char(db.encoding) AS serverencoding,
pg_catalog.has_database_privilege(db.oid, 'CREATE') as cancreate, pg_catalog.has_database_privilege(db.oid, 'CREATE') as cancreate,
datlastsysoid, datistemplate datistemplate
FROM FROM
pg_catalog.pg_database db pg_catalog.pg_database db
WHERE db.oid = {0}""".format(did)) WHERE db.oid = {0}""".format(did))