Ensure objects depending on extensions are not displayed in Schema Diff. Fixes #7221

This commit is contained in:
Akshay Joshi 2022-03-24 15:59:02 +05:30
parent 7f2e87b27d
commit 473afd950c
89 changed files with 306 additions and 67 deletions

View File

@ -21,6 +21,7 @@ Bug fixes
| `Issue #7059 <https://redmine.postgresql.org/issues/7059>`_ - Fixed an issue where the error is shown on logout when the authentication source is oauth2. | `Issue #7059 <https://redmine.postgresql.org/issues/7059>`_ - Fixed an issue where the error is shown on logout when the authentication source is oauth2.
| `Issue #7216 <https://redmine.postgresql.org/issues/7216>`_ - Ensure that the values of certain fields are prettified in the statistics tab for collection nodes. | `Issue #7216 <https://redmine.postgresql.org/issues/7216>`_ - Ensure that the values of certain fields are prettified in the statistics tab for collection nodes.
| `Issue #7221 <https://redmine.postgresql.org/issues/7221>`_ - Ensure objects depending on extensions are not displayed in Schema Diff.
| `Issue #7238 <https://redmine.postgresql.org/issues/7238>`_ - Fixed an issue where foreign key is not removed even if the referred table is removed in ERD. | `Issue #7238 <https://redmine.postgresql.org/issues/7238>`_ - Fixed an issue where foreign key is not removed even if the referred table is removed in ERD.
| `Issue #7257 <https://redmine.postgresql.org/issues/7257>`_ - Support running the container under OpenShift with alternate UIDs. | `Issue #7257 <https://redmine.postgresql.org/issues/7257>`_ - Support running the container under OpenShift with alternate UIDs.
| `Issue #7261 <https://redmine.postgresql.org/issues/7261>`_ - Correct typo in the documentation. | `Issue #7261 <https://redmine.postgresql.org/issues/7261>`_ - Correct typo in the documentation.

View File

@ -774,9 +774,10 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
last_system_oid = (self.manager.db_info[did])['datlastsysoid'] last_system_oid = (self.manager.db_info[did])['datlastsysoid']
sql = render_template( sql = render_template(
"/".join([self.template_path, 'nodes.sql']), "/".join([self.template_path, self._NODES_SQL]),
datlastsysoid=last_system_oid, datlastsysoid=last_system_oid,
showsysobj=self.blueprint.show_system_objects showsysobj=self.blueprint.show_system_objects,
schema_diff=True
) )
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:

View File

@ -21,4 +21,8 @@
{% endif %} {% endif %}
ca.oid > {{datlastsysoid}}::OID ca.oid > {{datlastsysoid}}::OID
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = ca.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY st.typname, tt.typname ORDER BY st.typname, tt.typname

View File

@ -853,14 +853,9 @@ class EventTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = dict() res = dict()
last_system_oid = 0
if self.manager.db_info is not None and did in self.manager.db_info:
last_system_oid = (self.manager.db_info[did])['datlastsysoid']
sql = render_template( sql = render_template(
"/".join([self.template_path, 'nodes.sql']), "/".join([self.template_path, self._NODES_SQL]),
datlastsysoid=last_system_oid, schema_diff=True
showsysobj=self.blueprint.show_system_objects
) )
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:

View File

@ -3,4 +3,8 @@ FROM pg_catalog.pg_event_trigger e
{% if etid %} {% if etid %}
WHERE e.oid={{etid}}::oid WHERE e.oid={{etid}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
WHERE CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = e.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY e.evtname ORDER BY e.evtname

View File

@ -561,7 +561,7 @@ class ExtensionView(PGChildNodeView, SchemaDiffObjectCompare):
res = dict() res = dict()
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
'properties.sql'])) self._PROPERTIES_SQL]))
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:
return internal_server_error(errormsg=rset) return internal_server_error(errormsg=rset)

View File

@ -963,7 +963,8 @@ class ForeignDataWrapperView(PGChildNodeView, SchemaDiffObjectCompare):
res = dict() res = dict()
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
'properties.sql'])) self._PROPERTIES_SQL]),
schema_diff=True)
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:
return internal_server_error(errormsg=rset) return internal_server_error(errormsg=rset)

View File

@ -924,7 +924,8 @@ class ForeignServerView(PGChildNodeView, SchemaDiffObjectCompare):
res = dict() res = dict()
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
'properties.sql'])) self._PROPERTIES_SQL]),
schema_diff=True)
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:
return internal_server_error(errormsg=rset) return internal_server_error(errormsg=rset)

View File

@ -22,5 +22,9 @@ WHERE srvfdw={{fid}}::oid
{% if fsid %} {% if fsid %}
WHERE srv.oid={{fsid}}::oid WHERE srv.oid={{fsid}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
WHERE CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = srv.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY srvname; ORDER BY srvname;
{% endif %} {% endif %}

View File

@ -548,7 +548,7 @@ class UserMappingView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
try: try:
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
'properties.sql']), self._PROPERTIES_SQL]),
umid=umid, conn=self.conn) umid=umid, conn=self.conn)
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
if not status: if not status:
@ -905,7 +905,8 @@ class UserMappingView(PGChildNodeView, SchemaDiffObjectCompare):
res = dict() res = dict()
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
'properties.sql'])) self._PROPERTIES_SQL]),
schema_diff=True)
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:
return internal_server_error(errormsg=rset) return internal_server_error(errormsg=rset)

View File

@ -14,5 +14,9 @@ ORDER BY 2;
SELECT u.umid AS oid, u.usename AS name, u.srvid AS fsid, pg_catalog.array_to_string(u.umoptions, ',') AS umoptions, fs.srvfdw AS fdwid SELECT u.umid AS oid, u.usename AS name, u.srvid AS fsid, pg_catalog.array_to_string(u.umoptions, ',') AS umoptions, fs.srvfdw AS fdwid
FROM pg_catalog.pg_user_mappings u FROM pg_catalog.pg_user_mappings u
LEFT JOIN pg_catalog.pg_foreign_server fs ON fs.oid = u.srvid LEFT JOIN pg_catalog.pg_foreign_server fs ON fs.oid = u.srvid
{% if schema_diff %}
WHERE CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = u.umid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY 2; ORDER BY 2;
{% endif %} {% endif %}

View File

@ -23,4 +23,8 @@ WHERE fdw.oid={{fid}}::oid
{% if fname %} {% if fname %}
WHERE fdw.fdwname={{ fname|qtLiteral }}::text WHERE fdw.fdwname={{ fname|qtLiteral }}::text
{% endif %} {% endif %}
{% if schema_diff %}
WHERE CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = fdw.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY fdwname ORDER BY fdwname

View File

@ -829,7 +829,8 @@ class LanguageView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = dict() res = dict()
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
'properties.sql'])) self._PROPERTIES_SQL]),
schema_diff=True)
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:
return internal_server_error(errormsg=rset) return internal_server_error(errormsg=rset)

View File

@ -20,4 +20,8 @@ WHERE lanispl IS TRUE
{% if lanname %} AND {% if lanname %} AND
lanname={{ lanname|qtLiteral }}::text lanname={{ lanname|qtLiteral }}::text
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = lan.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY lanname ORDER BY lanname

View File

@ -292,7 +292,7 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = [] res = []
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
'nodes.sql'])) self._NODES_SQL]))
status, result = self.conn.execute_2darray(sql) status, result = self.conn.execute_2darray(sql)
if not status: if not status:
return internal_server_error(errormsg=result) return internal_server_error(errormsg=result)
@ -900,14 +900,9 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
if self.manager.version < 100000: if self.manager.version < 100000:
return res return res
last_system_oid = 0
if self.manager.db_info is not None and did in self.manager.db_info:
last_system_oid = (self.manager.db_info[did])['datlastsysoid']
sql = render_template( sql = render_template(
"/".join([self.template_path, 'nodes.sql']), "/".join([self.template_path, self._NODES_SQL]),
datlastsysoid=last_system_oid, schema_diff=True
showsysobj=self.blueprint.show_system_objects
) )
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:

View File

@ -1 +1,6 @@
SELECT oid , pubname AS name FROM pg_catalog.pg_publication; SELECT oid , pubname AS name
FROM pg_catalog.pg_publication
{% if schema_diff %}
WHERE CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}

View File

@ -799,7 +799,8 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = dict() res = dict()
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), scid=scid) self._NODES_SQL]), scid=scid,
schema_diff=True)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -5,4 +5,8 @@ WHERE c.collnamespace = {{scid}}::oid
{% elif coid %} {% elif coid %}
WHERE c.oid = {{coid}}::oid WHERE c.oid = {{coid}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY c.collname; ORDER BY c.collname;

View File

@ -831,7 +831,7 @@ AND relkind != 'c'))"""
data['is_schema_diff'] = True data['is_schema_diff'] = True
SQL = render_template( SQL = render_template(
"/".join([self.template_path, 'update.sql']), "/".join([self.template_path, self._UPDATE_SQL]),
data=data, o_data=old_data) data=data, o_data=old_data)
return SQL, data return SQL, data
@ -935,7 +935,8 @@ AND relkind != 'c'))"""
""" """
res = dict() res = dict()
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODE_SQL]), scid=scid) self._NODE_SQL]), scid=scid,
schema_diff=True)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:
return internal_server_error(errormsg=rset) return internal_server_error(errormsg=rset)

View File

@ -13,5 +13,9 @@ WHERE
{% elif doid %} {% elif doid %}
WHERE d.oid = {{doid}}::oid WHERE d.oid = {{doid}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = d.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
d.typname; d.typname;

View File

@ -1542,7 +1542,8 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
""" """
res = dict() res = dict()
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODE_SQL]), scid=scid) self._NODE_SQL]), scid=scid,
schema_diff=True)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -15,4 +15,8 @@ WHERE
{% elif foid %} {% elif foid %}
c.oid = {{foid}}::oid c.oid = {{foid}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY c.relname; ORDER BY c.relname;

View File

@ -943,7 +943,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
data = {'schema': scid} data = {'schema': scid}
# Fetch schema name from schema oid # Fetch schema name from schema oid
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
'schema.sql']), self._SCHEMA_SQL]),
data=data, data=data,
conn=self.conn, conn=self.conn,
) )
@ -1014,7 +1014,8 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = dict() res = dict()
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), scid=scid) self._NODES_SQL]), scid=scid,
schema_diff=True)
status, fts_cfg = self.conn.execute_2darray(SQL) status, fts_cfg = self.conn.execute_2darray(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -9,5 +9,9 @@ WHERE
{% elif cfgid %} {% elif cfgid %}
cfg.oid = {{cfgid}}::OID cfg.oid = {{cfgid}}::OID
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = cfg.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY name ORDER BY name

View File

@ -922,7 +922,8 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = dict() res = dict()
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), scid=scid) self._NODES_SQL]), scid=scid,
schema_diff=True)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -10,5 +10,8 @@ WHERE
{% elif dcid %} {% elif dcid %}
dict.oid = {{dcid}}::OID dict.oid = {{dcid}}::OID
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = dict.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY name ORDER BY name

View File

@ -888,7 +888,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
data = {'schema': scid} data = {'schema': scid}
# Fetch schema name from schema oid # Fetch schema name from schema oid
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
'schema.sql']), self._SCHEMA_SQL]),
data=data, data=data,
conn=self.conn, conn=self.conn,
) )
@ -959,7 +959,8 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = dict() res = dict()
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), scid=scid) self._NODES_SQL]), scid=scid,
schema_diff=True)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -9,5 +9,8 @@ WHERE
{% elif pid %} {% elif pid %}
prs.oid = {{pid}}::OID prs.oid = {{pid}}::OID
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = prs.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY name ORDER BY name

View File

@ -765,7 +765,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
data = {'schema': scid} data = {'schema': scid}
# Fetch schema name from schema oid # Fetch schema name from schema oid
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
'schema.sql']), self._SCHEMA_SQL]),
data=data, data=data,
conn=self.conn, conn=self.conn,
) )
@ -832,7 +832,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = dict() res = dict()
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), scid=scid) self._NODES_SQL]), scid=scid,
schema_diff=True)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -8,5 +8,8 @@ WHERE
{% elif tid %} {% elif tid %}
tmpl.oid = {{tid}}::OID tmpl.oid = {{tid}}::OID
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = tmpl.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY name ORDER BY name

View File

@ -1960,7 +1960,8 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
if not oid: if not oid:
sql = render_template("/".join([self.sql_template_path, sql = render_template("/".join([self.sql_template_path,
self._NODE_SQL]), scid=scid) self._NODE_SQL]), scid=scid,
schema_diff=True)
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -16,6 +16,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND typname NOT IN ('trigger', 'event_trigger') AND typname NOT IN ('trigger', 'event_trigger')
ORDER BY ORDER BY

View File

@ -16,6 +16,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND typname NOT IN ('trigger', 'event_trigger') AND typname NOT IN ('trigger', 'event_trigger')
ORDER BY ORDER BY

View File

@ -17,6 +17,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND typname NOT IN ('trigger', 'event_trigger') AND typname NOT IN ('trigger', 'event_trigger')
ORDER BY ORDER BY

View File

@ -17,6 +17,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND typname NOT IN ('trigger', 'event_trigger') AND typname NOT IN ('trigger', 'event_trigger')
ORDER BY ORDER BY

View File

@ -23,6 +23,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND typname NOT IN ('trigger', 'event_trigger') AND typname NOT IN ('trigger', 'event_trigger')
ORDER BY ORDER BY

View File

@ -23,6 +23,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND typname NOT IN ('trigger', 'event_trigger') AND typname NOT IN ('trigger', 'event_trigger')
ORDER BY ORDER BY

View File

@ -24,6 +24,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND typname NOT IN ('trigger', 'event_trigger') AND typname NOT IN ('trigger', 'event_trigger')
ORDER BY ORDER BY

View File

@ -16,6 +16,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND typname IN ('trigger', 'event_trigger') AND typname IN ('trigger', 'event_trigger')
AND lanname NOT IN ('edbspl', 'sql', 'internal') AND lanname NOT IN ('edbspl', 'sql', 'internal')

View File

@ -17,6 +17,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND lanname NOT IN ('edbspl', 'sql', 'internal') AND lanname NOT IN ('edbspl', 'sql', 'internal')
ORDER BY ORDER BY

View File

@ -16,6 +16,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND typname IN ('trigger', 'event_trigger') AND typname IN ('trigger', 'event_trigger')
AND lanname NOT IN ('edbspl', 'sql', 'internal') AND lanname NOT IN ('edbspl', 'sql', 'internal')

View File

@ -16,6 +16,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND typname IN ('trigger', 'event_trigger') AND lanname != 'edbspl' AND typname IN ('trigger', 'event_trigger') AND lanname != 'edbspl'
ORDER BY ORDER BY

View File

@ -16,6 +16,10 @@ WHERE
{% endif %} {% endif %}
{% if scid %} {% if scid %}
AND pronamespace = {{scid}}::oid AND pronamespace = {{scid}}::oid
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pr.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
AND typname IN ('trigger', 'event_trigger') AND typname IN ('trigger', 'event_trigger')
AND lanname NOT IN ('edbspl', 'sql', 'internal') AND lanname NOT IN ('edbspl', 'sql', 'internal')

View File

@ -830,7 +830,8 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
return res return res
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
self._NODES_SQL]), scid=scid) self._NODES_SQL]), scid=scid,
schema_diff=True)
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -6,6 +6,10 @@ WHERE nspparent = {{scid}}::oid
{% if pkgid %} {% if pkgid %}
AND nsp.oid = {{pkgid}}::oid AND nsp.oid = {{pkgid}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = nsp.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
AND nspobjecttype = 0 AND nspobjecttype = 0
AND nspcompoundtrigger = false AND nspcompoundtrigger = false
ORDER BY nspname; ORDER BY nspname;

View File

@ -6,4 +6,8 @@ WHERE nspparent = {{scid}}::oid
{% if pkgid %} {% if pkgid %}
AND nsp.oid = {{pkgid}}::oid AND nsp.oid = {{pkgid}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = nsp.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY nspname; ORDER BY nspname;

View File

@ -6,5 +6,9 @@ WHERE nspparent = {{scid}}::oid
{% if pkgid %} {% if pkgid %}
AND nsp.oid = {{pkgid}}::oid AND nsp.oid = {{pkgid}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = nsp.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
AND nspobjecttype = 0 AND nspobjecttype = 0
ORDER BY nspname; ORDER BY nspname;

View File

@ -937,7 +937,8 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = dict() res = dict()
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
self._NODES_SQL]), scid=scid) self._NODES_SQL]), scid=scid,
schema_diff=True)
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -11,4 +11,8 @@ WHERE
{% if seid %} {% if seid %}
AND cl.oid = {{seid|qtLiteral}}::oid AND cl.oid = {{seid|qtLiteral}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = cl.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY relname ORDER BY relname

View File

@ -758,7 +758,8 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
return res return res
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]), scid=scid) self._PROPERTIES_SQL]), scid=scid,
schema_diff=True)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -27,4 +27,8 @@ FROM pg_catalog.pg_synonym s JOIN pg_catalog.pg_namespace ns ON s.synnamespace
{% if syid %} {% if syid %}
AND s.oid={{syid}}::oid AND s.oid={{syid}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = s.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY synname; ORDER BY synname;

View File

@ -27,4 +27,8 @@ FROM pg_catalog.pg_synonym s JOIN pg_catalog.pg_namespace ns ON s.synnamespace
{% if syid %} {% if syid %}
AND s.oid={{syid}}::oid AND s.oid={{syid}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = s.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY synname; ORDER BY synname;

View File

@ -15,4 +15,8 @@ FROM pg_catalog.pg_synonym s JOIN pg_catalog.pg_namespace ns ON s.synnamespace
{% if syid %} {% if syid %}
AND s.oid={{syid}}::oid AND s.oid={{syid}}::oid
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = s.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY synname; ORDER BY synname;

View File

@ -973,7 +973,8 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
res = data res = data
else: else:
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), tid=tid) self._NODES_SQL]), tid=tid,
schema_diff=True)
status, triggers = self.conn.execute_2darray(SQL) status, triggers = self.conn.execute_2darray(SQL)
if not status: if not status:
current_app.logger.error(triggers) current_app.logger.error(triggers)

View File

@ -1028,7 +1028,8 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
if not oid: if not oid:
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), tid=tid) self._NODES_SQL]), tid=tid,
schema_diff=True)
status, indexes = self.conn.execute_2darray(SQL) status, indexes = self.conn.execute_2darray(SQL)
if not status: if not status:
current_app.logger.error(indexes) current_app.logger.error(indexes)

View File

@ -420,7 +420,7 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
else: else:
SQL = render_template( SQL = render_template(
"/".join([self.partition_template_path, self._NODES_SQL]), "/".join([self.partition_template_path, self._NODES_SQL]),
scid=scid, tid=tid scid=scid, tid=tid, schema_diff=True
) )
status, partitions = self.conn.execute_2darray(SQL) status, partitions = self.conn.execute_2darray(SQL)
if not status: if not status:

View File

@ -660,7 +660,8 @@ class RowSecurityView(PGChildNodeView):
if not oid: if not oid:
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), tid=tid) self._NODES_SQL]), tid=tid,
schema_diff=True)
status, policies = self.conn.execute_2darray(SQL) status, policies = self.conn.execute_2darray(SQL)
if not status: if not status:
current_app.logger.error(policies) current_app.logger.error(policies)

View File

@ -644,7 +644,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
else: else:
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), self._NODES_SQL]),
tid=tid) tid=tid, schema_diff=True)
status, rules = self.conn.execute_2darray(SQL) status, rules = self.conn.execute_2darray(SQL)
if not status: if not status:
current_app.logger.error(rules) current_app.logger.error(rules)

View File

@ -6,5 +6,9 @@ FROM pg_catalog.pg_trigger t
AND tgpackageoid != 0 AND tgpackageoid != 0
{% if trid %} {% if trid %}
AND t.oid = {{trid}}::OID AND t.oid = {{trid}}::OID
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = t.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
ORDER BY tgname; ORDER BY tgname;

View File

@ -12,5 +12,9 @@ WHERE indrelid = {{tid}}::OID
AND conname is NULL AND conname is NULL
{% if idx %} {% if idx %}
AND cls.oid = {{ idx }}::OID AND cls.oid = {{ idx }}::OID
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = cls.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
ORDER BY cls.relname ORDER BY cls.relname

View File

@ -41,4 +41,8 @@ FROM
LEFT JOIN pg_catalog.pg_type typ ON rel.reloftype=typ.oid LEFT JOIN pg_catalog.pg_type typ ON rel.reloftype=typ.oid
WHERE rel.relispartition WHERE rel.relispartition
{% if ptid %} AND rel.oid = {{ ptid }}::OID {% endif %} {% if ptid %} AND rel.oid = {{ ptid }}::OID {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = rel.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY rel.relname; ORDER BY rel.relname;

View File

@ -41,4 +41,8 @@ FROM
LEFT JOIN pg_catalog.pg_type typ ON rel.reloftype=typ.oid LEFT JOIN pg_catalog.pg_type typ ON rel.reloftype=typ.oid
WHERE rel.relispartition WHERE rel.relispartition
{% if ptid %} AND rel.oid = {{ ptid }}::OID {% endif %} {% if ptid %} AND rel.oid = {{ ptid }}::OID {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = rel.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY rel.relname; ORDER BY rel.relname;

View File

@ -9,5 +9,9 @@ WHERE
{% elif plid %} {% elif plid %}
pl.oid = {{ plid }} pl.oid = {{ plid }}
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pl.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
pl.polname; pl.polname;

View File

@ -9,5 +9,9 @@ WHERE
{% elif plid %} {% elif plid %}
pl.oid = {{ plid }} pl.oid = {{ plid }}
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = pl.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
pl.polname; pl.polname;

View File

@ -12,5 +12,9 @@ WHERE
{% elif rid %} {% elif rid %}
rw.oid = {{ rid }} rw.oid = {{ rid }}
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = rw.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
rw.rulename rw.rulename

View File

@ -8,4 +8,8 @@ FROM pg_catalog.pg_class rel
WHERE rel.relkind IN ('r','s','t','p') AND rel.relnamespace = {{ scid }}::oid WHERE rel.relkind IN ('r','s','t','p') AND rel.relnamespace = {{ scid }}::oid
AND NOT rel.relispartition AND NOT rel.relispartition
{% if tid %} AND rel.oid = {{tid}}::OID {% endif %} {% if tid %} AND rel.oid = {{tid}}::OID {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = rel.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY rel.relname; ORDER BY rel.relname;

View File

@ -6,4 +6,8 @@ SELECT rel.oid, rel.relname AS name,
FROM pg_catalog.pg_class rel FROM pg_catalog.pg_class rel
WHERE rel.relkind IN ('r','s','t') AND rel.relnamespace = {{ scid }}::oid WHERE rel.relkind IN ('r','s','t') AND rel.relnamespace = {{ scid }}::oid
{% if tid %} AND rel.oid = {{tid}}::OID {% endif %} {% if tid %} AND rel.oid = {{tid}}::OID {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = rel.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY rel.relname; ORDER BY rel.relname;

View File

@ -4,5 +4,9 @@ FROM pg_catalog.pg_trigger t
AND tgrelid = {{tid}}::OID AND tgrelid = {{tid}}::OID
{% if trid %} {% if trid %}
AND t.oid = {{trid}}::OID AND t.oid = {{trid}}::OID
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = t.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
ORDER BY tgname; ORDER BY tgname;

View File

@ -4,5 +4,9 @@ FROM pg_catalog.pg_trigger t
AND tgrelid = {{tid}}::OID AND tgrelid = {{tid}}::OID
{% if trid %} {% if trid %}
AND t.oid = {{trid}}::OID AND t.oid = {{trid}}::OID
{% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = t.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %} {% endif %}
ORDER BY tgname; ORDER BY tgname;

View File

@ -1027,7 +1027,8 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
res = data res = data
else: else:
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), tid=tid) self._NODES_SQL]), tid=tid,
schema_diff=True)
status, triggers = self.conn.execute_2darray(SQL) status, triggers = self.conn.execute_2darray(SQL)
if not status: if not status:
current_app.logger.error(triggers) current_app.logger.error(triggers)

View File

@ -511,7 +511,8 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
else: else:
res = dict() res = dict()
sql = render_template("/".join([self.table_template_path, sql = render_template("/".join([self.table_template_path,
self._NODES_SQL]), scid=scid) self._NODES_SQL]), scid=scid,
schema_diff=True)
status, tables = self.conn.execute_2darray(sql) status, tables = self.conn.execute_2darray(sql)
if not status: if not status:
return False, tables return False, tables

View File

@ -1551,7 +1551,8 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
res = dict() res = dict()
SQL = render_template("/".join([self.template_path, SQL = render_template("/".join([self.template_path,
self._NODES_SQL]), self._NODES_SQL]),
scid=scid, datlastsysoid=self.datlastsysoid) scid=scid, datlastsysoid=self.datlastsysoid,
schema_diff=True)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -10,4 +10,8 @@ WHERE t.typtype != 'd' AND t.typname NOT LIKE E'\\_%' AND t.typnamespace = {{sci
{% if not show_system_objects %} {% if not show_system_objects %}
AND ct.oid is NULL AND ct.oid is NULL
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = t.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY t.typname; ORDER BY t.typname;

View File

@ -10,4 +10,8 @@ WHERE t.typtype != 'd' AND t.typname NOT LIKE E'\\_%' AND t.typnamespace = {{sci
{% if not show_system_objects %} {% if not show_system_objects %}
AND ct.oid is NULL AND ct.oid is NULL
{% endif %} {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = t.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY t.typname; ORDER BY t.typname;

View File

@ -1653,7 +1653,8 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
if not oid: if not oid:
SQL = render_template("/".join( SQL = render_template("/".join(
[self.template_path, self._SQL_PREFIX + self._NODES_SQL]), [self.template_path, self._SQL_PREFIX + self._NODES_SQL]),
did=did, scid=scid, datlastsysoid=self.datlastsysoid) did=did, scid=scid, datlastsysoid=self.datlastsysoid,
schema_diff=True)
status, views = self.conn.execute_2darray(SQL) status, views = self.conn.execute_2darray(SQL)
if not status: if not status:
current_app.logger.error(views) current_app.logger.error(views)
@ -2286,7 +2287,8 @@ class MViewNode(ViewNode, VacuumSettings):
res = dict() res = dict()
SQL = render_template("/".join( SQL = render_template("/".join(
[self.template_path, self._SQL_PREFIX + self._NODES_SQL]), [self.template_path, self._SQL_PREFIX + self._NODES_SQL]),
did=did, scid=scid, datlastsysoid=self.datlastsysoid) did=did, scid=scid, datlastsysoid=self.datlastsysoid,
schema_diff=True)
status, rset = self.conn.execute_2darray(SQL) status, rset = self.conn.execute_2darray(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)

View File

@ -8,6 +8,10 @@ WHERE
AND c.oid = {{vid}}::oid AND c.oid = {{vid}}::oid
{% elif scid %} {% elif scid %}
AND c.relnamespace = {{scid}}::oid AND c.relnamespace = {{scid}}::oid
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
c.relname c.relname
{% endif %} {% endif %}

View File

@ -8,6 +8,10 @@ WHERE
AND c.oid = {{vid}}::oid AND c.oid = {{vid}}::oid
{% elif scid %} {% elif scid %}
AND c.relnamespace = {{scid}}::oid AND c.relnamespace = {{scid}}::oid
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
c.relname c.relname
{% endif %} {% endif %}

View File

@ -8,6 +8,10 @@ WHERE
AND c.oid = {{vid}}::oid AND c.oid = {{vid}}::oid
{% elif scid %} {% elif scid %}
AND c.relnamespace = {{scid}}::oid AND c.relnamespace = {{scid}}::oid
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
c.relname c.relname
{% endif %} {% endif %}

View File

@ -8,6 +8,10 @@ WHERE
AND c.oid = {{vid}}::oid AND c.oid = {{vid}}::oid
{% elif scid %} {% elif scid %}
AND c.relnamespace = {{scid}}::oid AND c.relnamespace = {{scid}}::oid
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
c.relname c.relname
{% endif %} {% endif %}

View File

@ -8,6 +8,10 @@ WHERE
AND c.oid = {{vid}}::oid AND c.oid = {{vid}}::oid
{% elif scid %} {% elif scid %}
AND c.relnamespace = {{scid}}::oid AND c.relnamespace = {{scid}}::oid
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
c.relname c.relname
{% endif %} {% endif %}

View File

@ -8,6 +8,10 @@ WHERE
AND c.oid = {{vid}}::oid AND c.oid = {{vid}}::oid
{% elif scid %} {% elif scid %}
AND c.relnamespace = {{scid}}::oid AND c.relnamespace = {{scid}}::oid
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
c.relname c.relname
{% endif %} {% endif %}

View File

@ -8,6 +8,10 @@ WHERE
AND c.oid = {{vid}}::oid AND c.oid = {{vid}}::oid
{% elif scid %} {% elif scid %}
AND c.relnamespace = {{scid}}::oid AND c.relnamespace = {{scid}}::oid
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
c.relname c.relname
{% endif %} {% endif %}

View File

@ -8,6 +8,10 @@ WHERE
AND c.oid = {{vid}}::oid AND c.oid = {{vid}}::oid
{% elif scid %} {% elif scid %}
AND c.relnamespace = {{scid}}::oid AND c.relnamespace = {{scid}}::oid
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
c.relname c.relname
{% endif %} {% endif %}

View File

@ -8,6 +8,10 @@ WHERE
AND c.oid = {{vid}}::oid AND c.oid = {{vid}}::oid
{% elif scid %} {% elif scid %}
AND c.relnamespace = {{scid}}::oid AND c.relnamespace = {{scid}}::oid
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
c.relname c.relname
{% endif %} {% endif %}

View File

@ -8,6 +8,10 @@ WHERE
AND c.oid = {{vid}}::oid AND c.oid = {{vid}}::oid
{% elif scid %} {% elif scid %}
AND c.relnamespace = {{scid}}::oid AND c.relnamespace = {{scid}}::oid
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
c.relname c.relname
{% endif %} {% endif %}

View File

@ -8,6 +8,10 @@ WHERE
AND c.oid = {{vid}}::oid AND c.oid = {{vid}}::oid
{% elif scid %} {% elif scid %}
AND c.relnamespace = {{scid}}::oid AND c.relnamespace = {{scid}}::oid
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = c.oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}
ORDER BY ORDER BY
c.relname c.relname
{% endif %} {% endif %}

View File

@ -280,7 +280,7 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
""" """
res = [] res = []
sql = render_template("/".join([self.template_path, sql = render_template("/".join([self.template_path,
'nodes.sql']), did=did) self._NODES_SQL]), did=did)
status, result = self.conn.execute_2darray(sql) status, result = self.conn.execute_2darray(sql)
if not status: if not status:
return internal_server_error(errormsg=result) return internal_server_error(errormsg=result)
@ -883,15 +883,9 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
if self.manager.version < 100000: if self.manager.version < 100000:
return res return res
last_system_oid = 0
if self.manager.db_info is not None and did in self.manager.db_info:
last_system_oid = (self.manager.db_info[did])['datlastsysoid']
sql = render_template( sql = render_template(
"/".join([self.template_path, 'nodes.sql']), "/".join([self.template_path, self._NODES_SQL]),
datlastsysoid=last_system_oid, did=did, schema_diff=True
showsysobj=self.blueprint.show_system_objects,
did=did
) )
status, rset = self.conn.execute_2darray(sql) status, rset = self.conn.execute_2darray(sql)
if not status: if not status:

View File

@ -3,5 +3,9 @@ WHERE
{% if subid %} {% if subid %}
sub.oid = {{ subid }}; sub.oid = {{ subid }};
{% else %} {% else %}
sub.subdbid = {{ did }}; sub.subdbid = {{ did }}
{% endif %}; {% endif %}
{% if schema_diff %}
AND CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend
WHERE objid = oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END
{% endif %}

View File

@ -276,7 +276,7 @@ class ResourceGroupView(NodeView):
sid: Server ID sid: Server ID
""" """
sql = render_template("/".join([self.sql_path, 'nodes.sql']), sql = render_template("/".join([self.sql_path, self._NODES_SQL]),
rgid=rg_id) rgid=rg_id)
status, result = self.conn.execute_2darray(sql) status, result = self.conn.execute_2darray(sql)
if not status: if not status:
@ -308,7 +308,7 @@ class ResourceGroupView(NodeView):
sid: Server ID sid: Server ID
""" """
res = [] res = []
sql = render_template("/".join([self.sql_path, 'nodes.sql'])) sql = render_template("/".join([self.sql_path, self._NODES_SQL]))
status, result = self.conn.execute_2darray(sql) status, result = self.conn.execute_2darray(sql)
if not status: if not status:
return internal_server_error(errormsg=result) return internal_server_error(errormsg=result)
@ -549,7 +549,7 @@ class ResourceGroupView(NodeView):
for rg_id in data['ids']: for rg_id in data['ids']:
# Get name for resource group from rg_id # Get name for resource group from rg_id
sql = render_template( sql = render_template(
"/".join([self.sql_path, 'delete.sql']), "/".join([self.sql_path, self._DELETE_SQL]),
rgid=rg_id, conn=self.conn rgid=rg_id, conn=self.conn
) )
status, rgname = self.conn.execute_scalar(sql) status, rgname = self.conn.execute_scalar(sql)
@ -570,7 +570,7 @@ class ResourceGroupView(NodeView):
# drop resource group # drop resource group
sql = render_template( sql = render_template(
"/".join([self.sql_path, 'delete.sql']), "/".join([self.sql_path, self._DELETE_SQL]),
rgname=rgname, conn=self.conn rgname=rgname, conn=self.conn
) )
status, res = self.conn.execute_scalar(sql) status, res = self.conn.execute_scalar(sql)