Initial support for PG 10.0, per #2214

This commit is contained in:
Akshay Joshi 2017-04-24 13:55:29 +01:00 committed by Dave Page
parent 3eb92f7ea3
commit 59834fba31
8 changed files with 22 additions and 42 deletions

View File

@ -11,22 +11,22 @@ ALTER SEQUENCE {{ conn|qtIdent(o_data.schema, data.name) }}
OWNER TO {{ conn|qtIdent(data.seqowner) }};
{% endif %}
{% if data.current_value %}
{% if data.current_value is defined %}
{% set seqname = conn|qtIdent(o_data.schema, data.name) %}
SELECT setval({{ seqname|qtLiteral }}, {{ data.current_value }}, true);
{% endif %}
{% set defquery = '' %}
{% if data.increment %}
{% if data.increment is defined %}
{% set defquery = defquery+'\n INCREMENT '+data.increment|string %}
{% endif %}
{% if data.minimum %}
{% if data.minimum is defined %}
{% set defquery = defquery+'\n MINVALUE '+data.minimum|string %}
{% endif %}
{% if data.maximum %}
{% if data.maximum is defined %}
{% set defquery = defquery+'\n MAXVALUE '+data.maximum|string %}
{% endif %}
{% if data.cache %}
{% if data.cache is defined %}
{% set defquery = defquery+'\n CACHE '+data.cache|string %}
{% endif %}
{% if data.cycled == True %}

View File

@ -1,37 +0,0 @@
import os
from pgadmin.utils.route import BaseTestGenerator
from regression.python_test_utils import test_utils
class TestCheckRecovery(BaseTestGenerator):
versions_to_test = ["default", "9.0_plus"]
scenarios = [
("Test for check recovery", dict())
]
def runTest(self):
cursor = test_utils.get_db_connection(self.server['db'],
self.server['username'],
self.server['db_password'],
self.server['host'],
self.server['port']).cursor()
for version in self.versions_to_test:
template_file = os.path.join(os.path.dirname(__file__), "..", version, "check_recovery.sql")
cursor.execute(open(template_file, 'r').read())
fetch_result = cursor.fetchall()
first_row = {}
for index, description in enumerate(cursor.description):
first_row[description.name] = fetch_result[0][index]
in_recovery = first_row['inrecovery']
wal_paused = first_row['isreplaypaused']
self.assertEqual(False, in_recovery)
self.assertEqual(False, wal_paused)

View File

@ -131,6 +131,22 @@ def check_precondition(f):
PG_DEFAULT_DRIVER).connection_manager(
kwargs['sid']
)
# Below check handle the case where existing server is deleted
# by user and python server will raise exception if this check
# is not introduce.
if g.manager is None:
if f.__name__ in ['activity', 'prepared', 'locks', 'config']:
return precondition_required(
gettext("Please connect to the selected server"
" to view the table.")
)
else:
return precondition_required(
gettext("Please connect to the selected server"
" to view the graph.")
)
g.conn = g.manager.connection()
# If DB not connected then return error to browser

View File

@ -16,6 +16,7 @@ class VersionedTemplateLoader(DispatchingJinjaLoader):
template_path_parts = template.split("#", 2)
server_versions = (
{'name': "10.0_plus", 'number': 100000},
{'name': "9.6_plus", 'number': 90600},
{'name': "9.5_plus", 'number': 90500},
{'name': "9.4_plus", 'number': 90400},