mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
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:
@@ -182,7 +182,6 @@ class DatabaseView(PGChildNodeView):
|
||||
if self.manager is None:
|
||||
return gone(errormsg=_("Could not find the server."))
|
||||
|
||||
self.datlastsysoid = 0
|
||||
self.datistemplate = False
|
||||
if action and action in ["drop"]:
|
||||
self.conn = self.manager.connection()
|
||||
@@ -193,8 +192,7 @@ class DatabaseView(PGChildNodeView):
|
||||
# provide generic connection
|
||||
if kwargs['did'] in self.manager.db_info:
|
||||
self._db = self.manager.db_info[kwargs['did']]
|
||||
self.datlastsysoid, self.datistemplate, \
|
||||
datallowconn = \
|
||||
self.datistemplate, datallowconn = \
|
||||
get_attributes_from_db_info(self.manager, kwargs)
|
||||
|
||||
if datallowconn is False:
|
||||
@@ -252,14 +250,10 @@ class DatabaseView(PGChildNodeView):
|
||||
|
||||
def retrieve_last_system_oid(self):
|
||||
last_system_oid = 0
|
||||
if self.blueprint.show_system_objects:
|
||||
last_system_oid = 0
|
||||
elif (
|
||||
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']
|
||||
|
||||
if not self.blueprint.show_system_objects:
|
||||
last_system_oid = self._DATABASE_LAST_SYSTEM_OID
|
||||
|
||||
return last_system_oid
|
||||
|
||||
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 and 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']
|
||||
last_system_oid = self._DATABASE_LAST_SYSTEM_OID
|
||||
|
||||
server_node_res = self.manager
|
||||
|
||||
@@ -436,7 +429,8 @@ class DatabaseView(PGChildNodeView):
|
||||
|
||||
result = res['rows'][0]
|
||||
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
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'get_variables.sql']),
|
||||
|
||||
@@ -210,11 +210,6 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# Set template path for the SQL scripts
|
||||
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
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -238,7 +233,7 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:return:
|
||||
"""
|
||||
last_system_oid = 0 if self.blueprint.show_system_objects else \
|
||||
self.datlastsysoid
|
||||
self._DATABASE_LAST_SYSTEM_OID
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
datlastsysoid=last_system_oid,
|
||||
@@ -270,7 +265,7 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = []
|
||||
last_system_oid = 0 if self.blueprint.show_system_objects else \
|
||||
self.datlastsysoid
|
||||
self._DATABASE_LAST_SYSTEM_OID
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
@@ -348,7 +343,7 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:return:
|
||||
"""
|
||||
last_system_oid = 0 if not self.blueprint.show_system_objects else \
|
||||
self.datlastsysoid
|
||||
self._DATABASE_LAST_SYSTEM_OID
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
cid=cid,
|
||||
@@ -407,7 +402,7 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# we need oid to add object in tree at browser, below sql will
|
||||
# gives the same
|
||||
last_system_oid = 0 if self.blueprint.show_system_objects else \
|
||||
self.datlastsysoid
|
||||
self._DATABASE_LAST_SYSTEM_OID
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
srctyp=data['srctyp'],
|
||||
@@ -584,7 +579,7 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
if cid is not None:
|
||||
last_system_oid = 0 if self.blueprint.show_system_objects else \
|
||||
self.datlastsysoid
|
||||
self._DATABASE_LAST_SYSTEM_OID
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
cid=cid,
|
||||
@@ -769,13 +764,9 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
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(
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
datlastsysoid=last_system_oid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
|
||||
showsysobj=self.blueprint.show_system_objects,
|
||||
schema_diff=True
|
||||
)
|
||||
|
||||
@@ -196,11 +196,6 @@ class EventTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.template_path = 'event_triggers/sql/9.3_plus'
|
||||
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -370,7 +365,7 @@ class EventTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
result = res['rows'][0]
|
||||
result['is_sys_obj'] = (
|
||||
result['oid'] <= self.datlastsysoid or
|
||||
result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
|
||||
self.datistemplate)
|
||||
result = self._formatter(result)
|
||||
|
||||
|
||||
@@ -139,11 +139,6 @@ class ExtensionView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
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
|
||||
if (
|
||||
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]['oid'] <= self.datlastsysoid or self.datistemplate)
|
||||
res['rows'][0]['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
|
||||
self.datistemplate)
|
||||
|
||||
return True, res['rows'][0]
|
||||
|
||||
|
||||
@@ -216,11 +216,6 @@ class ForeignDataWrapperView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.qtIdent = driver.qtIdent
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
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]['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:
|
||||
res['rows'][0]['fdwoptions'] = tokenize_options(
|
||||
|
||||
@@ -207,11 +207,6 @@ class ForeignServerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -369,7 +364,8 @@ class ForeignServerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return False, gone(self.not_found_error_msg())
|
||||
|
||||
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:
|
||||
res['rows'][0]['fsrvoptions'] = tokenize_options(
|
||||
|
||||
@@ -225,11 +225,6 @@ class UserMappingView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -388,7 +383,8 @@ class UserMappingView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return False, gone(self.not_found_error_msg())
|
||||
|
||||
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:
|
||||
res['rows'][0]['umoptions'] = tokenize_options(
|
||||
|
||||
@@ -230,11 +230,6 @@ class LanguageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.driver = get_driver(PG_DEFAULT_DRIVER)
|
||||
self.manager = self.driver.connection_manager(kwargs['sid'])
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -378,7 +373,8 @@ class LanguageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return False, gone(self._NOT_FOUND_LANG_INFORMATION)
|
||||
|
||||
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(
|
||||
"/".join([self.template_path, self._ACL_SQL]),
|
||||
|
||||
@@ -221,10 +221,6 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.driver = get_driver(PG_DEFAULT_DRIVER)
|
||||
self.manager = self.driver.connection_manager(kwargs['sid'])
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = self.manager.db_info[kwargs['did']][
|
||||
'datlastsysoid'] if self.manager.db_info is not None \
|
||||
and kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
# Set the template path for the SQL scripts
|
||||
self.template_path = (
|
||||
"publications/sql/#{0}#".format(self.manager.version)
|
||||
|
||||
@@ -140,11 +140,6 @@ def check_precondition(f):
|
||||
return gone(errormsg=gettext("Could not find the server."))
|
||||
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
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
|
||||
copy_data = dict(res['rows'][0])
|
||||
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)
|
||||
|
||||
return ajax_response(
|
||||
|
||||
@@ -155,11 +155,6 @@ class AggregateView(PGChildNodeView):
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -317,7 +312,7 @@ class AggregateView(PGChildNodeView):
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, agid=agid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@@ -327,7 +322,8 @@ class AggregateView(PGChildNodeView):
|
||||
return False, gone(self.not_found_error_msg())
|
||||
|
||||
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]
|
||||
|
||||
|
||||
@@ -146,11 +146,6 @@ class CatalogObjectView(PGChildNodeView):
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -306,7 +301,8 @@ class CatalogObjectView(PGChildNodeView):
|
||||
gettext("""Could not find the specified catalog object."""))
|
||||
|
||||
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(
|
||||
response=res['rows'][0],
|
||||
|
||||
@@ -173,11 +173,6 @@ class CatalogObjectColumnsView(PGChildNodeView):
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -288,7 +283,7 @@ class CatalogObjectColumnsView(PGChildNodeView):
|
||||
return gone(gettext("""Could not find the specified column."""))
|
||||
|
||||
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)
|
||||
|
||||
return ajax_response(
|
||||
|
||||
@@ -192,11 +192,6 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -354,7 +349,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, coid=coid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@@ -364,7 +359,8 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return False, gone(self.not_found_error_msg())
|
||||
|
||||
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]
|
||||
|
||||
|
||||
@@ -282,11 +282,6 @@ class DomainView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
# Get database connection
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.qtIdent = driver.qtIdent
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
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
|
||||
data['sysdomain'] = False
|
||||
if doid <= self.manager.db_info[did]['datlastsysoid'] or \
|
||||
if doid <= self._DATABASE_LAST_SYSTEM_OID or \
|
||||
self.datistemplate:
|
||||
data['sysdomain'] = True
|
||||
|
||||
|
||||
@@ -260,11 +260,6 @@ class DomainConstraintView(PGChildNodeView):
|
||||
self.manager = driver.connection_manager(kwargs['sid'])
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.qtIdent = driver.qtIdent
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -413,7 +408,8 @@ class DomainConstraintView(PGChildNodeView):
|
||||
|
||||
data = res['rows'][0]
|
||||
data['is_sys_obj'] = (
|
||||
data['oid'] <= self.datlastsysoid or self.datistemplate)
|
||||
data['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
|
||||
self.datistemplate)
|
||||
return ajax_response(
|
||||
response=data,
|
||||
status=200
|
||||
|
||||
@@ -383,11 +383,6 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
# Get database connection
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.qtIdent = driver.qtIdent
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = \
|
||||
self.manager.db_info[kwargs['did']]['datistemplate'] \
|
||||
if self.manager.db_info is not None and \
|
||||
@@ -1191,7 +1186,8 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
|
||||
data = res['rows'][0]
|
||||
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:
|
||||
# Fetch privileges
|
||||
|
||||
@@ -226,11 +226,6 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
|
||||
kwargs['sid'])
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
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]['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
|
||||
sql = render_template(
|
||||
@@ -782,7 +778,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
if not status:
|
||||
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
|
||||
# at parser control while creating a new FTS Configuration
|
||||
@@ -817,7 +813,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
if not status:
|
||||
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
|
||||
# at copy_config control while creating a new FTS Configuration
|
||||
|
||||
@@ -215,11 +215,6 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
driver = get_driver(PG_DEFAULT_DRIVER)
|
||||
self.qtIdent = driver.qtIdent
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
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]['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
|
||||
if res['rows'][0]['template_schema'] is not None and \
|
||||
|
||||
@@ -229,11 +229,6 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
|
||||
kwargs['sid'])
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
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."))
|
||||
|
||||
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]
|
||||
|
||||
@check_precondition
|
||||
|
||||
@@ -209,11 +209,6 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
|
||||
kwargs['sid'])
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -332,7 +327,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
if len(res['rows']) == 0:
|
||||
return False, gone(self.not_found_error_msg())
|
||||
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]
|
||||
|
||||
@check_precondition
|
||||
|
||||
@@ -1609,12 +1609,12 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
|
||||
# Set System Functions Status
|
||||
resp_data['sysfunc'] = False
|
||||
if fnid <= self.manager.db_info[did]['datlastsysoid']:
|
||||
if fnid <= self._DATABASE_LAST_SYSTEM_OID:
|
||||
resp_data['sysfunc'] = True
|
||||
|
||||
# Set System Functions Status
|
||||
resp_data['sysproc'] = False
|
||||
if fnid <= self.manager.db_info[did]['datlastsysoid']:
|
||||
if fnid <= self._DATABASE_LAST_SYSTEM_OID:
|
||||
resp_data['sysproc'] = True
|
||||
|
||||
# Get formatted Security Labels
|
||||
|
||||
@@ -154,11 +154,6 @@ class OperatorView(PGChildNodeView):
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -316,7 +311,7 @@ class OperatorView(PGChildNodeView):
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, opid=opid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@@ -326,7 +321,8 @@ class OperatorView(PGChildNodeView):
|
||||
return False, gone(self.not_found_error_msg())
|
||||
|
||||
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]
|
||||
|
||||
|
||||
@@ -139,10 +139,6 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
else:
|
||||
self.conn = self.manager.connection()
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -320,7 +316,8 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return False, gone(self.not_found_error_msg())
|
||||
|
||||
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']:
|
||||
sql = render_template(
|
||||
|
||||
@@ -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
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -428,7 +424,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return False, gone(self.not_found_error_msg())
|
||||
|
||||
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)
|
||||
return True, res['rows'][0]
|
||||
except Exception as e:
|
||||
|
||||
@@ -306,7 +306,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@@ -1059,7 +1059,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1111,7 +1111,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1150,7 +1150,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1219,7 +1219,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1369,7 +1369,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1417,7 +1417,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1468,7 +1468,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1521,7 +1521,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1601,7 +1601,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
|
||||
SQL = render_template("/".join(
|
||||
[self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
sql = ''
|
||||
|
||||
@@ -263,13 +263,6 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
kwargs['sid']
|
||||
)
|
||||
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
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -451,7 +444,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@@ -575,10 +568,10 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# We will first fetch the compound trigger name for
|
||||
# current request so that we create template for
|
||||
# dropping compound trigger
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -637,7 +630,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data['table'] = self.table
|
||||
|
||||
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):
|
||||
return SQL
|
||||
SQL = SQL.strip('\n').strip(' ')
|
||||
@@ -659,7 +652,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=new_trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@@ -716,7 +709,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
try:
|
||||
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):
|
||||
return sql
|
||||
sql = sql.strip('\n').strip(' ')
|
||||
@@ -747,7 +740,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
try:
|
||||
SQL = compound_trigger_utils.get_reverse_engineered_sql(
|
||||
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:
|
||||
return internal_server_error(errormsg=str(e))
|
||||
|
||||
@@ -780,7 +773,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -885,10 +878,8 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
target_schema = kwargs.get('target_schema', None)
|
||||
|
||||
if data:
|
||||
sql, name = compound_trigger_utils.get_sql(self.conn,
|
||||
data,
|
||||
tid, oid,
|
||||
self.datlastsysoid)
|
||||
sql, name = compound_trigger_utils.get_sql(
|
||||
self.conn, data, tid, oid, self._DATABASE_LAST_SYSTEM_OID)
|
||||
if not isinstance(sql, str):
|
||||
return sql
|
||||
sql = sql.strip('\n').strip(' ')
|
||||
@@ -898,10 +889,10 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
scid=scid, tid=tid,
|
||||
trid=oid, only_sql=True)
|
||||
else:
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=oid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=oid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@@ -935,11 +926,8 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
if target_schema:
|
||||
data['schema'] = target_schema
|
||||
|
||||
sql, name = compound_trigger_utils.get_sql(self.conn,
|
||||
data,
|
||||
tid,
|
||||
None,
|
||||
self.datlastsysoid)
|
||||
sql, name = compound_trigger_utils.get_sql(
|
||||
self.conn, data, tid, None, self._DATABASE_LAST_SYSTEM_OID)
|
||||
|
||||
# If compound trigger is disbaled then add sql
|
||||
# code for the same
|
||||
|
||||
@@ -196,11 +196,6 @@ class CheckConstraintView(PGChildNodeView):
|
||||
self.manager = driver.connection_manager(kwargs['sid'])
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.qtIdent = driver.qtIdent
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -449,7 +444,8 @@ class CheckConstraintView(PGChildNodeView):
|
||||
if cid:
|
||||
result = res[0]
|
||||
result['is_sys_obj'] = (
|
||||
result['oid'] <= self.datlastsysoid or self.datistemplate)
|
||||
result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
|
||||
self.datistemplate)
|
||||
|
||||
return ajax_response(
|
||||
response=result,
|
||||
|
||||
@@ -222,11 +222,6 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -285,7 +280,8 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
if exid:
|
||||
result = res[0]
|
||||
result['is_sys_obj'] = (
|
||||
result['oid'] <= self.datlastsysoid or self.datistemplate)
|
||||
result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
|
||||
self.datistemplate)
|
||||
|
||||
return ajax_response(
|
||||
response=result,
|
||||
|
||||
@@ -229,11 +229,6 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -288,7 +283,8 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
if fkid:
|
||||
result = res[0]
|
||||
result['is_sys_obj'] = (
|
||||
result['oid'] <= self.datlastsysoid or self.datistemplate)
|
||||
result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
|
||||
self.datistemplate)
|
||||
|
||||
return ajax_response(
|
||||
response=result,
|
||||
|
||||
@@ -242,11 +242,6 @@ class IndexConstraintView(PGChildNodeView):
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[kwargs['did']]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -304,7 +299,8 @@ class IndexConstraintView(PGChildNodeView):
|
||||
if cid:
|
||||
result = res[0]
|
||||
result['is_sys_obj'] = (
|
||||
result['oid'] <= self.datlastsysoid or self.datistemplate)
|
||||
result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
|
||||
self.datistemplate)
|
||||
|
||||
return ajax_response(
|
||||
response=result,
|
||||
|
||||
@@ -246,12 +246,6 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
kwargs['sid']
|
||||
)
|
||||
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(
|
||||
'tables/sql',
|
||||
self.manager.server_type,
|
||||
@@ -514,7 +508,8 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".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)
|
||||
@@ -700,7 +695,8 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# so that we create template for dropping index
|
||||
SQL = render_template(
|
||||
"/".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)
|
||||
@@ -757,7 +753,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
try:
|
||||
SQL, name = index_utils.get_sql(
|
||||
self.conn, data=data, did=did, tid=tid, idx=idx,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
if not isinstance(SQL, str):
|
||||
return SQL
|
||||
SQL = SQL.strip('\n').strip(' ')
|
||||
@@ -808,7 +804,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
try:
|
||||
sql, name = index_utils.get_sql(
|
||||
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):
|
||||
return sql
|
||||
sql = sql.strip('\n').strip(' ')
|
||||
@@ -837,7 +833,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
SQL = index_utils.get_reverse_engineered_sql(
|
||||
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
|
||||
)
|
||||
|
||||
@@ -868,7 +864,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
sql, name = index_utils.get_sql(
|
||||
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(' ')
|
||||
|
||||
@@ -876,7 +872,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
sql = index_utils.get_reverse_engineered_sql(
|
||||
self.conn, schema=target_schema,
|
||||
table=self.table, did=did, tid=tid, idx=idx,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
|
||||
template_path=None, with_header=False,
|
||||
add_not_exists_clause=True
|
||||
)
|
||||
@@ -973,7 +969,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
did=did, tid=tid, idx=idx,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
|
||||
@@ -263,7 +263,7 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join([self.partition_template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@@ -372,7 +372,8 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join([self.partition_template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
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)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@@ -408,7 +409,8 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join([self.partition_template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
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)
|
||||
if not status:
|
||||
current_app.logger.error(result)
|
||||
@@ -428,11 +430,11 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
return False
|
||||
|
||||
for row in partitions['rows']:
|
||||
SQL = render_template("/".join([self.partition_template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
ptid=row['oid'],
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
SQL = render_template(
|
||||
"/".join([self.partition_template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid, ptid=row['oid'],
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
status, result = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@@ -712,7 +714,8 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join([self.partition_template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
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)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@@ -750,7 +753,7 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
"/".join([self.partition_template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid, ptid=ptid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -804,7 +807,7 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.partition_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid, ptid=ptid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
|
||||
@@ -198,10 +198,6 @@ class RowSecurityView(PGChildNodeView):
|
||||
schema, table = row_security_policies_utils.get_parent(self.conn,
|
||||
kwargs[
|
||||
'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.table = table
|
||||
# Set template path for the sql scripts
|
||||
@@ -315,7 +311,7 @@ class RowSecurityView(PGChildNodeView):
|
||||
sql = render_template("/".join(
|
||||
[self.template_path, self._PROPERTIES_SQL]
|
||||
), plid=plid, scid=scid, policy_table_id=tid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
if not status:
|
||||
@@ -555,7 +551,8 @@ class RowSecurityView(PGChildNodeView):
|
||||
|
||||
SQL = row_security_policies_utils.get_reverse_engineered_sql(
|
||||
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)
|
||||
|
||||
@@ -632,7 +629,8 @@ class RowSecurityView(PGChildNodeView):
|
||||
sql = row_security_policies_utils.get_reverse_engineered_sql(
|
||||
self.conn, schema=schema, table=self.table, scid=scid,
|
||||
plid=oid, policy_table_id=tid,
|
||||
datlastsysoid=self.datlastsysoid, with_header=False)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
|
||||
with_header=False)
|
||||
|
||||
drop_sql = ''
|
||||
if drop_req:
|
||||
|
||||
@@ -197,10 +197,6 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.manager = get_driver(
|
||||
PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = self.manager.db_info[
|
||||
kwargs['did']
|
||||
]['datlastsysoid'] if self.manager.db_info is not None and \
|
||||
kwargs['did'] in self.manager.db_info else 0
|
||||
self.template_path = 'rules/sql'
|
||||
self.table_template_path = compile_template_path(
|
||||
'tables/sql',
|
||||
@@ -310,7 +306,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
SQL = render_template("/".join(
|
||||
[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)
|
||||
|
||||
if not status:
|
||||
|
||||
@@ -11,6 +11,7 @@ import os
|
||||
from regression.python_test_utils.template_helper import file_as_template
|
||||
from regression.python_test_utils.sql_template_test_base import \
|
||||
SQLTemplateTestBase
|
||||
from pgadmin.utils.constants import DATABASE_LAST_SYSTEM_OID
|
||||
|
||||
|
||||
class TestTablesPropertiesSql(SQLTemplateTestBase):
|
||||
@@ -46,7 +47,7 @@ class TestTablesPropertiesSql(SQLTemplateTestBase):
|
||||
public_schema_id = 2200
|
||||
sql = template.render(scid=public_schema_id,
|
||||
did=self.database_id,
|
||||
datlastsysoid=self.last_system_oid,
|
||||
datlastsysoid=DATABASE_LAST_SYSTEM_OID,
|
||||
tid=self.table_id
|
||||
)
|
||||
return sql
|
||||
@@ -54,12 +55,12 @@ class TestTablesPropertiesSql(SQLTemplateTestBase):
|
||||
def test_setup(self, connection, cursor):
|
||||
cursor.execute("""
|
||||
SELECT
|
||||
db.oid as did, datlastsysoid
|
||||
db.oid as did
|
||||
FROM
|
||||
pg_catalog.pg_database db
|
||||
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="
|
||||
"'test_table'")
|
||||
|
||||
@@ -262,13 +262,6 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
kwargs['sid']
|
||||
)
|
||||
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
|
||||
self.table_template_path = compile_template_path(
|
||||
'tables/sql',
|
||||
@@ -543,7 +536,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@@ -668,10 +661,10 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
for trid in data['ids']:
|
||||
# We will first fetch the trigger name for current request
|
||||
# so that we create template for dropping trigger
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -730,7 +723,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
SQL, name = trigger_utils.get_sql(
|
||||
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)
|
||||
|
||||
if not isinstance(SQL, str):
|
||||
@@ -754,7 +747,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=new_trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@@ -812,7 +805,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
try:
|
||||
sql, name = trigger_utils.get_sql(
|
||||
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)
|
||||
if not isinstance(sql, str):
|
||||
return sql
|
||||
@@ -843,7 +836,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
SQL = trigger_utils.get_reverse_engineered_sql(
|
||||
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)
|
||||
|
||||
return ajax_response(response=SQL)
|
||||
@@ -868,7 +861,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
if data:
|
||||
SQL, name = trigger_utils.get_sql(
|
||||
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,
|
||||
is_schema_diff=True)
|
||||
|
||||
@@ -887,7 +880,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
SQL = trigger_utils.get_reverse_engineered_sql(
|
||||
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,
|
||||
template_path=None, with_header=False)
|
||||
|
||||
@@ -918,7 +911,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID)
|
||||
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
|
||||
@@ -113,11 +113,6 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.qtIdent = driver.qtIdent
|
||||
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
|
||||
server_type = self.manager.server_type
|
||||
@@ -577,7 +572,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
|
||||
sql = render_template(
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@@ -748,7 +743,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
|
||||
|
||||
index_sql = index_utils.get_reverse_engineered_sql(
|
||||
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,
|
||||
add_not_exists_clause=add_not_exists_clause
|
||||
)
|
||||
@@ -780,7 +775,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
|
||||
get_reverse_engineered_sql(
|
||||
self.conn, schema=schema, table=table, scid=scid,
|
||||
plid=row['oid'], policy_table_id=tid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
|
||||
template_path=None, with_header=json_resp)
|
||||
policy_sql = "\n" + policy_sql
|
||||
|
||||
@@ -806,7 +801,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
|
||||
for row in rset['rows']:
|
||||
trigger_sql = trigger_utils.get_reverse_engineered_sql(
|
||||
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,
|
||||
template_path=None, with_header=json_resp)
|
||||
trigger_sql = "\n" + trigger_sql
|
||||
@@ -837,7 +832,8 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
|
||||
compound_trigger_sql = \
|
||||
compound_trigger_utils.get_reverse_engineered_sql(
|
||||
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
|
||||
|
||||
# Add into main sql
|
||||
@@ -864,7 +860,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
|
||||
rules_sql = '\n'
|
||||
sql = render_template("/".join(
|
||||
[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)
|
||||
if not status:
|
||||
|
||||
@@ -4,7 +4,7 @@ SELECT
|
||||
WHEN 'S' THEN 'defseqacl'
|
||||
WHEN 'f' THEN 'deffuncacl'
|
||||
WHEN 'T' THEN 'deftypeacl'
|
||||
ELSE 'UNKNOWN - ' || a.deftype
|
||||
ELSE 'UNKNOWN - ' || a.deftype::text
|
||||
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
|
||||
FROM
|
||||
|
||||
@@ -3,7 +3,7 @@ SELECT
|
||||
WHEN 'r' THEN 'deftblacl'
|
||||
WHEN 'S' THEN 'defseqacl'
|
||||
WHEN 'f' THEN 'deffuncacl'
|
||||
ELSE 'UNKNOWN - ' || a.deftype
|
||||
ELSE 'UNKNOWN - ' || a.deftype::text
|
||||
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
|
||||
FROM
|
||||
|
||||
@@ -3,7 +3,7 @@ SELECT
|
||||
WHEN 'r' THEN 'deftblacl'
|
||||
WHEN 'S' THEN 'defseqacl'
|
||||
WHEN 'f' THEN 'deffuncacl'
|
||||
ELSE 'UNKNOWN - ' || a.deftype
|
||||
ELSE 'UNKNOWN - ' || a.deftype::text
|
||||
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
|
||||
FROM
|
||||
|
||||
@@ -4,7 +4,7 @@ SELECT
|
||||
WHEN 'S' THEN 'defseqacl'
|
||||
WHEN 'f' THEN 'deffuncacl'
|
||||
WHEN 'T' THEN 'deftypeacl'
|
||||
ELSE 'UNKNOWN - ' || a.deftype
|
||||
ELSE 'UNKNOWN - ' || a.deftype::text
|
||||
END AS deftype,
|
||||
COALESCE(gt.rolname, 'PUBLIC') grantee,
|
||||
g.rolname grantor,
|
||||
|
||||
@@ -235,15 +235,6 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
kwargs['sid'])
|
||||
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
|
||||
self.acl = ['U']
|
||||
|
||||
@@ -278,7 +269,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
|
||||
show_system_objects=self.blueprint.show_system_objects)
|
||||
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@@ -604,7 +595,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
"/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
|
||||
show_system_objects=self.blueprint.show_system_objects
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@@ -1157,7 +1148,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
"/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
|
||||
show_system_objects=self.blueprint.show_system_objects
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@@ -1363,7 +1354,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
"/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
|
||||
show_system_objects=self.blueprint.show_system_objects
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@@ -1431,7 +1422,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
"/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
|
||||
show_system_objects=self.blueprint.show_system_objects
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@@ -1551,7 +1542,8 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
res = dict()
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._NODES_SQL]),
|
||||
scid=scid, datlastsysoid=self.datlastsysoid,
|
||||
scid=scid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
|
||||
schema_diff=True)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
|
||||
@@ -226,14 +226,6 @@ def check_precondition(f):
|
||||
kwargs['sid']
|
||||
)
|
||||
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
|
||||
if self.manager.server_type == 'ppas':
|
||||
_temp = self.ppas_template_path(self.manager.version)
|
||||
@@ -401,7 +393,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
"""
|
||||
SQL = render_template("/".join(
|
||||
[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)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=rset)
|
||||
@@ -474,7 +466,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
"""
|
||||
SQL = render_template("/".join(
|
||||
[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)
|
||||
if not status:
|
||||
return False, internal_server_error(errormsg=res)
|
||||
@@ -649,7 +641,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
self._SQL_PREFIX + self._PROPERTIES_SQL]),
|
||||
did=did,
|
||||
vid=vid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res_data = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -774,7 +766,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
[self.template_path,
|
||||
self._SQL_PREFIX + self._PROPERTIES_SQL]),
|
||||
vid=vid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@@ -1371,7 +1363,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL]),
|
||||
vid=vid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID,
|
||||
)
|
||||
|
||||
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
|
||||
]),
|
||||
scid=scid, vid=vid, did=did,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1548,7 +1540,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
self.column_template_path, self._PROPERTIES_SQL
|
||||
]),
|
||||
scid=scid, tid=vid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, data = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1593,7 +1585,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL
|
||||
]),
|
||||
scid=scid, vid=vid, did=did,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1608,7 +1600,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
self.column_template_path, self._PROPERTIES_SQL
|
||||
]),
|
||||
scid=scid, tid=vid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
datlastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
status, data = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@@ -1653,7 +1645,8 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
if not oid:
|
||||
SQL = render_template("/".join(
|
||||
[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)
|
||||
status, views = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@@ -2063,7 +2056,7 @@ class MViewNode(ViewNode, VacuumSettings):
|
||||
"""
|
||||
SQL = render_template("/".join(
|
||||
[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)
|
||||
if not status:
|
||||
return False, internal_server_error(errormsg=res)
|
||||
@@ -2287,7 +2280,7 @@ class MViewNode(ViewNode, VacuumSettings):
|
||||
res = dict()
|
||||
SQL = render_template("/".join(
|
||||
[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)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
|
||||
@@ -231,10 +231,6 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.driver = get_driver(PG_DEFAULT_DRIVER)
|
||||
self.manager = self.driver.connection_manager(kwargs['sid'])
|
||||
self.conn = self.manager.connection(did=kwargs['did'])
|
||||
self.datlastsysoid = self.manager.db_info[kwargs['did']][
|
||||
'datlastsysoid'] if self.manager.db_info is not None \
|
||||
and kwargs['did'] in self.manager.db_info else 0
|
||||
|
||||
# Set the template path for the SQL scripts
|
||||
self.template_path = (
|
||||
"subscriptions/sql/#{0}#".format(self.manager.version)
|
||||
|
||||
@@ -32,7 +32,7 @@ FROM pg_catalog.pg_database db
|
||||
WHERE {% if did %}
|
||||
db.oid = {{ did|qtLiteral }}::OID{% else %}{% if name %}
|
||||
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 %}
|
||||
{% if db_restrictions %}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ FROM pg_catalog.pg_database db
|
||||
WHERE {% if did %}
|
||||
db.oid = {{ did|qtLiteral }}::OID{% else %}{% if name %}
|
||||
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 %}
|
||||
{% if db_restrictions %}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ FROM
|
||||
LEFT OUTER JOIN pg_catalog.pg_tablespace ta ON db.dattablespace = ta.oid
|
||||
WHERE {% if did %}
|
||||
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 %}
|
||||
{% if db_restrictions %}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ FROM pg_catalog.pg_database db
|
||||
WHERE {% if did %}
|
||||
db.oid = {{ did|qtLiteral }}::OID{% else %}{% if name %}
|
||||
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 %}
|
||||
{% if db_restrictions %}
|
||||
|
||||
|
||||
@@ -118,13 +118,11 @@ def get_attributes_from_db_info(manager, kwargs):
|
||||
|
||||
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'] \
|
||||
if 'datistemplate' in manager.db_info[kwargs['did']] else False
|
||||
datallowconn = manager.db_info[kwargs['did']]['datallowconn'] \
|
||||
if 'datallowconn' in manager.db_info[kwargs['did']] else False
|
||||
|
||||
return datlastsysoid, datistemplate, datallowconn
|
||||
return datistemplate, datallowconn
|
||||
else:
|
||||
return 0, False, True
|
||||
return False, True
|
||||
|
||||
@@ -220,11 +220,6 @@ class ResourceGroupView(NodeView):
|
||||
self.manager = self.driver.connection_manager(kwargs['sid'])
|
||||
self.conn = self.manager.connection()
|
||||
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[self.manager.did]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
self.manager.did in self.manager.db_info else 0
|
||||
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -351,7 +346,8 @@ class ResourceGroupView(NodeView):
|
||||
return gone(gettext("""Could not find the resource group."""))
|
||||
|
||||
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(
|
||||
response=res['rows'][0],
|
||||
|
||||
@@ -665,10 +665,6 @@ rolmembership:{
|
||||
_("Connection to the server has been lost.")
|
||||
)
|
||||
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[self.manager.did]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
self.manager.did in self.manager.db_info else 0
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -843,7 +839,8 @@ rolmembership:{
|
||||
return gone(self.not_found_error_msg())
|
||||
|
||||
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(
|
||||
response=res['rows'][0],
|
||||
@@ -1129,7 +1126,7 @@ rolmembership:{
|
||||
query = render_template(
|
||||
"/".join([self.sql_path, 'dependents.sql']),
|
||||
fetch_dependents=True, rid=rid,
|
||||
lastsysoid=db_row['datlastsysoid']
|
||||
lastsysoid=self._DATABASE_LAST_SYSTEM_OID
|
||||
)
|
||||
|
||||
status, result = temp_conn.execute_dict(query)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{% if fetch_database %}
|
||||
SELECT 'd' as type, datname,
|
||||
datallowconn AND pg_catalog.has_database_privilege(datname, 'CONNECT') AS datallowconn,
|
||||
datdba, datlastsysoid
|
||||
datdba
|
||||
FROM pg_catalog.pg_database db
|
||||
UNION
|
||||
SELECT 'M', spcname, null, null, null
|
||||
SELECT 'M', spcname, null, null
|
||||
FROM pg_catalog.pg_tablespace where spcowner= {{rid}}::oid
|
||||
ORDER BY 1, 2
|
||||
{% endif %}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{% if fetch_database %}
|
||||
SELECT 'd' as type, datname,
|
||||
datallowconn AND pg_catalog.has_database_privilege(datname, 'CONNECT') AS datallowconn,
|
||||
datdba, datlastsysoid
|
||||
datdba
|
||||
FROM pg_catalog.pg_database db
|
||||
UNION
|
||||
SELECT 'M', spcname, null, null, null
|
||||
SELECT 'M', spcname, null, null
|
||||
FROM pg_catalog.pg_tablespace where spcowner={{rid}}::oid
|
||||
ORDER BY 1, 2
|
||||
{% endif %}
|
||||
|
||||
@@ -106,10 +106,6 @@ class TablespaceView(PGChildNodeView):
|
||||
kwargs['sid']
|
||||
)
|
||||
self.conn = self.manager.connection()
|
||||
self.datlastsysoid = \
|
||||
self.manager.db_info[self.manager.did]['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and \
|
||||
self.manager.did in self.manager.db_info else 0
|
||||
self.datistemplate = False
|
||||
if (
|
||||
self.manager.db_info is not None and
|
||||
@@ -275,7 +271,8 @@ class TablespaceView(PGChildNodeView):
|
||||
# Making copy of output for future use
|
||||
copy_data = dict(res['rows'][0])
|
||||
copy_data['is_sys_obj'] = (
|
||||
copy_data['oid'] <= self.datlastsysoid or self.datistemplate)
|
||||
copy_data['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
|
||||
self.datistemplate)
|
||||
copy_data = self._formatter(copy_data, tsid)
|
||||
|
||||
return ajax_response(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::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'))
|
||||
UNION
|
||||
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,
|
||||
NULL AS ownertable,
|
||||
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::text
|
||||
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
|
||||
|
||||
@@ -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,
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::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'))
|
||||
UNION
|
||||
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,
|
||||
NULL AS ownertable,
|
||||
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::text
|
||||
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::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'))
|
||||
UNION
|
||||
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,
|
||||
NULL AS ownertable,
|
||||
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::text
|
||||
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::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'))
|
||||
UNION
|
||||
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,
|
||||
NULL AS ownertable,
|
||||
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::text
|
||||
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::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'))
|
||||
UNION
|
||||
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,
|
||||
NULL AS ownertable,
|
||||
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::text
|
||||
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::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'))
|
||||
UNION
|
||||
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,
|
||||
NULL AS ownertable,
|
||||
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::text
|
||||
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
|
||||
|
||||
@@ -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,
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::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'))
|
||||
UNION
|
||||
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,
|
||||
NULL AS ownertable,
|
||||
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::text
|
||||
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::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'))
|
||||
UNION
|
||||
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,
|
||||
NULL AS ownertable,
|
||||
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::text
|
||||
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::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'))
|
||||
UNION
|
||||
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,
|
||||
NULL AS ownertable,
|
||||
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::text
|
||||
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::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'))
|
||||
UNION
|
||||
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,
|
||||
NULL AS ownertable,
|
||||
CASE WHEN cl.relname IS NOT NULL OR att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 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
|
||||
@@ -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 la.oid IS NOT NULL THEN 'l'::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 fs.oid IS NOT NULL THEN 'Fs'::text
|
||||
WHEN fdw.oid IS NOT NULL THEN 'Fw'::text
|
||||
|
||||
@@ -21,6 +21,7 @@ from pgadmin.utils.ajax import make_json_response, precondition_required,\
|
||||
internal_server_error
|
||||
from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost,\
|
||||
CryptKeyMissing
|
||||
from pgadmin.utils.constants import DATABASE_LAST_SYSTEM_OID
|
||||
|
||||
|
||||
def underscore_escape(text):
|
||||
@@ -391,6 +392,7 @@ class PGChildNodeView(NodeView):
|
||||
_GET_SUBTYPES_SQL = 'get_subtypes.sql'
|
||||
_GET_EXTERNAL_FUNCTIONS_SQL = 'get_external_functions.sql'
|
||||
_GET_TABLE_FOR_PUBLICATION = 'get_tables.sql'
|
||||
_DATABASE_LAST_SYSTEM_OID = DATABASE_LAST_SYSTEM_OID
|
||||
|
||||
def get_children_nodes(self, manager, **kwargs):
|
||||
"""
|
||||
|
||||
@@ -12,6 +12,7 @@ from flask_babel import gettext
|
||||
|
||||
from pgadmin.utils.driver import get_driver
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.utils.constants import DATABASE_LAST_SYSTEM_OID
|
||||
|
||||
|
||||
def get_node_blueprint(node_type):
|
||||
@@ -111,9 +112,7 @@ class SearchObjectsHelper:
|
||||
def search(self, text, obj_type=None):
|
||||
skip_obj_type = []
|
||||
conn = self.manager.connection(did=self.did)
|
||||
last_system_oid = (self.manager.db_info[self.did])['datlastsysoid'] \
|
||||
if self.manager.db_info is not None and self.did in \
|
||||
self.manager.db_info else 0
|
||||
last_system_oid = DATABASE_LAST_SYSTEM_OID
|
||||
|
||||
show_node_prefs = self.get_show_node_prefs()
|
||||
node_labels = self.get_supported_types(skip_check=True)
|
||||
|
||||
@@ -113,3 +113,4 @@ UTILITIES_ARRAY = ['pg_dump', 'pg_dumpall', 'pg_restore', 'psql']
|
||||
|
||||
ENTER_EMAIL_ADDRESS = "Email address: "
|
||||
USER_NOT_FOUND = gettext("The specified user ID (%s) could not be found.")
|
||||
DATABASE_LAST_SYSTEM_OID = 16383
|
||||
|
||||
@@ -526,7 +526,7 @@ class Connection(BaseConnection):
|
||||
SELECT
|
||||
db.oid as did, db.datname, db.datallowconn,
|
||||
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
|
||||
FROM
|
||||
pg_catalog.pg_database db
|
||||
|
||||
@@ -217,7 +217,7 @@ SELECT
|
||||
db.oid as did, db.datname, db.datallowconn,
|
||||
pg_catalog.pg_encoding_to_char(db.encoding) AS serverencoding,
|
||||
pg_catalog.has_database_privilege(db.oid, 'CREATE') as cancreate,
|
||||
datlastsysoid, datistemplate
|
||||
datistemplate
|
||||
FROM
|
||||
pg_catalog.pg_database db
|
||||
WHERE db.oid = {0}""".format(did))
|
||||
|
||||
Reference in New Issue
Block a user