Fixed an issue where sequences are not created. Fixes #6128

refs #6084
This commit is contained in:
Rahul Shirsat 2021-01-11 17:29:08 +05:30 committed by Akshay Joshi
parent 90004119af
commit d55555c544
30 changed files with 250 additions and 82 deletions

View File

@ -36,4 +36,5 @@ Bug fixes
| `Issue #6084 <https://redmine.postgresql.org/issues/6084>`_ - Fixed TypeError exception in schema diff when selected any identical object.
| `Issue #6096 <https://redmine.postgresql.org/issues/6096>`_ - Updated deployment documentation, refer correctly to uWSGI where Gunicorn had been referenced.
| `Issue #6121 <https://redmine.postgresql.org/issues/6121>`_ - Fixed an issue where the database list in the new connection window is not visible.
| `Issue #6128 <https://redmine.postgresql.org/issues/6128>`_ - Fixed an issue where sequences are not created.
| `Issue #6140 <https://redmine.postgresql.org/issues/6140>`_ - Ensure that verbose logs should be visible for Utility(Backup, Maintenance) jobs.

View File

@ -216,6 +216,15 @@ class CastView(PGChildNodeView, SchemaDiffObjectCompare):
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
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
return f(*args, **kwargs)
return wrap

View File

@ -201,10 +201,14 @@ class EventTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
return f(*args, **kwargs)

View File

@ -143,10 +143,14 @@ class ExtensionView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
return f(*args, **kwargs)

View File

@ -222,10 +222,14 @@ class ForeignDataWrapperView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set the template path for the SQL scripts
self.template_path = 'foreign_data_wrappers/sql/#{0}#'.format(

View File

@ -212,10 +212,14 @@ class ForeignServerView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set the template path for the SQL scripts
self.template_path = "foreign_servers/sql/#{0}#".format(

View File

@ -229,10 +229,14 @@ class UserMappingView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set the template path for the SQL scripts
self.template_path = 'user_mappings/sql/#{0}#'.format(

View File

@ -234,10 +234,15 @@ class LanguageView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set the template path for the SQL scripts
self.template_path = (

View File

@ -145,11 +145,14 @@ def check_precondition(f):
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 \
kwargs['did'] in self.manager.db_info and \
'datistemplate' in self.manager.db_info[kwargs['did']] else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set the template path for the SQL scripts
if self.manager.server_type == 'gpdb':

View File

@ -151,10 +151,14 @@ class CatalogObjectView(PGChildNodeView):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
self.template_path = 'catalog_object/sql/{0}/#{1}#'.format(
'ppas' if self.manager.server_type == 'ppas' else 'pg',

View File

@ -178,10 +178,14 @@ class CatalogObjectColumnsView(PGChildNodeView):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
self.template_path = 'catalog_object_column/sql/#{0}#'.format(
self.manager.version)

View File

@ -198,10 +198,14 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set the template path for the SQL scripts
self.template_path = compile_template_path(

View File

@ -288,6 +288,15 @@ class DomainView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
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
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# we will set template path for sql scripts
self.template_path = compile_template_path(
'domains/sql/',
@ -450,7 +459,8 @@ 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']:
if doid <= self.manager.db_info[did]['datlastsysoid'] or \
self.datistemplate:
data['sysdomain'] = True
return True, data

View File

@ -265,10 +265,14 @@ class DomainConstraintView(PGChildNodeView):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set the template path for the SQL scripts
self.template_path = 'domain_constraints/sql/#{0}#'.format(

View File

@ -344,10 +344,14 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set template path for sql scripts depending
# on the server version.

View File

@ -232,10 +232,14 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set the template path for the SQL scripts
self.template_path = 'fts_configurations/sql/#{0}#'.format(

View File

@ -220,10 +220,15 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set the template path for the SQL scripts
self.template_path = 'fts_dictionaries/sql/#{0}#'.format(

View File

@ -234,10 +234,15 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set the template path for the SQL scripts
self.template_path = 'fts_parsers/sql/#{0}#'.format(
self.manager.version)

View File

@ -214,10 +214,15 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
self.template_path = 'fts_templates/sql/#{0}#'.format(
self.manager.version)

View File

@ -142,10 +142,14 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
self.template_path = 'sequences/sql/#{0}#'.format(
self.manager.version

View File

@ -210,10 +210,14 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
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 \
kwargs['did'] in self.manager.db_info else False
self.datistemplate = False
if (
self.manager.db_info is not None and
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# we will set template path for sql scripts
self.template_path = 'synonyms/sql/#{0}#'.format(

View File

@ -273,6 +273,15 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
]['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
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
self.table_template_path = compile_template_path(
'tables/sql',
self.manager.server_type,

View File

@ -201,6 +201,15 @@ class CheckConstraintView(PGChildNodeView):
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
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
# Set the template path for the SQL scripts
self.template_path = self.CHECK_CONSTRAINT_PATH.format(
self.manager.version)
@ -440,7 +449,7 @@ class CheckConstraintView(PGChildNodeView):
if cid:
result = res[0]
result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid)
result['oid'] <= self.datlastsysoid or self.datistemplate)
return ajax_response(
response=result,

View File

@ -227,6 +227,15 @@ class ExclusionConstraintView(PGChildNodeView):
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
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
self.template_path = self.EXCLUSION_CONSTRAINT_PATH.format(
self.manager.version)
@ -276,7 +285,7 @@ class ExclusionConstraintView(PGChildNodeView):
if exid:
result = res[0]
result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid)
result['oid'] <= self.datlastsysoid or self.datistemplate)
return ajax_response(
response=result,

View File

@ -233,6 +233,16 @@ class ForeignKeyConstraintView(PGChildNodeView):
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
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
self.template_path = self.FOREIGN_KEY_PATH.format(
self.manager.version)
@ -278,7 +288,7 @@ class ForeignKeyConstraintView(PGChildNodeView):
if fkid:
result = res[0]
result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid)
result['oid'] <= self.datlastsysoid or self.datistemplate)
return ajax_response(
response=result,

View File

@ -246,6 +246,16 @@ class IndexConstraintView(PGChildNodeView):
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
kwargs['did'] in self.manager.db_info and
'datistemplate' in self.manager.db_info[kwargs['did']]
):
self.datistemplate = self.manager.db_info[
kwargs['did']]['datistemplate']
self.template_path = self.INDEX_CONSTRAINT_PATH.format(
self.manager.version)
@ -294,7 +304,7 @@ class IndexConstraintView(PGChildNodeView):
if cid:
result = res[0]
result['is_sys_obj'] = (
result['oid'] <= self.datlastsysoid)
result['oid'] <= self.datlastsysoid or self.datistemplate)
return ajax_response(
response=result,

View File

@ -223,6 +223,15 @@ class ResourceGroupView(NodeView):
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
self.manager.did in self.manager.db_info and
'datistemplate' in self.manager.db_info[self.manager.did]
):
self.datistemplate = self.manager.db_info[
self.manager.did]['datistemplate']
if not self.conn.connected():
return precondition_required(
gettext(
@ -340,7 +349,7 @@ class ResourceGroupView(NodeView):
return gone(gettext("""Could not find the resource group."""))
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate)
return ajax_response(
response=res['rows'][0],

View File

@ -578,6 +578,14 @@ rolmembership:{
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
self.manager.did in self.manager.db_info and
'datistemplate' in self.manager.db_info[self.manager.did]
):
self.datistemplate = self.manager.db_info[
self.manager.did]['datistemplate']
self.sql_path = 'roles/sql/#{0}#'.format(self.manager.version)
@ -727,7 +735,7 @@ rolmembership:{
return gone(self.not_found_error_msg())
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
res['rows'][0]['oid'] <= self.datlastsysoid or self.datistemplate)
return ajax_response(
response=res['rows'][0],

View File

@ -111,6 +111,14 @@ class TablespaceView(PGChildNodeView):
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
self.manager.did in self.manager.db_info and
'datistemplate' in self.manager.db_info[self.manager.did]
):
self.datistemplate = self.manager.db_info[
self.manager.did]['datistemplate']
# If DB not connected then return error to browser
if not self.conn.connected():
@ -268,7 +276,7 @@ class TablespaceView(PGChildNodeView):
# Making copy of output for future use
copy_data = dict(res['rows'][0])
copy_data['is_sys_obj'] = (
copy_data['oid'] <= self.datlastsysoid)
copy_data['oid'] <= self.datlastsysoid or self.datistemplate)
copy_data = self._formatter(copy_data, tsid)
return ajax_response(

View File

@ -207,7 +207,8 @@ class ServerManager(object):
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, datlastsysoid,
datistemplate
FROM
pg_database db
WHERE db.oid = {0}""".format(did))