mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure sequences can be created with increment, start, minimum and maximum options set. Fixes #4100
This commit is contained in:
parent
ce073a2856
commit
212ca01506
@ -55,3 +55,4 @@ Bug fixes
|
||||
| `Bug #4081 <https://redmine.postgresql.org/issues/4081>`_ - Fix the RE-SQL syntax for roles with a VALID UNTIL clause.
|
||||
| `Bug #4090 <https://redmine.postgresql.org/issues/4090>`_ - Improve the German translation for Backup Server.
|
||||
| `Bug #4099 <https://redmine.postgresql.org/issues/4099>`_ - Fix SQL help for EPAS 10+, and refactor the URL generation code into a testable function.
|
||||
| `Bug #4100 <https://redmine.postgresql.org/issues/4100>`_ - Ensure sequences can be created with increment, start, minimum and maximum options set.
|
@ -349,11 +349,16 @@ class SequenceView(PGChildNodeView):
|
||||
"Could not find the required parameter (%s)." % arg
|
||||
)
|
||||
)
|
||||
# The SQL below will execute CREATE DDL only
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
|
||||
try:
|
||||
# The SQL below will execute CREATE DDL only
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
except Exception as e:
|
||||
return internal_server_error(errormsg=e)
|
||||
|
||||
status, msg = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=msg)
|
||||
|
@ -1,16 +1,16 @@
|
||||
CREATE SEQUENCE {{ conn|qtIdent(data.schema, data.name) }}{% if data.increment is defined and data.cycled %}
|
||||
|
||||
CYCLE{% endif %}{% if data.increment is defined and data.increment is number %}
|
||||
CYCLE{% endif %}{% if data.increment is defined %}
|
||||
|
||||
INCREMENT {{data.increment}}{% endif %}{% if data.start is defined and data.start is number %}
|
||||
INCREMENT {{data.increment|int}}{% endif %}{% if data.start is defined %}
|
||||
|
||||
START {{data.start}}{% elif data.current_value is defined and data.current_value is number %}
|
||||
START {{data.start|int}}{% elif data.current_value is defined %}
|
||||
|
||||
START {{data.current_value}}{% endif %}{% if data.minimum is defined and data.minimum is number %}
|
||||
START {{data.current_value|int}}{% endif %}{% if data.minimum is defined %}
|
||||
|
||||
MINVALUE {{data.minimum}}{% endif %}{% if data.maximum is defined and data.maximum is number %}
|
||||
MINVALUE {{data.minimum|int}}{% endif %}{% if data.maximum is defined %}
|
||||
|
||||
MAXVALUE {{data.maximum}}{% endif %}{% if data.cache is defined and data.cache is number %}
|
||||
MAXVALUE {{data.maximum|int}}{% endif %}{% if data.cache is defined %}
|
||||
|
||||
CACHE {{data.cache}}{% endif %};
|
||||
CACHE {{data.cache|int}}{% endif %};
|
||||
|
||||
|
@ -40,23 +40,6 @@ class SequenceAddTestCase(BaseTestGenerator):
|
||||
"start": "100"
|
||||
}
|
||||
)
|
||||
),
|
||||
(
|
||||
'Fetch sequence Node URL (invalid optional data)',
|
||||
dict(
|
||||
url='/browser/sequence/obj/',
|
||||
# Optional fields should be int but we are passing empty str
|
||||
data={
|
||||
"cache": "",
|
||||
"cycled": False,
|
||||
"increment": "",
|
||||
"maximum": "",
|
||||
"minimum": "",
|
||||
"name": "test_sequence_add_%s" % (str(uuid.uuid4())[1:8]),
|
||||
"securities": [],
|
||||
"start": ""
|
||||
}
|
||||
)
|
||||
)
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user