diff --git a/docs/en_US/database_dialog.rst b/docs/en_US/database_dialog.rst
index b8231406f..b89161e8b 100644
--- a/docs/en_US/database_dialog.rst
+++ b/docs/en_US/database_dialog.rst
@@ -46,6 +46,7 @@ Use the *Definition* tab to set properties for the database:
 * Specify a connection limit in the *Connection Limit* field to configure the
   maximum number of connection requests. The default value (*-1*) allows
   unlimited connections to the database.
+* If the *templates?* is set to true, then database will be a template database.
 
 Click the *Security* tab to continue.
 
diff --git a/docs/en_US/images/database_definition.png b/docs/en_US/images/database_definition.png
index 47b1e7f35d829ef554288154b025f48115181616..d7a56aa157251f6270f313401ae103f2feed78cc 100644
GIT binary patch
diff --git a/docs/en_US/images/preferences_browser_display.png b/docs/en_US/images/preferences_browser_display.png
index 62e3c8db421330c4cc8df0028a669157c893d43b..8f2529db82224d0324a8da80c18e9a353a8e7710 100644
GIT binary patch
diff --git a/docs/en_US/preferences.rst b/docs/en_US/preferences.rst
index e0f0fca2f..3d29ea07c 100644
--- a/docs/en_US/preferences.rst
+++ b/docs/en_US/preferences.rst
@@ -68,6 +68,8 @@ Use the fields on the *Display* panel to specify general display preferences:
 * When the *Show system objects?* switch is set to *True*, the client will
   display system objects such as system schemas (for example, *pg_temp*) or
   system columns (for example,  *xmin* or *ctid*) in the tree control.
+* When the *Show user defined templates?* switch is set to *True*, the client will
+  display user defined template databases.
 
 Use the fields on the *Keyboard shortcuts* panel to configure shortcuts for the
 main window navigation:
diff --git a/web/pgadmin/browser/collection.py b/web/pgadmin/browser/collection.py
index 6040cf651..aff57fcba 100644
--- a/web/pgadmin/browser/collection.py
+++ b/web/pgadmin/browser/collection.py
@@ -236,6 +236,16 @@ class CollectionNodeModule(PgAdminModule, PGChildModule):
         else:
             return False
 
+    @property
+    def show_user_defined_database_template(self):
+        """
+        Show/Hide the user defined template in the database server.
+        """
+        if self.pref_show_user_defined_templates:
+            return self.pref_show_user_defined_templates.get()
+        else:
+            return False
+
     def register_preferences(self):
         """
         register_preferences
@@ -251,6 +261,8 @@ class CollectionNodeModule(PgAdminModule, PGChildModule):
         self.pref_show_system_objects = self.browser_preference.preference(
             'show_system_objects'
         )
+        self.pref_show_user_defined_templates = \
+            self.browser_preference.preference('show_user_defined_templates')
         self.pref_show_node = self.browser_preference.register(
             'node', 'show_node_' + self.node_type,
             self.collection_label, 'node', self.SHOW_ON_BROWSER,
diff --git a/web/pgadmin/browser/register_browser_preferences.py b/web/pgadmin/browser/register_browser_preferences.py
index 5d3482be4..cb419f9c3 100644
--- a/web/pgadmin/browser/register_browser_preferences.py
+++ b/web/pgadmin/browser/register_browser_preferences.py
@@ -27,6 +27,13 @@ def register_browser_preferences(self):
         gettext("Show system objects?"), 'boolean', False,
         category_label=PREF_LABEL_DISPLAY
     )
+
+    self.show_user_defined_templates = self.preference.register(
+        'display', 'show_user_defined_templates',
+        gettext("Show user defined templates?"), 'boolean', False,
+        category_label=PREF_LABEL_DISPLAY
+    )
+
     if config.SERVER_MODE:
         self.hide_shared_server = self.preference.register(
             'display', 'hide_shared_server',
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index 292d88d17..c9274d64f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -230,21 +230,29 @@ class DatabaseView(PGChildNodeView):
             conn=self.conn,
             last_system_oid=last_system_oid,
             db_restrictions=db_disp_res,
-            show_system_objects=self.blueprint.show_system_objects,
         )
         status, res = self.conn.execute_dict(SQL, params)
 
         if not status:
             return internal_server_error(errormsg=res)
 
+        result_set = []
         for row in res['rows']:
+            row['is_sys_obj'] = (
+                row['did'] <= self._DATABASE_LAST_SYSTEM_OID or
+                self.datistemplate)
+            if self.skip_db(row):
+                continue
+
             if self.manager.db == row['name']:
                 row['canDrop'] = False
             else:
                 row['canDrop'] = True
 
+            result_set.append(row)
+
         return ajax_response(
-            response=res['rows'],
+            response=result_set,
             status=200
         )
 
@@ -256,6 +264,32 @@ class DatabaseView(PGChildNodeView):
 
         return last_system_oid
 
+    def get_icon(self, res, connected):
+        if not connected and not res['is_template']:
+            icon = "icon-database-not-connected"
+        elif not connected and res['is_template']:
+            icon = 'icon-database-template-not-connected'
+        elif connected and res['is_template']:
+            icon = 'icon-database-template-connected'
+        else:
+            icon = "pg-icon-database"
+
+        return icon
+
+    def skip_db(self, row):
+
+        if not self.blueprint.show_system_objects \
+            and row['is_sys_obj'] \
+                and row['name'] not in ('postgres', 'edb'):
+            return True
+
+        if not self.blueprint.show_user_defined_database_template \
+            and row['is_template'] and \
+            not row['is_sys_obj'] and \
+                row['name'] not in ('postgres', 'edb'):
+            return True
+        return False
+
     def get_nodes(self, gid, sid, is_schema_diff=False):
         res = []
         last_system_oid = self.retrieve_last_system_oid()
@@ -278,7 +312,6 @@ class DatabaseView(PGChildNodeView):
             "/".join([self.template_path, self._NODES_SQL]),
             last_system_oid=last_system_oid,
             db_restrictions=db_disp_res,
-            show_system_objects=self.blueprint.show_system_objects,
         )
         status, rset = self.conn.execute_dict(SQL, params)
 
@@ -287,6 +320,12 @@ class DatabaseView(PGChildNodeView):
 
         for row in rset['rows']:
             dbname = row['name']
+            row['is_sys_obj'] = (
+                row['did'] <= self._DATABASE_LAST_SYSTEM_OID or
+                self.datistemplate)
+
+            if self.skip_db(row):
+                continue
             if self.manager.db == dbname:
                 connected = True
                 can_drop = can_dis_conn = False
@@ -295,19 +334,21 @@ class DatabaseView(PGChildNodeView):
                 connected = conn.connected()
                 can_drop = can_dis_conn = True
 
+            icon = self.get_icon(row, connected)
+
             res.append(
                 self.blueprint.generate_browser_node(
                     row['did'],
                     sid,
                     row['name'],
-                    icon="icon-database-not-connected" if not connected
-                    else "pg-icon-database",
+                    icon=icon,
                     connected=connected,
                     tablespace=row['spcname'],
                     allowConn=row['datallowconn'],
                     canCreate=row['cancreate'],
                     canDisconn=can_dis_conn,
                     canDrop=can_drop,
+                    isTemplate=row['is_template'],
                     inode=True if row['datallowconn'] else False
                 )
             )
@@ -429,8 +470,7 @@ class DatabaseView(PGChildNodeView):
 
         result = res['rows'][0]
         result['is_sys_obj'] = (
-            result['oid'] <= self._DATABASE_LAST_SYSTEM_OID or
-            self.datistemplate)
+            result['oid'] <= self._DATABASE_LAST_SYSTEM_OID)
         # Fetching variable for database
         SQL = render_template(
             "/".join([self.template_path, 'get_variables.sql']),
@@ -650,7 +690,8 @@ class DatabaseView(PGChildNodeView):
                 allowConn=True,
                 canCreate=response['cancreate'],
                 canDisconn=True,
-                canDrop=True
+                canDrop=True,
+                isTemplate=response['is_template']
             )
         )
 
@@ -829,14 +870,16 @@ class DatabaseView(PGChildNodeView):
 
         can_drop = can_dis_conn = is_can_drop
 
+        icon = self.get_icon(res,
+                             self.conn.connected()
+                             if self._db['datallowconn'] else False)
+
         return jsonify(
             node=self.blueprint.generate_browser_node(
                 did,
                 sid,
                 res['name'],
-                icon="pg-icon-{0}".format(self.node_type) if
-                self._db['datallowconn'] and self.conn.connected() else
-                "icon-database-not-connected",
+                icon=icon,
                 connected=self.conn.connected() if
                 self._db['datallowconn'] else False,
                 tablespace=res['spcname'],
@@ -844,7 +887,8 @@ class DatabaseView(PGChildNodeView):
                 canCreate=res['cancreate'],
                 canDisconn=can_dis_conn,
                 canDrop=can_drop,
-                inode=True if res['datallowconn'] else False
+                inode=True if res['datallowconn'] else False,
+                isTemplate=res['is_template'],
             )
         )
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/img/template_database.svg b/web/pgadmin/browser/server_groups/servers/databases/static/img/template_database.svg
new file mode 100644
index 000000000..998c073a4
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/img/template_database.svg
@@ -0,0 +1,8 @@
+<svg width="61" height="61" viewBox="0 0 61 61" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M49.2595 21.6709C49.6766 21.1289 49.9138 20.47 49.9379 19.7865C49.9379 15.6407 40.6665 12.2488 29.2093 12.2488C17.752 12.2488 8.48062 15.6407 8.48062 19.7865C8.50468 20.47 8.74188 21.1289 9.15901 21.6709C8.71746 22.1996 8.47559 22.8665 8.47559 23.5553C8.47559 24.2441 8.71746 24.9111 9.15901 25.4397C8.71746 25.9684 8.47559 26.6353 8.47559 27.3242C8.47559 28.013 8.71746 28.6799 9.15901 29.2086C8.71746 29.7373 8.47559 30.4042 8.47559 31.093C8.47559 31.7818 8.71746 32.4487 9.15901 32.9774C8.71746 33.5061 8.47559 34.173 8.47559 34.8618C8.47559 35.5507 8.71746 36.2176 9.15901 36.7463C8.71746 37.2749 8.47559 37.9419 8.47559 38.6307C8.47559 39.3195 8.71746 39.9864 9.15901 40.5151C8.74188 41.0571 8.50468 41.716 8.48062 42.3995C8.48062 46.5453 17.752 49.9372 29.2093 49.9372C40.6665 49.9372 49.9379 46.5453 49.9379 42.3995C49.9138 41.716 49.6766 41.0571 49.2595 40.5151C49.7011 39.9864 49.9429 39.3195 49.9429 38.6307C49.9429 37.9419 49.7011 37.2749 49.2595 36.7463C49.7011 36.2176 49.9429 35.5507 49.9429 34.8618C49.9429 34.173 49.7011 33.5061 49.2595 32.9774C49.7011 32.4487 49.9429 31.7818 49.9429 31.093C49.9429 30.4042 49.7011 29.7373 49.2595 29.2086C49.7011 28.6799 49.9429 28.013 49.9429 27.3242C49.9429 26.6353 49.7011 25.9684 49.2595 25.4397C49.7011 24.9111 49.9429 24.2441 49.9429 23.5553C49.9429 22.8665 49.7011 22.1996 49.2595 21.6709Z" fill="#F9F9D1"/>
+<path d="M29.2087 27.3242C40.6568 27.3242 49.9379 23.9494 49.9379 19.7865C49.9379 15.6235 40.6574 12.2488 29.2093 12.2488C17.7611 12.2488 8.48062 15.6235 8.48062 19.7865C8.48062 23.9494 17.7606 27.3242 29.2087 27.3242Z" fill="#AC9230"/>
+<path d="M39.3128 45.2087C36.3245 45.8194 32.8783 46.1684 29.2087 46.1684C19.5604 46.1684 11.458 43.7563 9.15901 40.5151C8.74188 41.0571 8.50468 41.716 8.48062 42.3995C8.48062 46.5453 17.752 49.9372 29.2093 49.9372C32.8792 49.9372 36.3243 49.5892 39.3128 48.9799V45.2087Z" fill="#AC9230"/>
+<path d="M9.15842 29.3598C11.4574 32.601 19.5604 35.0131 29.2087 35.0131C30.3865 35.0131 31.5414 34.9771 32.6654 34.9081C32.6641 34.9926 32.6634 35.0785 32.6634 35.1657C32.6634 36.7581 32.8719 37.9147 33.2888 38.6354C31.9698 38.7315 30.6055 38.7819 29.2087 38.7819C17.7514 38.7819 8.48002 35.3899 8.48002 31.2442C8.50409 30.5607 8.74128 29.9018 9.15842 29.3598Z" fill="#AC9230"/>
+<path d="M49.7084 30.1508C49.5967 29.8692 49.4459 29.6027 49.2589 29.3598C49.0676 29.6295 48.8361 29.8935 48.5669 30.1508H49.7084Z" fill="#AC9230"/>
+<path d="M51.8746 32.6634C52.2111 32.6634 52.5299 32.6899 52.831 32.743C53.1321 32.7961 53.38 32.9644 53.5748 33.2477C53.7873 33.531 53.8936 34.0179 53.8936 34.7084C53.8936 35.3813 53.7873 35.8682 53.5748 36.1692C53.38 36.4525 53.1232 36.6207 52.8044 36.6738C52.5033 36.7269 52.1846 36.7535 51.8481 36.7535H48.182V48.9177C48.182 49.3072 48.1466 49.6879 48.0757 50.0597C48.0049 50.4138 47.8012 50.706 47.4647 50.9362C47.1459 51.1664 46.5792 51.2814 45.7645 51.2814C44.9853 51.2814 44.4274 51.1664 44.0909 50.9362C43.7544 50.6883 43.5507 50.3873 43.4799 50.0331C43.4267 49.6613 43.4002 49.2806 43.4002 48.8911V36.7535H39.7076C39.3888 36.7535 39.07 36.7269 38.7512 36.6738C38.4501 36.603 38.1933 36.4259 37.9808 36.1426C37.786 35.8593 37.6886 35.3724 37.6886 34.6819C37.6886 34.009 37.786 33.531 37.9808 33.2477C38.1933 32.9644 38.459 32.7961 38.7778 32.743C39.0965 32.6899 39.4153 32.6634 39.7341 32.6634H51.8746Z" fill="#AB6A0C"/>
+</svg>
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/img/template_database_bad.svg b/web/pgadmin/browser/server_groups/servers/databases/static/img/template_database_bad.svg
new file mode 100644
index 000000000..5bc006a2a
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/img/template_database_bad.svg
@@ -0,0 +1,10 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M19.232 8.625C19.398 8.40928 19.4924 8.14704 19.502 7.875C19.502 6.225 15.812 4.875 11.252 4.875C6.692 4.875 3.002 6.225 3.002 7.875C3.01158 8.14704 3.10598 8.40928 3.272 8.625C3.09627 8.83541 3 9.10085 3 9.375C3 9.64915 3.09627 9.91459 3.272 10.125C3.09627 10.3354 3 10.6009 3 10.875C3 11.1491 3.09627 11.4146 3.272 11.625C3.09627 11.8354 3 12.1009 3 12.375C3 12.6491 3.09627 12.9146 3.272 13.125C3.09627 13.3354 3 13.6009 3 13.875C3 14.1491 3.09627 14.4146 3.272 14.625C3.09627 14.8354 3 15.1009 3 15.375C3 15.6491 3.09627 15.9146 3.272 16.125C3.10598 16.3407 3.01158 16.603 3.002 16.875C3.002 18.525 6.692 19.875 11.252 19.875C15.812 19.875 19.502 18.525 19.502 16.875C19.4924 16.603 19.398 16.3407 19.232 16.125C19.4077 15.9146 19.504 15.6491 19.504 15.375C19.504 15.1009 19.4077 14.8354 19.232 14.625C19.4077 14.4146 19.504 14.1491 19.504 13.875C19.504 13.6009 19.4077 13.3354 19.232 13.125C19.4077 12.9146 19.504 12.6491 19.504 12.375C19.504 12.1009 19.4077 11.8354 19.232 11.625C19.4077 11.4146 19.504 11.1491 19.504 10.875C19.504 10.6009 19.4077 10.3354 19.232 10.125C19.4077 9.91459 19.504 9.64915 19.504 9.375C19.504 9.10085 19.4077 8.83541 19.232 8.625Z" fill="#F2F2F2"/>
+<path d="M11.2518 10.875C15.8081 10.875 19.502 9.53185 19.502 7.875C19.502 6.21815 15.8084 4.875 11.252 4.875C6.69565 4.875 3.002 6.21815 3.002 7.875C3.002 9.53185 6.69542 10.875 11.2518 10.875Z" fill="#717F8E"/>
+<path d="M15.2732 17.993C14.0839 18.2361 12.7123 18.375 11.2518 18.375C7.41177 18.375 4.187 17.415 3.272 16.125C3.10598 16.3407 3.01158 16.603 3.002 16.875C3.002 18.525 6.692 19.875 11.252 19.875C12.7126 19.875 14.0838 19.7365 15.2732 19.494V17.993Z" fill="#717F8E"/>
+<path d="M3.27177 11.6852C4.18677 12.9752 7.41177 13.9352 11.2518 13.9352C11.7206 13.9352 12.1802 13.9209 12.6276 13.8934C12.627 13.9271 12.6268 13.9612 12.6268 13.9959C12.6268 14.6297 12.7097 15.09 12.8756 15.3769C12.3507 15.4151 11.8077 15.4352 11.2518 15.4352C6.69177 15.4352 3.00177 14.0852 3.00177 12.4352C3.01134 12.1631 3.10575 11.9009 3.27177 11.6852Z" fill="#717F8E"/>
+<path d="M19.4107 12C19.3662 11.8879 19.3062 11.7819 19.2318 11.6852C19.1556 11.7925 19.0635 11.8976 18.9563 12H19.4107Z" fill="#717F8E"/>
+<path d="M20.2728 13C20.4067 13 20.5336 13.0106 20.6535 13.0317C20.7733 13.0529 20.872 13.1198 20.9495 13.2326C21.0341 13.3453 21.0764 13.5391 21.0764 13.8139C21.0764 14.0817 21.0341 14.2755 20.9495 14.3953C20.872 14.5081 20.7698 14.575 20.6429 14.5962C20.523 14.6173 20.3962 14.6279 20.2622 14.6279H18.8032V19.4692C18.8032 19.6243 18.7891 19.7758 18.7609 19.9238C18.7327 20.0647 18.6516 20.181 18.5177 20.2726C18.3908 20.3642 18.1652 20.41 17.841 20.41C17.5309 20.41 17.3088 20.3642 17.1749 20.2726C17.041 20.1739 16.9599 20.0541 16.9317 19.9132C16.9106 19.7652 16.9 19.6137 16.9 19.4586V14.6279H15.4303C15.3034 14.6279 15.1766 14.6173 15.0497 14.5962C14.9299 14.568 14.8277 14.4975 14.7431 14.3848C14.6655 14.272 14.6268 14.0782 14.6268 13.8034C14.6268 13.5356 14.6655 13.3453 14.7431 13.2326C14.8277 13.1198 14.9334 13.0529 15.0603 13.0317C15.1871 13.0106 15.314 13 15.4409 13H20.2728Z" fill="#717F8E"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M21.0474 3.3295C21.4868 3.76884 21.4868 4.48116 21.0474 4.9205L16.5474 9.4205C16.1081 9.85984 15.3958 9.85984 14.9565 9.4205C14.5171 8.98116 14.5171 8.26884 14.9565 7.8295L19.4565 3.3295C19.8958 2.89017 20.6081 2.89017 21.0474 3.3295Z" fill="#D0021B"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M14.9565 3.3295C15.3958 2.89017 16.1081 2.89017 16.5474 3.3295L21.0474 7.8295C21.4868 8.26884 21.4868 8.98116 21.0474 9.4205C20.6081 9.85984 19.8958 9.85984 19.4565 9.4205L14.9565 4.9205C14.5171 4.48116 14.5171 3.76884 14.9565 3.3295Z" fill="#D0021B"/>
+</svg>
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
index 4f3e63329..babc611a5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
@@ -187,7 +187,8 @@ define('pgadmin.node.database', [
                   d.is_connecting = false;
                   t.unload(i);
                   t.setInode(i);
-                  t.addIcon(i, {icon: 'icon-database-not-connected'});
+                  var dbIcon = d.isTemplate ? 'icon-database-template-not-connected':'icon-database-not-connected';
+                  t.addIcon(i, {icon: dbIcon});
                   pgBrowser.Events.trigger(
                     'pgadmin:database:connect:cancelled', i, d, self
                   );
@@ -210,6 +211,11 @@ define('pgadmin.node.database', [
           }
           return false;
         },
+        updated: (_i, _opts)=>{
+          pgBrowser.tree.refresh(_i._parent).then(() =>{
+            if (_opts && _opts.success) _opts.success();
+          });
+        },
         /* Disconnect the database */
         disconnect_database: function(args) {
           var input = args || {},
@@ -237,7 +243,8 @@ define('pgadmin.node.database', [
                       Notify.success(_.unescape(res.info));
                       t.removeIcon(i);
                       data.connected = false;
-                      data.icon = 'icon-database-not-connected';
+                      data.icon = data.isTemplate ? 'icon-database-template-not-connected':'icon-database-not-connected';
+
                       t.addIcon(i, {icon: data.icon});
                       t.unload(i);
                       pgBrowser.Events.trigger('pgadmin:browser:tree:update-tree-state', i);
@@ -294,7 +301,6 @@ define('pgadmin.node.database', [
           if(!data || data._type != 'database') {
             return false;
           }
-
           pgBrowser.tree.addIcon(item, {icon: data.icon});
           if (!data.connected && data.allowConn && !data.is_connecting) {
             data.is_connecting = true;
@@ -386,14 +392,16 @@ define('pgadmin.node.database', [
                 },
                 function(fun_error) {
                   tree.setInode(_item);
-                  tree.addIcon(_item, {icon: 'icon-database-not-connected'});
+                  var dbIcon = data.isTemplate ? 'icon-database-template-not-connected':'icon-database-not-connected';
+                  tree.addIcon(_item, {icon: dbIcon});
                   Notify.pgNotifier(fun_error, xhr, gettext('Connect  to database.'));
                 }
               );
             } else {
               if (!_status) {
                 tree.setInode(_item);
-                tree.addIcon(_item, {icon: 'icon-database-not-connected'});
+                var dbIcon = data.isTemplate ? 'icon-database-template-not-connected':'icon-database-not-connected';
+                tree.addIcon(_item, {icon: dbIcon});
               }
 
               Notify.pgNotifier('error', xhr, error, function(msg) {
@@ -422,7 +430,8 @@ define('pgadmin.node.database', [
               if (typeof res.data.icon == 'string') {
                 _tree.removeIcon(_item);
                 _data.icon = res.data.icon;
-                _tree.addIcon(_item, {icon: _data.icon});
+                var dbIcon = _data.isTemplate ? 'icon-database-template-connected':_data.icon;
+                _tree.addIcon(_item, {icon: dbIcon});
               }
               if(res.data.already_connected) {
                 res.info = gettext('Database already connected.');
@@ -457,7 +466,8 @@ define('pgadmin.node.database', [
             _tree.unload(_item);
             _tree.setInode(_item);
             _tree.removeIcon(_item);
-            _tree.addIcon(_item, {icon: 'icon-database-not-connected'});
+            var dbIcon = data.isTemplate ? 'icon-database-template-not-connected':'icon-database-not-connected';
+            _tree.addIcon(_item, {icon: dbIcon});
             obj.trigger('connect:cancelled', obj, _item, _data);
             pgBrowser.Events.trigger(
               'pgadmin:database:connect:cancelled', _item, _data, obj
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js
index 871b9db92..b47d6dbb9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js
@@ -52,7 +52,7 @@ export default class DatabaseSchema extends BaseUISchema {
     super({
       name: undefined,
       owner: undefined,
-      is_sys_obj: undefined,
+      is_sys_obj: false,
       comment: undefined,
       encoding: 'UTF8',
       template: undefined,
@@ -141,8 +141,10 @@ export default class DatabaseSchema extends BaseUISchema {
         min: -1,
       },{
         id: 'is_template', label: gettext('Template?'),
-        editable: false, type: 'switch', group: gettext('Definition'),
-        readonly: true,  mode: ['properties', 'edit'],
+        type: 'switch', group: gettext('Definition'),
+        mode: ['properties', 'edit', 'create'], readonly: function(state) {return (state.is_sys_obj); },
+        helpMessage: gettext('Note: Based on the preferences setting, this field determines whether the database is visible or hidden.'),
+        helpMessageMode: ['edit', 'create'],
       },{
         id: 'datallowconn', label: gettext('Allow connections?'),
         editable: false, type: 'switch', group: gettext('Definition'),
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/css/database.css b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/css/database.css
index 0c9ae10dd..bded90788 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/css/database.css
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/css/database.css
@@ -17,3 +17,24 @@
   height: 1.3em;
 
 }
+
+.icon-database-template-connected {
+  background-image: url('{{ url_for('NODE-database.static', filename='img/template_database.svg') }}') !important;
+  border-radius: 10px;
+  background-size: 20px !important;
+  background-repeat: no-repeat;
+  vertical-align: middle;
+  align-content: center;
+  height: 1.3em;
+}
+
+.icon-database-template-not-connected {
+  background-image: url('{{ url_for('NODE-database.static', filename='img/template_database_bad.svg') }}') !important;
+  border-radius: 10px;
+  background-size: 20px !important;
+  background-repeat: no-repeat;
+  vertical-align: middle;
+  align-content: center;
+  height: 1.3em;
+
+}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/10_plus/alter_online.sql b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/10_plus/alter_online.sql
new file mode 100644
index 000000000..ae51b7fa9
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/10_plus/alter_online.sql
@@ -0,0 +1,147 @@
+{% import 'macros/security.macros' as SECLABEL %}
+{% import 'macros/variable.macros' as VARIABLE %}
+{% import 'macros/privilege.macros' as PRIVILEGE %}
+{% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %}
+{% if data %}
+
+{# Change the default priviledges for the functions #}
+{% if data.deffuncacl %}
+{% if 'deleted' in data.deffuncacl %}
+{% for priv in data.deffuncacl.deleted %}
+{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'FUNCTIONS', priv.grantee, priv.grantor) }}
+{% endfor %}
+{% endif %}
+{% if 'changed' in data.deffuncacl %}
+{% for priv in data.deffuncacl.changed %}
+{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'FUNCTIONS', priv.grantee) }}
+{{ DEFAULT_PRIVILEGE.APPLY(conn, 'FUNCTIONS', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
+{% endfor %}
+{% endif %}
+{% if 'added' in data.deffuncacl %}
+{% for priv in data.deffuncacl.added %}
+{{ DEFAULT_PRIVILEGE.APPLY(conn, 'FUNCTIONS', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
+{% endfor %}
+{% endif %}
+{% endif %}
+
+
+{# Change the variables/options #}
+{% if data.variables and data.variables|length > 0 %}
+{% set variables = data.variables %}
+{% if 'deleted' in variables and variables.deleted|length > 0 %}
+{% for var in variables.deleted %}
+{{ VARIABLE.RESET(conn, data.name, var.role, var.name) }}
+{% endfor %}
+{% endif %}
+{% if 'added' in variables and variables.added|length > 0 %}
+{% for var in variables.added %}
+{% if var.value == True %}
+{{ VARIABLE.APPLY(conn, data.name, var.role, var.name, 'on') }}
+{% elif  var.value == False %}
+{{ VARIABLE.APPLY(conn, data.name, var.role, var.name, 'off') }}
+{% else %}
+{{ VARIABLE.APPLY(conn, data.name, var.role, var.name, var.value) }}
+{% endif %}
+{% endfor %}
+{% endif %}
+{% if 'changed' in variables and variables.changed|length > 0 %}
+{% for var in variables.changed %}
+{% if var.value == True %}
+{{ VARIABLE.APPLY(conn, data.name, var.role, var.name, 'on') }}
+{% elif  var.value == False %}
+{{ VARIABLE.APPLY(conn, data.name, var.role, var.name, 'off') }}
+{% else %}
+{{ VARIABLE.APPLY(conn, data.name, var.role, var.name, var.value) }}
+{% endif %}
+{% endfor %}
+{% endif %}
+{% endif %}
+
+{# Change the priviledges/ACLs #}
+{% if data.datacl %}
+{% if 'deleted' in data.datacl %}
+{% for priv in data.datacl.deleted %}
+{{ PRIVILEGE.RESETALL(conn, 'DATABASE', priv.grantee, data.name) }}
+{% endfor %}
+{% endif %}
+{% if 'changed' in data.datacl %}
+{% for priv in data.datacl.changed %}
+{{ PRIVILEGE.RESETALL(conn, 'DATABASE', priv.grantee, data.name) }}
+{{ PRIVILEGE.APPLY(conn, 'DATABASE', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}
+{% endfor %}
+{% endif %}
+{% if 'added' in data.datacl %}
+{% for priv in data.datacl.added %}
+{{ PRIVILEGE.APPLY(conn, 'DATABASE', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}
+{% endfor %}
+{% endif %}
+{% endif %}
+
+{# Change the default priviledges for the tables #}
+{% if data.deftblacl %}
+{% if 'deleted' in data.deftblacl %}
+{% for priv in data.deftblacl.deleted %}
+{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'TABLES', priv.grantee, priv.grantor) }}
+{% endfor %}
+{% endif %}
+{% if 'changed' in data.deftblacl %}
+{% for priv in data.deftblacl.changed %}
+{{ DEFAULT_PRIVILEGE.APPLY(conn, 'TABLES', priv.grantee, priv.without_grant, priv.with_grant) }}
+{% endfor %}
+{% endif %}
+{% if 'added' in data.deftblacl %}
+{% for priv in data.deftblacl.added %}
+{{ DEFAULT_PRIVILEGE.APPLY(conn, 'TABLES', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
+{% endfor %}
+{% endif %}
+{% endif %}
+
+{# Change the default priviledges for the sequences #}
+{% if data.deftblacl %}
+{% if data.defseqacl %}
+{% if 'deleted' in data.defseqacl %}
+{% for priv in data.defseqacl.deleted %}
+{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'SEQUENCES', priv.grantee, priv.grantor) }}
+{% endfor %}
+{% endif %}
+{% if 'changed' in data.defseqacl %}
+{% for priv in data.defseqacl.changed %}
+{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'SEQUENCES', priv.grantee) }}
+{{ DEFAULT_PRIVILEGE.APPLY(conn, 'SEQUENCES', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
+{% endfor %}
+{% endif %}
+{% if 'added' in data.defseqacl %}
+{% for priv in data.defseqacl.added %}
+{{ DEFAULT_PRIVILEGE.APPLY(conn, 'SEQUENCES', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
+{% endfor %}
+{% endif %}
+{% endif %}
+
+
+
+{% endif %}
+{# Change the security labels #}
+{% if data.seclabels and data.seclabels|length > 0 %}
+{% set seclabels = data.seclabels %}
+{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
+{% for r in seclabels.deleted %}
+{{ SECLABEL.DROP(conn, 'DATABASE', data.name, r.provider) }}
+{% endfor %}
+{% endif %}
+{% if 'added' in seclabels and seclabels.added|length > 0 %}
+{% for r in seclabels.added %}
+{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
+{% endfor %}
+{% endif %}
+{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
+{% for r in seclabels.changed %}
+{{ SECLABEL.APPLY(conn, 'DATABASE', data.name, r.provider, r.label) }}
+{% endfor %}
+{% endif %}
+{% endif %}
+{% endif %}
+
+{# Alter database to template DB or vice versa #}
+{% if data.is_template is defined %}
+ALTER DATABASE {{ conn|qtIdent(data.name) }} WITH IS_TEMPLATE  = {{ data.is_template }};
+{% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/10_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/10_plus/create.sql
new file mode 100644
index 000000000..30ed8b015
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/10_plus/create.sql
@@ -0,0 +1,20 @@
+{% if data %}
+CREATE DATABASE {{ conn|qtIdent(data.name) }}
+{% if data.datowner %}
+    WITH{% endif %}{% if data.datowner %}
+
+    OWNER = {{ conn|qtIdent(data.datowner) }}{% endif %}{% if data.template %}
+
+    TEMPLATE = {{ conn|qtIdent(data.template) }}{% endif %}{% if data.encoding %}
+
+    ENCODING = {{ data.encoding|qtLiteral }}{% endif %}{% if data.datcollate %}
+
+    LC_COLLATE = {{ data.datcollate|qtLiteral }}{% endif %}{% if data.datctype %}
+
+    LC_CTYPE = {{ data.datctype|qtLiteral }}{% endif %}{% if data.spcname %}
+
+    TABLESPACE = {{ conn|qtIdent(data.spcname) }}{% endif %}{% if data.datconnlimit %}
+
+    CONNECTION LIMIT = {{ data.datconnlimit }}
+    IS_TEMPLATE  = {{ data.is_template }}{% endif %};
+{% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/10_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/10_plus/properties.sql
new file mode 100644
index 000000000..9b4657bd4
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/10_plus/properties.sql
@@ -0,0 +1,37 @@
+SELECT
+    db.oid AS did, db.oid, db.datname AS name, db.dattablespace AS spcoid,
+    spcname, datallowconn, pg_catalog.pg_encoding_to_char(encoding) AS encoding,
+    pg_catalog.pg_get_userbyid(datdba) AS datowner,
+    (select pg_catalog.current_setting('lc_collate')) as datcollate,
+    (select pg_catalog.current_setting('lc_ctype')) as datctype,
+    datconnlimit,
+    pg_catalog.has_database_privilege(db.oid, 'CREATE') AS cancreate,
+    pg_catalog.current_setting('default_tablespace') AS default_tablespace,
+    descr.description AS comments, db.datistemplate AS is_template,
+    {### Default ACL for Tables ###}
+    '' AS tblacl,
+    {### Default ACL for Sequnces ###}
+    '' AS seqacl,
+    {### Default ACL for Functions ###}
+    '' AS funcacl,
+    pg_catalog.array_to_string(datacl::text[], ', ') AS acl
+FROM pg_catalog.pg_database db
+    LEFT OUTER JOIN pg_catalog.pg_tablespace ta ON db.dattablespace=ta.OID
+    LEFT OUTER JOIN pg_catalog.pg_shdescription descr ON (
+        db.oid=descr.objoid AND descr.classoid='pg_database'::regclass
+    )
+WHERE
+{% if show_user_defined_templates is defined  %}
+     db.datistemplate = {{show_user_defined_templates}} AND
+{% endif %}
+{% if did %}
+db.oid = {{ did|qtLiteral }}::OID{% else %}{% if name %}
+db.datname = {{ name|qtLiteral }}::text{% else %}
+db.oid > {{ last_system_oid|qtLiteral }}::OID OR db.datname IN ('postgres', 'edb')
+{% endif %}{% endif %}
+{% if db_restrictions %}
+AND
+db.datname in ({{db_restrictions}})
+{% endif %}
+
+ORDER BY datname;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/default/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/default/nodes.sql
index 328c073ca..350aeaf25 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/default/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/default/nodes.sql
@@ -1,10 +1,15 @@
 SELECT
     db.oid as did, db.datname as name, ta.spcname as spcname, db.datallowconn,
+    db.datistemplate AS is_template,
     pg_catalog.has_database_privilege(db.oid, 'CREATE') as cancreate, datdba as owner
 FROM
     pg_catalog.pg_database db
     LEFT OUTER JOIN pg_catalog.pg_tablespace ta ON db.dattablespace = ta.oid
-WHERE {% if did %}
+WHERE
+{% if show_user_defined_templates is defined  %}
+db.datistemplate in (false, {{show_user_defined_templates}}) AND
+{% endif %}
+{% if did %}
 db.oid = {{ did|qtLiteral }}::OID{% else %}
 db.oid > {{ last_system_oid }}::OID OR db.datname IN ('postgres', 'edb')
 {% endif %}
@@ -16,8 +21,6 @@ db.datname in ({{db_restrictions}})
 
 {% if show_system_objects %}
 AND db.datistemplate in (false, {{show_system_objects}})
-{% else %}
-AND db.datistemplate in (false)
 {% endif %}
 
 ORDER BY datname;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/default/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/default/properties.sql
index 5eced7dd8..08e1471cf 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/default/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/default/properties.sql
@@ -31,6 +31,4 @@ AND
 db.datname in ({{db_restrictions}})
 {% endif %}
 
-AND db.datistemplate in (false, {{show_system_objects}})
-
 ORDER BY datname;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_function.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_function.sql
index de9c22c0e..37c83408d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_function.sql
@@ -9,6 +9,7 @@ CREATE DATABASE <TEST_DB_NAME>
     LC_COLLATE = 'C'
     LC_CTYPE = 'C'
     TABLESPACE = pg_default
-    CONNECTION LIMIT = -1;
+    CONNECTION LIMIT = -1
+    IS_TEMPLATE  = False;
 
 ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_function_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_function_msql.sql
index 21f42e662..0b7485596 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_function_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_function_msql.sql
@@ -1,4 +1,3 @@
 
-
 ALTER DEFAULT PRIVILEGES FOR ROLE postgres
     REVOKE ALL ON FUNCTIONS FROM PUBLIC;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_reset_all.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_reset_all.sql
index ae9e747bb..840c50c8b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_reset_all.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_reset_all.sql
@@ -9,4 +9,5 @@ CREATE DATABASE <TEST_DB_NAME>
     LC_COLLATE = 'C'
     LC_CTYPE = 'C'
     TABLESPACE = pg_default
-    CONNECTION LIMIT = -1;
+    CONNECTION LIMIT = -1
+    IS_TEMPLATE  = False;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_sequences.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_sequences.sql
index 3fac293cf..5043cb2dd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_sequences.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_sequences.sql
@@ -9,7 +9,8 @@ CREATE DATABASE <TEST_DB_NAME>
     LC_COLLATE = 'C'
     LC_CTYPE = 'C'
     TABLESPACE = pg_default
-    CONNECTION LIMIT = -1;
+    CONNECTION LIMIT = -1
+    IS_TEMPLATE  = False;
 
 ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON TABLES FROM postgres;
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_tables.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_tables.sql
index ec797f442..c0feab321 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_tables.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_tables.sql
@@ -9,7 +9,8 @@ CREATE DATABASE <TEST_DB_NAME>
     LC_COLLATE = 'C'
     LC_CTYPE = 'C'
     TABLESPACE = pg_default
-    CONNECTION LIMIT = -1;
+    CONNECTION LIMIT = -1
+    IS_TEMPLATE  = False;
 
 ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON TABLES FROM postgres;
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_types.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_types.sql
index f3dbd0523..6314779dc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_types.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/pg/default/alter_default_db_privileges_types.sql
@@ -9,7 +9,8 @@ CREATE DATABASE <TEST_DB_NAME>
     LC_COLLATE = 'C'
     LC_CTYPE = 'C'
     TABLESPACE = pg_default
-    CONNECTION LIMIT = -1;
+    CONNECTION LIMIT = -1
+    IS_TEMPLATE  = False;
 
 ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON TABLES FROM postgres;
 
@@ -20,4 +21,3 @@ GRANT SELECT, USAGE ON SEQUENCES TO PUBLIC;
 
 ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
 
-ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE USAGE ON TYPES FROM PUBLIC;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_function.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_function.sql
index bab00465d..fe5c4464c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_function.sql
@@ -9,6 +9,7 @@ CREATE DATABASE <TEST_DB_NAME>
     LC_COLLATE = 'C'
     LC_CTYPE = 'C'
     TABLESPACE = pg_default
-    CONNECTION LIMIT = -1;
+    CONNECTION LIMIT = -1
+    IS_TEMPLATE  = False;
 
 ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_function_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_function_msql.sql
index 2cb0beecc..c256bd214 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_function_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_function_msql.sql
@@ -1,4 +1,3 @@
 
-
 ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
     REVOKE ALL ON FUNCTIONS FROM PUBLIC;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_reset_all.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_reset_all.sql
index 962ead7f5..c9217aaf2 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_reset_all.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_reset_all.sql
@@ -9,4 +9,5 @@ CREATE DATABASE <TEST_DB_NAME>
     LC_COLLATE = 'C'
     LC_CTYPE = 'C'
     TABLESPACE = pg_default
-    CONNECTION LIMIT = -1;
+    CONNECTION LIMIT = -1
+    IS_TEMPLATE  = False;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_sequences.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_sequences.sql
index 9e1146890..5e94f30c4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_sequences.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_sequences.sql
@@ -9,7 +9,8 @@ CREATE DATABASE <TEST_DB_NAME>
     LC_COLLATE = 'C'
     LC_CTYPE = 'C'
     TABLESPACE = pg_default
-    CONNECTION LIMIT = -1;
+    CONNECTION LIMIT = -1
+    IS_TEMPLATE  = False;
 
 ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM enterprisedb;
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_tables.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_tables.sql
index ec12171f3..6231c6283 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_tables.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_tables.sql
@@ -9,7 +9,8 @@ CREATE DATABASE <TEST_DB_NAME>
     LC_COLLATE = 'C'
     LC_CTYPE = 'C'
     TABLESPACE = pg_default
-    CONNECTION LIMIT = -1;
+    CONNECTION LIMIT = -1
+    IS_TEMPLATE  = False;
 
 ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM enterprisedb;
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_types.sql b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_types.sql
index 905f447f5..5e94f30c4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_types.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/ppas/default/alter_default_db_privileges_types.sql
@@ -9,7 +9,8 @@ CREATE DATABASE <TEST_DB_NAME>
     LC_COLLATE = 'C'
     LC_CTYPE = 'C'
     TABLESPACE = pg_default
-    CONNECTION LIMIT = -1;
+    CONNECTION LIMIT = -1
+    IS_TEMPLATE  = False;
 
 ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM enterprisedb;
 
@@ -19,5 +20,3 @@ ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
 GRANT SELECT, USAGE ON SEQUENCES TO PUBLIC;
 
 ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
-
-ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE USAGE ON TYPES FROM PUBLIC;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/tests/utils.py b/web/pgadmin/browser/server_groups/servers/databases/tests/utils.py
index f7c45648b..de36ff71d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/tests/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/tests/utils.py
@@ -74,6 +74,7 @@ def get_db_data(db_owner):
         "privileges": [],
         "securities": [],
         "variables": [],
+        'is_template': False,
         "schema_res": ["public", "sample"]
     }
     return data
diff --git a/web/pgadmin/misc/sql/static/js/SQL.jsx b/web/pgadmin/misc/sql/static/js/SQL.jsx
index ece393a69..c22cadf2d 100644
--- a/web/pgadmin/misc/sql/static/js/SQL.jsx
+++ b/web/pgadmin/misc/sql/static/js/SQL.jsx
@@ -46,7 +46,10 @@ export default function SQL({ nodeData, node, did,  ...props }) {
         node.url_jump_after_node
       );
       setLoaderText('Loading...');
-      if (did && !props.dbConnected) return;
+      if (did && !props.dbConnected){
+        setLoaderText('');
+        return;
+      }
       sql =
         '-- ' + gettext('No SQL could be generated for the selected object.');
 
