public inbox for [email protected]  
help / color / mirror / Atom feed
RM #1250 Collection node counts
6+ messages / 2 participants
[nested] [flat]

* RM #1250 Collection node counts
@ 2016-08-08 10:39 Akshay Joshi <[email protected]>
  2016-08-08 12:03 ` Re: RM #1250 Collection node counts Dave Page <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Akshay Joshi @ 2016-08-08 10:39 UTC (permalink / raw)
  To: pgadmin-hackers

Hi All

I have fixed the RM#1250 "Collection node counts". To fix this RM I need to
do following changes

   - Move "check_precondition" function from module's view class to global
   level within that python file itself, so that module class will use it.
   - Modified "get_nodes" function of each module's class, run the sql
   query to count the number of objects and pass the count to
   "generate_browser_collection_node" function to display the collection count.
   - Reuse SQL queries which is used to fetch nodes. Make that query as
   inner query like "SELECT count(*) FROM( <node's> query  ) AS
   collection_count". For that I'll have to remove semicolon's from some of
   the SQL queries.

One case is not handled with this patch and that is on "Refresh" of
collection node, count is not updated. If user refresh the parent node then
it will be updated. I'll create a separate RM for that.

Attached is the patch file. Please review it and let me know the review
comments.

-- 
*Akshay Joshi*
*Principal Software Engineer *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] RM_1250.patch (172.5K, 3-RM_1250.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/collection.py b/web/pgadmin/browser/collection.py
index 97f58b6..804e8b3 100644
--- a/web/pgadmin/browser/collection.py
+++ b/web/pgadmin/browser/collection.py
@@ -76,10 +76,10 @@ class CollectionNodeModule(PgAdminModule, PGChildModule):
             obj.setdefault(key, kwargs[key])
         return obj
 
-    def generate_browser_collection_node(self, parent_id, **kwargs):
+    def generate_browser_collection_node(self, parent_id, collection_count, **kwargs):
         obj = {
             "id": "coll-%s/%d" % (self.node_type, parent_id),
-            "label": self.collection_label,
+            "label": self.collection_label + ' (' + str(collection_count) + ')',
             "icon": self.collection_icon,
             "inode": True,
             "_type": 'coll-%s' % (self.node_type),
diff --git a/web/pgadmin/browser/server_groups/__init__.py b/web/pgadmin/browser/server_groups/__init__.py
index faff488..63c38e5 100644
--- a/web/pgadmin/browser/server_groups/__init__.py
+++ b/web/pgadmin/browser/server_groups/__init__.py
@@ -21,7 +21,7 @@ from pgadmin.utils.ajax import make_json_response, \
     make_response as ajax_response
 from pgadmin.utils.menu import MenuItem
 
-from pgadmin.model import db, ServerGroup
+from pgadmin.model import db, ServerGroup, Server
 
 
 class ServerGroupModule(BrowserPluginModule):
@@ -33,9 +33,14 @@ class ServerGroupModule(BrowserPluginModule):
             user_id=current_user.id
         ).order_by("id")
         for idx, group in enumerate(groups):
+
+            # Find number of servers in this group
+            servers = Server.query.filter_by(user_id=current_user.id,
+                                             servergroup_id=group.id)
+
             yield self.generate_browser_node(
                 "%d" % (group.id), None,
-                group.name,
+                group.name + ' (' + str(servers.count()) + ')',
                 "icon-%s" % self.node_type,
                 True,
                 self.node_type,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index 3b7c57b..cf76523 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -30,6 +30,45 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(action=None):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    def wrap(f):
+        @wraps(f)
+        def wrapped(self, *args, **kwargs):
+
+            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+            if action and action in ["drop"]:
+                self.conn = self.manager.connection()
+            elif 'did' in kwargs:
+                self.conn = self.manager.connection(did=kwargs['did'])
+            else:
+                self.conn = self.manager.connection()
+            # If DB not connected then return error to browser
+            if not self.conn.connected():
+                return precondition_required(
+                    _("Connection to the server has been lost!")
+                )
+
+            ver = self.manager.version
+            # we will set template path for sql scripts
+            if ver >= 90300:
+                self.template_path = 'databases/sql/9.3_plus'
+            elif ver >= 90200:
+                self.template_path = 'databases/sql/9.2_plus'
+            else:
+                self.template_path = 'databases/sql/9.1_plus'
+            return f(self, *args, **kwargs)
+
+        return wrapped
+
+    return wrap
+
+
 class DatabaseModule(CollectionNodeModule):
     NODE_TYPE = 'database'
     COLLECTION_LABEL = _("Databases")
@@ -40,12 +79,28 @@ class DatabaseModule(CollectionNodeModule):
 
         super(DatabaseModule, self).__init__(*args, **kwargs)
 
+    @check_precondition(action="nodes")
     def get_nodes(self, gid, sid):
         """
         Generate the collection node
         """
         if self.show_node:
-            yield self.generate_browser_collection_node(sid)
+            collection_count = 0
+            last_system_oid = 0 if self.show_system_objects else \
+                (self.manager.db_info[self.manager.did])['datlastsysoid']
+
+            count_sql = 'SELECT count(*) FROM( '
+            node_sql = render_template(
+                "/".join([self.template_path, 'nodes.sql']),
+                last_system_oid=last_system_oid
+            )
+            count_sql += node_sql + ' ) AS collection_count'
+
+            status, rset = self.conn.execute_scalar(count_sql)
+            if status:
+                collection_count = rset
+
+            yield self.generate_browser_collection_node(sid, collection_count)
 
     @property
     def script_load(self):
@@ -111,47 +166,10 @@ class DatabaseView(PGChildNodeView):
         }],
         'get_encodings': [{'get': 'get_encodings'}, {'get': 'get_encodings'}],
         'get_ctypes': [{'get': 'get_ctypes'}, {'get': 'get_ctypes'}],
-        'vopts': [{}, {'get': 'variable_options'}]
+        'vopts': [{}, {'get': 'variable_options'}],
+        'coll': [{}, {'get': 'collection'}]
     })
 
-    def check_precondition(action=None):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        def wrap(f):
-            @wraps(f)
-            def wrapped(self, *args, **kwargs):
-
-                self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
-                if action and action in ["drop"]:
-                    self.conn = self.manager.connection()
-                elif 'did' in kwargs:
-                    self.conn = self.manager.connection(did=kwargs['did'])
-                else:
-                    self.conn = self.manager.connection()
-                # If DB not connected then return error to browser
-                if not self.conn.connected():
-                    return precondition_required(
-                        _("Connection to the server has been lost!")
-                    )
-
-                ver = self.manager.version
-                # we will set template path for sql scripts
-                if ver >= 90300:
-                    self.template_path = 'databases/sql/9.3_plus'
-                elif ver >= 90200:
-                    self.template_path = 'databases/sql/9.2_plus'
-                else:
-                    self.template_path = 'databases/sql/9.1_plus'
-                return f(self, *args, **kwargs)
-
-            return wrapped
-
-        return wrap
-
     @check_precondition(action="list")
     def list(self, gid, sid):
         last_system_oid = 0 if self.blueprint.show_system_objects else \
diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
index 86a7eca..a5e2f38 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
@@ -25,6 +25,36 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will check the
+    database connection before running view. It will also attach
+    manager, conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+        ver = self.manager.version
+        # we will set template path for sql scripts
+        if ver >= 90100:
+            self.template_path = 'cast/sql/9.1_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class CastModule(CollectionNodeModule):
     """
      class CastModule(CollectionNodeModule)
@@ -53,6 +83,7 @@ class CastModule(CollectionNodeModule):
     def __init__(self, *args, **kwargs):
         super(CastModule, self).__init__(*args, **kwargs)
 
+    @check_precondition
     def get_nodes(self, gid, sid, did):
         """
         Generate the collection node
@@ -60,7 +91,23 @@ class CastModule(CollectionNodeModule):
         :param sid: server id
         :param did: database id
         """
-        yield self.generate_browser_collection_node(did)
+        collection_count = 0
+        last_system_oid = 0 if self.show_system_objects else \
+            (self.manager.db_info[self.manager.did])['datlastsysoid']
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template(
+            "/".join([self.template_path, 'nodes.sql']),
+            datlastsysoid=self.manager.db_info[did]['datlastsysoid'],
+            showsysobj=self.show_system_objects
+        )
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(did, collection_count)
 
     @property
     def node_inode(self):
@@ -188,35 +235,6 @@ class CastView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will check the
-        database connection before running view. It will also attach
-        manager, conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-            ver = self.manager.version
-            # we will set template path for sql scripts
-            if ver >= 90100:
-                self.template_path = 'cast/sql/9.1_plus'
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
index 9f434e1..9c625b2 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
@@ -24,6 +24,37 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        ver = self.manager.version
+        if ver >= 90300:
+            self.template_path = 'event_triggers/sql/9.3_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class EventTriggerModule(CollectionNodeModule):
     """
     class EventTriggerModule(CollectionNodeModule)
@@ -59,11 +90,22 @@ class EventTriggerModule(CollectionNodeModule):
         self.min_ver = 90300
         self.max_ver = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did):
         """
         Generate the event_trigger node
         """
-        yield self.generate_browser_collection_node(sid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'nodes.sql']))
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(sid, collection_count)
 
     @property
     def node_inode(self):
@@ -179,35 +221,6 @@ class EventTriggerView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            ver = self.manager.version
-            if ver >= 90300:
-                self.template_path = 'event_triggers/sql/9.3_plus'
-
-            return f(*args, **kwargs)
-
-        return wrap
 
     @check_precondition
     def list(self, gid, sid, did):
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
index 888393c..aff15a0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
@@ -45,6 +45,28 @@ else:
     basestring = basestring
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(
+            PG_DEFAULT_DRIVER
+        ).connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+        self.template_path = 'extensions/sql'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class ExtensionModule(CollectionNodeModule):
     """
     class ExtensionModule(Object):
@@ -62,11 +84,22 @@ class ExtensionModule(CollectionNodeModule):
         """
         super(ExtensionModule, self).__init__(*args, **kwargs)
 
+    @check_precondition
     def get_nodes(self, gid, sid, did):
         """
         Generate the collection node
         """
-        yield self.generate_browser_collection_node(did)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'properties.sql']))
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(did, collection_count)
 
     @property
     def node_inode(self):
@@ -130,27 +163,6 @@ class ExtensionView(PGChildNodeView):
         'children': [{'get': 'children'}]
     })
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(
-                PG_DEFAULT_DRIVER
-            ).connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-            self.template_path = 'extensions/sql'
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
index d4494a1..3edb755 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
@@ -27,6 +27,40 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        ver = self.manager.version
+        # we will set template path for sql scripts
+        if ver >= 90300:
+            self.template_path = 'foreign_data_wrappers/sql/9.3_plus'
+        else:
+            self.template_path = 'foreign_data_wrappers/sql/9.1_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class ForeignDataWrapperModule(CollectionNodeModule):
     """
     class ForeignDataWrapperModule(CollectionNodeModule)
@@ -63,6 +97,7 @@ class ForeignDataWrapperModule(CollectionNodeModule):
 
         super(ForeignDataWrapperModule, self).__init__(*args, **kwargs)
 
+    @check_precondition
     def get_nodes(self, gid, sid, did):
         """
         Method is used to generate the browser collection node
@@ -72,7 +107,17 @@ class ForeignDataWrapperModule(CollectionNodeModule):
             sid: Server ID
             did: Database Id
         """
-        yield self.generate_browser_collection_node(did)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'properties.sql']), conn=self.conn)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(did, collection_count)
 
     @property
     def script_load(self):
@@ -197,39 +242,6 @@ class ForeignDataWrapperView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            ver = self.manager.version
-            # we will set template path for sql scripts
-            if ver >= 90300:
-                self.template_path = 'foreign_data_wrappers/sql/9.3_plus'
-            else:
-                self.template_path = 'foreign_data_wrappers/sql/9.1_plus'
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
index f51975f..8cdf7a3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
@@ -27,6 +27,40 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        ver = self.manager.version
+        # we will set template path for sql scripts
+        if ver >= 90300:
+            self.template_path = 'foreign_servers/sql/9.3_plus'
+        else:
+            self.template_path = 'foreign_servers/sql/9.1_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class ForeignServerModule(CollectionNodeModule):
     """
     class ForeignServerModule(CollectionNodeModule)
@@ -63,6 +97,7 @@ class ForeignServerModule(CollectionNodeModule):
 
         super(ForeignServerModule, self).__init__(*args, **kwargs)
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, fid):
         """
         Method is used to generate the browser collection node
@@ -73,7 +108,18 @@ class ForeignServerModule(CollectionNodeModule):
             did: Database ID
             fid: foreign data wrapper ID
         """
-        yield self.generate_browser_collection_node(fid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'properties.sql']),
+                                   conn=self.conn, fid=fid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(fid, collection_count)
 
     @property
     def script_load(self):
@@ -191,39 +237,6 @@ class ForeignServerView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            ver = self.manager.version
-            # we will set template path for sql scripts
-            if ver >= 90300:
-                self.template_path = 'foreign_servers/sql/9.3_plus'
-            else:
-                self.template_path = 'foreign_servers/sql/9.1_plus'
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, fid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/sql/9.1_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/sql/9.1_plus/properties.sql
index 011378c..bb14018 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/sql/9.1_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/sql/9.1_plus/properties.sql
@@ -23,5 +23,5 @@ WHERE srvfdw={{fid}}::int
 {% if fsid %}
 WHERE srv.oid={{fsid}}::int
 {% endif %}
-ORDER BY srvname;
+ORDER BY srvname
 {% endif %}
\ No newline at end of file
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/sql/9.3_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/sql/9.3_plus/properties.sql
index 98154b8..8741263 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/sql/9.3_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/sql/9.3_plus/properties.sql
@@ -22,5 +22,5 @@ WHERE srvfdw={{fid}}::int
 {% if fsid %}
 WHERE srv.oid={{fsid}}::int
 {% endif %}
-ORDER BY srvname;
+ORDER BY srvname
 {% endif %}
\ No newline at end of file
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py
index c0e3f58..09762ec 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py
@@ -25,6 +25,40 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        self.template_path = 'user_mappings/sql/9.1_plus'
+
+        ver = self.manager.version
+        # we will set template path for sql scripts
+        if ver >= 90100:
+            self.template_path = 'user_mappings/sql/9.1_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class UserMappingModule(CollectionNodeModule):
     """
     class UserMappingModule(CollectionNodeModule)
@@ -64,6 +98,7 @@ class UserMappingModule(CollectionNodeModule):
 
         super(UserMappingModule, self).__init__(*args, **kwargs)
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, fid, fsid):
         """
         Method is used to generate the browser collection node
@@ -75,8 +110,18 @@ class UserMappingModule(CollectionNodeModule):
             fid: foreign data wrapper ID
             fsid: Foreign server ID
         """
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'properties.sql']),
+                                   conn=self.conn, fsid=fsid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
 
-        yield self.generate_browser_collection_node(fsid)
+        yield self.generate_browser_collection_node(fsid, collection_count)
 
     @property
     def node_inode(self):
@@ -205,39 +250,6 @@ class UserMappingView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            self.template_path = 'user_mappings/sql/9.1_plus'
-
-            ver = self.manager.version
-            # we will set template path for sql scripts
-            if ver >= 90100:
-                self.template_path = 'user_mappings/sql/9.1_plus'
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, fid, fsid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/templates/user_mappings/sql/9.1_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/templates/user_mappings/sql/9.1_plus/properties.sql
index 7996abd..1ef2db3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/templates/user_mappings/sql/9.1_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/templates/user_mappings/sql/9.1_plus/properties.sql
@@ -19,5 +19,5 @@ WITH umapData AS
 {% if fdwdata %}
     WHERE fdw.fdwname = {{fdwdata.name|qtLiteral}}::text
 {% endif %}
-    ORDER BY 2;
+    ORDER BY 2
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
index 07c04e9..d00f0dc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
@@ -27,6 +27,41 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will check the
+    database connection before running the view. It also attaches
+    manager, conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.driver = get_driver(PG_DEFAULT_DRIVER)
+        self.manager = self.driver.connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        ver = self.manager.version
+        # we will set template path for sql scripts
+        if ver >= 90300:
+            self.template_path = 'languages/sql/9.3_plus'
+        else:
+            self.template_path = 'languages/sql/9.1_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class LanguageModule(CollectionNodeModule):
     """
     class LanguageModule(CollectionNodeModule)
@@ -65,6 +100,7 @@ class LanguageModule(CollectionNodeModule):
 
         super(LanguageModule, self).__init__(*args, **kwargs)
 
+    @check_precondition
     def get_nodes(self, gid, sid, did):
         """
         Method is used to generate the browser collection node
@@ -74,7 +110,17 @@ class LanguageModule(CollectionNodeModule):
             sid: Server ID
             did: Database Id
         """
-        yield self.generate_browser_collection_node(did)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'properties.sql']))
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(did, collection_count)
 
     @property
     def node_inode(self):
@@ -204,40 +250,6 @@ class LanguageView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will check the
-        database connection before running the view. It also attaches
-        manager, conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.driver = get_driver(PG_DEFAULT_DRIVER)
-            self.manager = self.driver.connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            ver = self.manager.version
-            # we will set template path for sql scripts
-            if ver >= 90300:
-                self.template_path = 'languages/sql/9.3_plus'
-            else:
-                self.template_path = 'languages/sql/9.1_plus'
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
index 4671897..ec7414b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
@@ -44,6 +44,47 @@ from config import PG_DEFAULT_DRIVER
 """
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to instance of the method.
+
+    Assumptions:
+        This function will always be used as decorator of a class method.
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
+            kwargs['sid']
+        )
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext("Connection to the server has been lost!")
+            )
+
+        # Set template path for sql scripts
+        if hasattr(self, 'NODE_TYPE'):
+            initial_path = self.NODE_TYPE
+        else:
+            initial_path = self.template_initial
+
+        self.template_path = initial_path + '/' + (
+            SchemaView.ppas_template_path(self.manager.version)
+            if self.manager.server_type == 'ppas' else
+            SchemaView.pg_template_path(self.manager.version)
+        )
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class SchemaModule(CollectionNodeModule):
     """
      class SchemaModule(CollectionNodeModule)
@@ -81,11 +122,26 @@ class SchemaModule(CollectionNodeModule):
 
         super(SchemaModule, self).__init__(*args, **kwargs)
 
+    @check_precondition
     def get_nodes(self, gid, sid, did):
         """
         Generate the collection node
         """
-        yield self.generate_browser_collection_node(did)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template(
+            "/".join([self.template_path, 'sql/nodes.sql']),
+            show_sysobj=self.show_system_objects,
+            _=gettext
+        )
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(did, collection_count)
 
     @property
     def script_load(self):
@@ -111,42 +167,6 @@ schema_blueprint = SchemaModule(__name__)
 catalog_blueprint = CatalogModule(__name__)
 
 
-def check_precondition(f):
-    """
-    This function will behave as a decorator which will checks
-    database connection before running view, it will also attaches
-    manager,conn & template_path properties to instance of the method.
-
-    Assumptions:
-        This function will always be used as decorator of a class method.
-    """
-
-    @wraps(f)
-    def wrap(*args, **kwargs):
-        # Here args[0] will hold self & kwargs will hold gid,sid,did
-        self = args[0]
-        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
-            kwargs['sid']
-        )
-        self.conn = self.manager.connection(did=kwargs['did'])
-        # If DB not connected then return error to browser
-        if not self.conn.connected():
-            return precondition_required(
-                gettext("Connection to the server has been lost!")
-            )
-
-        # Set template path for sql scripts
-        self.template_path = self.template_initial + '/' + (
-            self.ppas_template_path(self.manager.version)
-            if self.manager.server_type == 'ppas' else
-            self.pg_template_path(self.manager.version)
-        )
-
-        return f(*args, **kwargs)
-
-    return wrap
-
-
 class SchemaView(PGChildNodeView):
     """
     This class is responsible for generating routes for schema node.
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/__init__.py
index e55afdf..77e18bd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/__init__.py
@@ -25,6 +25,38 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
+            kwargs['sid']
+        )
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        self.template_path = 'catalog_object/sql/{0}/9.1_plus'.format(
+            'ppas' if self.manager.server_type == 'ppas' else 'pg'
+        )
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class CatalogObjectModule(SchemaChildModule):
     """
      class CatalogObjectModule(SchemaChildModule)
@@ -65,11 +97,23 @@ class CatalogObjectModule(SchemaChildModule):
         self.min_ver = None
         self.max_ver = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the collection node
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'nodes.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def script_load(self):
@@ -131,37 +175,6 @@ class CatalogObjectView(PGChildNodeView):
         'module.js': [{}, {}, {'get': 'module_js'}]
     })
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
-                kwargs['sid']
-            )
-            self.conn = self.manager.connection(did=kwargs['did'])
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            self.template_path = 'catalog_object/sql/{0}/9.1_plus'.format(
-                'ppas' if self.manager.server_type == 'ppas' else 'pg'
-            )
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/__init__.py
index b0e784f..ad22506 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/__init__.py
@@ -25,6 +25,36 @@ from pgadmin.utils.preferences import Preferences
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
+            kwargs['sid']
+        )
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        self.template_path = 'catalog_object_column/sql/9.1_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class CatalogObjectColumnsModule(CollectionNodeModule):
     """
      class ColumnModule(CollectionNodeModule)
@@ -62,11 +92,23 @@ class CatalogObjectColumnsModule(CollectionNodeModule):
         self.min_ver = None
         self.max_ver = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid, coid):
         """
         Generate the collection node
         """
-        yield self.generate_browser_collection_node(coid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path,'nodes.sql']),
+                                   coid=coid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(coid, collection_count)
 
     @property
     def script_load(self):
@@ -151,35 +193,6 @@ class CatalogObjectColumnsView(PGChildNodeView):
         'module.js': [{}, {}, {'get': 'module_js'}]
     })
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
-                kwargs['sid']
-            )
-            self.conn = self.manager.connection(did=kwargs['did'])
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            self.template_path = 'catalog_object_column/sql/9.1_plus'
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid, coid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/sql/pg/9.1_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/sql/pg/9.1_plus/nodes.sql
index 8a8dad0..1c9e08d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/sql/pg/9.1_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/sql/pg/9.1_plus/nodes.sql
@@ -3,4 +3,4 @@ SELECT
 FROM
     pg_class c
 WHERE relnamespace = {{scid}}::int
-ORDER BY relname;
+ORDER BY relname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/sql/ppas/9.1_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/sql/ppas/9.1_plus/nodes.sql
index f510f49..15489c0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/sql/ppas/9.1_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/sql/ppas/9.1_plus/nodes.sql
@@ -8,4 +8,4 @@ OR  (
 	AND
 	(c.relname NOT LIKE '\\_%' AND c.relname = 'dual' AND  c.relname = 'type_object_source')
     )
-ORDER BY relname;
+ORDER BY relname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
index c4e7bc3..034f2ff 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
@@ -26,6 +26,36 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
+            kwargs['sid']
+        )
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        # we will set template path for sql scripts
+        self.template_path = 'collation/sql/9.1_plus'
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class CollationModule(SchemaChildModule):
     """
      class CollationModule(CollectionNodeModule)
@@ -64,11 +94,23 @@ class CollationModule(SchemaChildModule):
         self.min_ver = 90100
         self.max_ver = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the collection node
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'nodes.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def script_load(self):
@@ -170,35 +212,6 @@ class CollationView(PGChildNodeView):
                            {'get': 'get_collation'}]
     })
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
-                kwargs['sid']
-            )
-            self.conn = self.manager.connection(did=kwargs['did'])
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            # we will set template path for sql scripts
-            self.template_path = 'collation/sql/9.1_plus'
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/sql/9.1_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/sql/9.1_plus/nodes.sql
index de932b2..e8f5c9f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/sql/9.1_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/sql/9.1_plus/nodes.sql
@@ -1,4 +1,4 @@
 SELECT c.oid, c.collname AS name
 FROM pg_collation c
 WHERE c.collnamespace = {{scid}}::oid
-ORDER BY c.collname;
+ORDER BY c.collname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py
index c94525a..4ea85a5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py
@@ -28,6 +28,40 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    Works as a decorator.
+    Checks database connection status.
+    Attach connection object and template path.
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        self = args[0]
+        driver = get_driver(PG_DEFAULT_DRIVER)
+        self.manager = driver.connection_manager(kwargs['sid'])
+        # Get database connection
+        self.conn = self.manager.connection(did=kwargs['did'])
+        self.qtIdent = driver.qtIdent
+
+        if not self.conn.connected():
+            return precondition_required(
+                gettext("Connection to the server has been lost!")
+            )
+
+        ver = self.manager.version
+        server_type = self.manager.server_type
+
+        # we will set template path for sql scripts
+        if ver >= 90200:
+            self.template_path = 'domains/sql/9.2_plus'
+        elif ver >= 90100:
+            self.template_path = 'domains/sql/9.1_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
 class DomainModule(SchemaChildModule):
     """
     class DomainModule(SchemaChildModule):
@@ -55,11 +89,23 @@ class DomainModule(SchemaChildModule):
         self.min_ver = None
         self.max_ver = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the domain collection node.
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'node.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def script_load(self):
@@ -247,40 +293,6 @@ class DomainView(PGChildNodeView, DataTypeReader):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        Works as a decorator.
-        Checks database connection status.
-        Attach connection object and template path.
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            self = args[0]
-            driver = get_driver(PG_DEFAULT_DRIVER)
-            self.manager = driver.connection_manager(kwargs['sid'])
-            # Get database connection
-            self.conn = self.manager.connection(did=kwargs['did'])
-            self.qtIdent = driver.qtIdent
-
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext("Connection to the server has been lost!")
-                )
-
-            ver = self.manager.version
-            server_type = self.manager.server_type
-
-            # we will set template path for sql scripts
-            if ver >= 90200:
-                self.template_path = 'domains/sql/9.2_plus'
-            elif ver >= 90100:
-                self.template_path = 'domains/sql/9.1_plus'
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py
index 8eef4d1..5abb2bb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/__init__.py
@@ -26,6 +26,40 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    Works as a decorator.
+    Checks database connection status.
+    Attach connection object and template path.
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        self = args[0]
+        driver = get_driver(PG_DEFAULT_DRIVER)
+        self.manager = driver.connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+        self.qtIdent = driver.qtIdent
+
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext("Connection to the server has been lost!")
+            )
+
+        ver = self.manager.version
+
+        # we will set template path for sql scripts
+        if ver >= 90200:
+            self.template_path = 'domain_constraints/sql/9.2_plus'
+        elif ver >= 90100:
+            self.template_path = 'domain_constraints/sql/9.1_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class DomainConstraintModule(CollectionNodeModule):
     """
     class DomainConstraintModule(CollectionNodeModule):
@@ -55,11 +89,23 @@ class DomainConstraintModule(CollectionNodeModule):
         self.min_ver = None
         self.max_ver = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid, doid):
         """
         Generate the Domain Constraint collection node.
         """
-        yield self.generate_browser_collection_node(doid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'properties.sql']),
+                                   doid=doid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(doid, collection_count)
 
     @property
     def node_inode(self):
@@ -241,39 +287,6 @@ class DomainConstraintView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        Works as a decorator.
-        Checks database connection status.
-        Attach connection object and template path.
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            self = args[0]
-            driver = get_driver(PG_DEFAULT_DRIVER)
-            self.manager = driver.connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-            self.qtIdent = driver.qtIdent
-
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext("Connection to the server has been lost!")
-                )
-
-            ver = self.manager.version
-
-            # we will set template path for sql scripts
-            if ver >= 90200:
-                self.template_path = 'domain_constraints/sql/9.2_plus'
-            elif ver >= 90100:
-                self.template_path = 'domain_constraints/sql/9.1_plus'
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid, doid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/sql/9.1_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/sql/9.1_plus/node.sql
index 7bd3e5b..9ac6ec4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/sql/9.1_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/sql/9.1_plus/node.sql
@@ -10,4 +10,4 @@ JOIN
 WHERE
     d.typnamespace = {{scid}}::oid
 ORDER BY
-    d.typname;
+    d.typname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/sql/9.2_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/sql/9.2_plus/node.sql
index 7bd3e5b..9ac6ec4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/sql/9.2_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/sql/9.2_plus/node.sql
@@ -10,4 +10,4 @@ JOIN
 WHERE
     d.typnamespace = {{scid}}::oid
 ORDER BY
-    d.typname;
+    d.typname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py
index 98182fc..4325887 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py
@@ -33,6 +33,49 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    Works as a decorator.
+    Checks the database connection status.
+    Attaches the connection object and template path to the class object.
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        self = args[0]
+        driver = get_driver(PG_DEFAULT_DRIVER)
+        self.manager = driver.connection_manager(kwargs['sid'])
+
+        # Get database connection
+        self.conn = self.manager.connection(did=kwargs['did'])
+
+        self.qtIdent = driver.qtIdent
+
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        ver = self.manager.version
+        server_type = self.manager.server_type
+
+        # Set template path for sql scripts depending
+        # on the server version.
+
+        if ver >= 90500:
+            self.template_path = 'foreign_tables/sql/9.5_plus'
+        elif ver >= 90200:
+            self.template_path = 'foreign_tables/sql/9.2_plus'
+        else:
+            self.template_path = 'foreign_tables/sql/9.1_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class ForeignTableModule(SchemaChildModule):
     """
     class ForeignTableModule(CollectionNodeModule):
@@ -62,11 +105,23 @@ class ForeignTableModule(SchemaChildModule):
         self.min_ver = None
         self.max_ver = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the Foreign Table collection node.
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'node.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def node_inode(self):
@@ -323,48 +378,6 @@ class ForeignTableView(PGChildNodeView, DataTypeReader):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        Works as a decorator.
-        Checks the database connection status.
-        Attaches the connection object and template path to the class object.
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            self = args[0]
-            driver = get_driver(PG_DEFAULT_DRIVER)
-            self.manager = driver.connection_manager(kwargs['sid'])
-
-            # Get database connection
-            self.conn = self.manager.connection(did=kwargs['did'])
-
-            self.qtIdent = driver.qtIdent
-
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            ver = self.manager.version
-            server_type = self.manager.server_type
-
-            # Set template path for sql scripts depending
-            # on the server version.
-
-            if ver >= 90500:
-                self.template_path = 'foreign_tables/sql/9.5_plus'
-            elif ver >= 90200:
-                self.template_path = 'foreign_tables/sql/9.2_plus'
-            else:
-                self.template_path = 'foreign_tables/sql/9.1_plus'
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.1_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.1_plus/node.sql
index bc731c5..ad43d93 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.1_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.1_plus/node.sql
@@ -11,4 +11,4 @@ LEFT OUTER JOIN
     pg_description des ON (des.objoid=c.oid AND des.classoid='pg_class'::regclass)
 WHERE
     c.relnamespace = {{scid}}::oid
-ORDER BY c.relname;
+ORDER BY c.relname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/node.sql
index bc731c5..ad43d93 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/node.sql
@@ -11,4 +11,4 @@ LEFT OUTER JOIN
     pg_description des ON (des.objoid=c.oid AND des.classoid='pg_class'::regclass)
 WHERE
     c.relnamespace = {{scid}}::oid
-ORDER BY c.relname;
+ORDER BY c.relname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/node.sql
index bc731c5..ad43d93 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/node.sql
@@ -11,4 +11,4 @@ LEFT OUTER JOIN
     pg_description des ON (des.objoid=c.oid AND des.classoid='pg_class'::regclass)
 WHERE
     c.relnamespace = {{scid}}::oid
-ORDER BY c.relname;
+ORDER BY c.relname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
index 8c32025..e197d90 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
@@ -26,6 +26,34 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
+            kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                _("Connection to the server has been lost!")
+            )
+        # we will set template path for sql scripts depending upon server version
+        ver = self.manager.version
+        if ver >= 90100:
+            self.template_path = 'fts_configuration/sql/9.1_plus'
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class FtsConfigurationModule(SchemaChildModule):
     """
      class FtsConfigurationModule(SchemaChildModule)
@@ -58,6 +86,7 @@ class FtsConfigurationModule(SchemaChildModule):
         self.manager = None
         super(FtsConfigurationModule, self).__init__(*args, **kwargs)
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the collection node
@@ -66,7 +95,18 @@ class FtsConfigurationModule(SchemaChildModule):
         :param did: database id
         :param scid: schema id
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'nodes.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def node_inode(self):
@@ -216,33 +256,6 @@ class FtsConfigurationView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
-                kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    _("Connection to the server has been lost!")
-                )
-            # we will set template path for sql scripts depending upon server version
-            ver = self.manager.version
-            if ver >= 90100:
-                self.template_path = 'fts_configuration/sql/9.1_plus'
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py
index b7dea08..10fbe18 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py
@@ -26,6 +26,34 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
+            kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                _("Connection to the server has been lost!")
+            )
+        # we will set template path for sql scripts depending upon server version
+        ver = self.manager.version
+        if ver >= 90100:
+            self.template_path = 'fts_dictionary/sql/9.1_plus'
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class FtsDictionaryModule(SchemaChildModule):
     """
      class FtsDictionaryModule(SchemaChildModule)
@@ -57,6 +85,7 @@ class FtsDictionaryModule(SchemaChildModule):
         self.manager = None
         super(FtsDictionaryModule, self).__init__(*args, **kwargs)
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the collection node
@@ -65,7 +94,18 @@ class FtsDictionaryModule(SchemaChildModule):
         :param did: database id
         :param scid: schema id
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'nodes.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def node_inode(self):
@@ -208,33 +248,6 @@ class FtsDictionaryView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
-                kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    _("Connection to the server has been lost!")
-                )
-            # we will set template path for sql scripts depending upon server version
-            ver = self.manager.version
-            if ver >= 90100:
-                self.template_path = 'fts_dictionary/sql/9.1_plus'
-            return f(*args, **kwargs)
-
-        return wrap
-
     def tokenize_options(self, option_value):
         """
         This function will tokenize the string stored in database
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/__init__.py
index cd31922..ca01980 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/__init__.py
@@ -25,6 +25,35 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
+            kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                _(
+                    "Connection to the server has been lost!"
+                )
+            )
+        # we will set template path for sql scripts depending upon server version
+        ver = self.manager.version
+        if ver >= 90100:
+            self.template_path = 'fts_parser/sql/9.1_plus'
+        return f(*args, **kwargs)
+
+    return wrap
+
 class FtsParserModule(SchemaChildModule):
     """
      class FtsParserModule(SchemaChildModule)
@@ -46,6 +75,7 @@ class FtsParserModule(SchemaChildModule):
     NODE_TYPE = 'fts_parser'
     COLLECTION_LABEL = _('FTS Parsers')
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the collection node
@@ -54,7 +84,18 @@ class FtsParserModule(SchemaChildModule):
         :param did: database id
         :param scid: schema id
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'nodes.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def node_inode(self):
@@ -206,35 +247,6 @@ class FtsParserView(PGChildNodeView):
         self.manager = None
         super(FtsParserView, self).__init__(**kwargs)
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
-                kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    _(
-                        "Connection to the server has been lost!"
-                    )
-                )
-            # we will set template path for sql scripts depending upon server version
-            ver = self.manager.version
-            if ver >= 90100:
-                self.template_path = 'fts_parser/sql/9.1_plus'
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid):
         sql = render_template(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
index a349197..7974601 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
@@ -25,6 +25,35 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
+            kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+        # we will set template path for sql scripts depending upon server version
+        ver = self.manager.version
+        if ver >= 90100:
+            self.template_path = 'fts_template/sql/9.1_plus'
+        return f(*args, **kwargs)
+
+    return wrap
+
 class FtsTemplateModule(SchemaChildModule):
     """
      class FtsTemplateModule(SchemaChildModule)
@@ -54,6 +83,7 @@ class FtsTemplateModule(SchemaChildModule):
         self.max_ver = None
         super(FtsTemplateModule, self).__init__(*args, **kwargs)
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the collection node
@@ -62,7 +92,18 @@ class FtsTemplateModule(SchemaChildModule):
         :param did: database id
         :param scid: schema id
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'nodes.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def node_inode(self):
@@ -195,35 +236,6 @@ class FtsTemplateView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
-                kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-            # we will set template path for sql scripts depending upon server version
-            ver = self.manager.version
-            if ver >= 90100:
-                self.template_path = 'fts_template/sql/9.1_plus'
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid):
         sql = render_template(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
index ca69cac..28cf5a1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
@@ -35,6 +35,53 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    Works as a decorator.
+    Checks the database connection status.
+    Attaches the connection object and template path to the class object.
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        self = args[0]
+        driver = get_driver(PG_DEFAULT_DRIVER)
+        self.manager = driver.connection_manager(kwargs['sid'])
+
+        # Get database connection
+        self.conn = self.manager.connection(did=kwargs['did'])
+
+        self.qtIdent = driver.qtIdent
+        self.qtLiteral = driver.qtLiteral
+
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        ver = self.manager.version
+
+        # Set template path for sql scripts depending
+        # on the server version.
+        self.template_path = "/".join([
+            self.node_type
+        ])
+        self.sql_template_path = "/".join([
+            self.template_path,
+            self.manager.server_type,
+            'sql',
+            '9.5_plus' if ver >= 90500 else
+            '9.2_plus' if ver >= 90200 else
+            '9.1_plus'
+        ])
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class FunctionModule(SchemaChildModule):
     """
     class FunctionModule(SchemaChildModule):
@@ -76,11 +123,23 @@ class FunctionModule(SchemaChildModule):
         self.max_ver = None
         self.server_type = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate Functions collection node.
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.sql_template_path, 'node.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def node_inode(self):
@@ -314,52 +373,6 @@ class FunctionView(PGChildNodeView, DataTypeReader):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        Works as a decorator.
-        Checks the database connection status.
-        Attaches the connection object and template path to the class object.
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            self = args[0]
-            driver = get_driver(PG_DEFAULT_DRIVER)
-            self.manager = driver.connection_manager(kwargs['sid'])
-
-            # Get database connection
-            self.conn = self.manager.connection(did=kwargs['did'])
-
-            self.qtIdent = driver.qtIdent
-            self.qtLiteral = driver.qtLiteral
-
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            ver = self.manager.version
-
-            # Set template path for sql scripts depending
-            # on the server version.
-            self.template_path = "/".join([
-                self.node_type
-            ])
-            self.sql_template_path = "/".join([
-                self.template_path,
-                self.manager.server_type,
-                'sql',
-                '9.5_plus' if ver >= 90500 else
-                '9.2_plus' if ver >= 90200 else
-                '9.1_plus'
-            ])
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid):
         """
@@ -1471,11 +1484,23 @@ class ProcedureModule(SchemaChildModule):
         self.max_ver = None
         self.server_type = ['ppas']
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate Procedures collection node.
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.sql_template_path, 'node.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def node_inode(self):
@@ -1581,11 +1606,23 @@ class TriggerFunctionModule(SchemaChildModule):
         self.min_ver = 90100
         self.max_ver = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate Trigger function collection node.
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.sql_template_path, 'node.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def node_inode(self):
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.1_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.1_plus/node.sql
index bb6ec9d..5ddffdc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.1_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.1_plus/node.sql
@@ -14,4 +14,4 @@ WHERE
     AND pronamespace = {{scid}}::oid
     AND typname NOT IN ('trigger', 'event_trigger')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/node.sql
index bb6ec9d..5ddffdc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/node.sql
@@ -14,4 +14,4 @@ WHERE
     AND pronamespace = {{scid}}::oid
     AND typname NOT IN ('trigger', 'event_trigger')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/node.sql
index bb6ec9d..5ddffdc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/node.sql
@@ -14,4 +14,4 @@ WHERE
     AND pronamespace = {{scid}}::oid
     AND typname NOT IN ('trigger', 'event_trigger')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.1_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.1_plus/node.sql
index c7f4159..eb956ad 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.1_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.1_plus/node.sql
@@ -15,4 +15,4 @@ WHERE
     AND pronamespace = {{scid}}::oid
     AND typname NOT IN ('trigger', 'event_trigger')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.2_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.2_plus/node.sql
index c7f4159..eb956ad 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.2_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.2_plus/node.sql
@@ -15,4 +15,4 @@ WHERE
     AND pronamespace = {{scid}}::oid
     AND typname NOT IN ('trigger', 'event_trigger')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.5_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.5_plus/node.sql
index c7f4159..eb956ad 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.5_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/ppas/sql/9.5_plus/node.sql
@@ -15,4 +15,4 @@ WHERE
     AND pronamespace = {{scid}}::oid
     AND typname NOT IN ('trigger', 'event_trigger')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.1_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.1_plus/node.sql
index 4b648c4..ee4c024 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.1_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.1_plus/node.sql
@@ -22,4 +22,4 @@ WHERE
     AND pronamespace = {{scid}}::oid
     AND typname NOT IN ('trigger', 'event_trigger')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.2_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.2_plus/node.sql
index 4b648c4..ee4c024 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.2_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.2_plus/node.sql
@@ -22,4 +22,4 @@ WHERE
     AND pronamespace = {{scid}}::oid
     AND typname NOT IN ('trigger', 'event_trigger')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/node.sql
index 4b648c4..ee4c024 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/node.sql
@@ -22,4 +22,4 @@ WHERE
     AND pronamespace = {{scid}}::oid
     AND typname NOT IN ('trigger', 'event_trigger')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.1_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.1_plus/node.sql
index 1bcc813..f9993b6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.1_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.1_plus/node.sql
@@ -14,4 +14,4 @@ WHERE
     AND pronamespace = {{scid}}::oid
     AND typname = 'trigger' AND lanname != 'edbspl'
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.2_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.2_plus/node.sql
index 12bb3b5..37985aa 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.2_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.2_plus/node.sql
@@ -15,4 +15,4 @@ WHERE
     AND typname IN ('trigger', 'event_trigger')
     AND lanname NOT IN ('edbspl', 'sql', 'internal')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.5_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.5_plus/node.sql
index 12bb3b5..37985aa 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.5_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/pg/sql/9.5_plus/node.sql
@@ -15,4 +15,4 @@ WHERE
     AND typname IN ('trigger', 'event_trigger')
     AND lanname NOT IN ('edbspl', 'sql', 'internal')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.1_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.1_plus/node.sql
index c2aaee3..1078b8c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.1_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.1_plus/node.sql
@@ -14,4 +14,4 @@ WHERE
     AND pronamespace = {{scid}}::oid
     AND typname = 'trigger' AND lanname != 'edbspl'
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.2_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.2_plus/node.sql
index e690cac..9d4eadc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.2_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.2_plus/node.sql
@@ -15,4 +15,4 @@ WHERE
     AND typname IN ('trigger', 'event_trigger')
     AND lanname NOT IN ('edbspl', 'sql', 'internal')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.5_plus/node.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.5_plus/node.sql
index e690cac..9d4eadc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.5_plus/node.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/ppas/sql/9.5_plus/node.sql
@@ -15,4 +15,4 @@ WHERE
     AND typname IN ('trigger', 'event_trigger')
     AND lanname NOT IN ('edbspl', 'sql', 'internal')
 ORDER BY
-    proname;
+    proname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py
index 29be4fd..264a925 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py
@@ -28,6 +28,40 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(action=None):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    def wrap(f):
+        @wraps(f)
+        def wrapped(self, *args, **kwargs):
+
+            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+            if action and action in ["drop"]:
+                self.conn = self.manager.connection()
+            elif 'did' in kwargs:
+                self.conn = self.manager.connection(did=kwargs['did'])
+            else:
+                self.conn = self.manager.connection()
+            # If DB not connected then return error to browser
+            if not self.conn.connected():
+                return precondition_required(
+                    _(
+                        "Connection to the server has been lost!"
+                    )
+                )
+
+            self.template_path = 'sequence/sql/9.1_plus'
+            self.acl = ['r', 'w', 'U']
+            return f(self, *args, **kwargs)
+
+        return wrapped
+
+    return wrap
+
 class SequenceModule(SchemaChildModule):
     """
     class SequenceModule(CollectionNodeModule)
@@ -59,11 +93,22 @@ class SequenceModule(SchemaChildModule):
         self.min_ver = None
         self.max_ver = None
 
+    @check_precondition(action='nodes')
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the sequence node
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'nodes.sql']), scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def script_load(self):
@@ -127,40 +172,6 @@ class SequenceView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(action=None):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        def wrap(f):
-            @wraps(f)
-            def wrapped(self, *args, **kwargs):
-
-                self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
-                if action and action in ["drop"]:
-                    self.conn = self.manager.connection()
-                elif 'did' in kwargs:
-                    self.conn = self.manager.connection(did=kwargs['did'])
-                else:
-                    self.conn = self.manager.connection()
-                # If DB not connected then return error to browser
-                if not self.conn.connected():
-                    return precondition_required(
-                        _(
-                            "Connection to the server has been lost!"
-                        )
-                    )
-
-                self.template_path = 'sequence/sql/9.1_plus'
-                self.acl = ['r', 'w', 'U']
-                return f(self, *args, **kwargs)
-
-            return wrapped
-
-        return wrap
-
     @check_precondition(action='list')
     def list(self, gid, sid, did, scid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index 8bda490..042077a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -30,6 +30,78 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        driver = get_driver(PG_DEFAULT_DRIVER)
+        self.manager = driver.connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+        self.qtIdent = driver.qtIdent
+        # We need datlastsysoid to check if current table is system table
+        self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
+
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        # We need datlastsysoid to check if current index is system index
+        self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
+
+        # we will set template path for sql scripts
+        ver = self.manager.version
+        # Template for Column node
+        if ver >= 90500:
+            self.template_path = 'table/sql/9.5_plus'
+        else:
+            self.template_path = 'table/sql/9.1_plus'
+
+        # Template for Column ,check constraint and exclusion constraint node
+        if ver >= 90200:
+            self.column_template_path = 'column/sql/9.2_plus'
+            self.check_constraint_template_path = 'check_constraint/sql/9.2_plus'
+            self.exclusion_constraint_template_path = 'exclusion_constraint/sql/9.2_plus'
+        else:
+            self.column_template_path = 'column/sql/9.1_plus'
+            self.check_constraint_template_path = 'check_constraint/sql/9.1_plus'
+            self.exclusion_constraint_template_path = 'exclusion_constraint/sql/9.1_plus'
+
+        # Template for PK & Unique constraint node
+        self.index_constraint_template_path = 'index_constraint/sql'
+
+        # Template for foreign key constraint node
+        self.foreign_key_template_path = 'foreign_key/sql'
+
+        # Template for index node
+        self.index_template_path = 'index/sql/9.1_plus'
+
+        # Template for trigger node
+        self.trigger_template_path = 'trigger/sql/9.1_plus'
+
+        # Template for rules node
+        self.rules_template_path = 'rules/sql'
+
+        # Supported ACL for table
+        self.acl = ['a', 'r', 'w', 'd', 'D', 'x', 't']
+
+        # Supported ACL for columns
+        self.column_acl = ['a', 'r', 'w', 'x']
+
+        return f(*args, **kwargs)
+
+    return wrap
+
 class TableModule(SchemaChildModule):
     """
      class TableModule(SchemaChildModule)
@@ -66,11 +138,23 @@ class TableModule(SchemaChildModule):
         self.max_ver = None
         self.min_ver = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the collection node
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path,'nodes.sql']),
+                                   scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def script_load(self):
@@ -260,78 +344,6 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
 
     })
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            driver = get_driver(PG_DEFAULT_DRIVER)
-            self.manager = driver.connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-            self.qtIdent = driver.qtIdent
-            # We need datlastsysoid to check if current table is system table
-            self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
-
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            # We need datlastsysoid to check if current index is system index
-            self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
-
-            # we will set template path for sql scripts
-            ver = self.manager.version
-            # Template for Column node
-            if ver >= 90500:
-                self.template_path = 'table/sql/9.5_plus'
-            else:
-                self.template_path = 'table/sql/9.1_plus'
-
-            # Template for Column ,check constraint and exclusion constraint node
-            if ver >= 90200:
-                self.column_template_path = 'column/sql/9.2_plus'
-                self.check_constraint_template_path = 'check_constraint/sql/9.2_plus'
-                self.exclusion_constraint_template_path = 'exclusion_constraint/sql/9.2_plus'
-            else:
-                self.column_template_path = 'column/sql/9.1_plus'
-                self.check_constraint_template_path = 'check_constraint/sql/9.1_plus'
-                self.exclusion_constraint_template_path = 'exclusion_constraint/sql/9.1_plus'
-
-            # Template for PK & Unique constraint node
-            self.index_constraint_template_path = 'index_constraint/sql'
-
-            # Template for foreign key constraint node
-            self.foreign_key_template_path = 'foreign_key/sql'
-
-            # Template for index node
-            self.index_template_path = 'index/sql/9.1_plus'
-
-            # Template for trigger node
-            self.trigger_template_path = 'trigger/sql/9.1_plus'
-
-            # Template for rules node
-            self.rules_template_path = 'rules/sql'
-
-            # Supported ACL for table
-            self.acl = ['a', 'r', 'w', 'd', 'D', 'x', 't']
-
-            # Supported ACL for columns
-            self.column_acl = ['a', 'r', 'w', 'x']
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py
index ef5cbe4..3c9c4e0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py
@@ -28,6 +28,56 @@ from pgadmin.utils.driver import get_driver
 
 from config import PG_DEFAULT_DRIVER
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        driver = get_driver(PG_DEFAULT_DRIVER)
+        self.manager = driver.connection_manager(
+            kwargs['sid']
+        )
+        self.conn = self.manager.connection(did=kwargs['did'])
+        self.qtIdent = driver.qtIdent
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        ver = self.manager.version
+        # we will set template path for sql scripts
+        if ver >= 90200:
+            self.template_path = 'column/sql/9.2_plus'
+        else:
+            self.template_path = 'column/sql/9.1_plus'
+        # Allowed ACL for column 'Select/Update/Insert/References'
+        self.acl = ['a', 'r', 'w', 'x']
+
+        # We need parent's name eg table name and schema name
+        SQL = render_template("/".join([self.template_path,
+                                        'get_parent.sql']),
+                              tid=kwargs['tid'])
+        status, rset = self.conn.execute_2darray(SQL)
+        if not status:
+            return internal_server_error(errormsg=rset)
+
+        for row in rset['rows']:
+            self.schema = row['schema']
+            self.table = row['table']
+
+        return f(*args, **kwargs)
+
+    return wrap
+
 
 class ColumnsModule(CollectionNodeModule):
     """
@@ -66,13 +116,26 @@ class ColumnsModule(CollectionNodeModule):
         self.max_ver = None
         super(ColumnsModule, self).__init__(*args, **kwargs)
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid, **kwargs):
         """
         Generate the collection node
         """
+        collection_count = 0
+        _id = kwargs['tid'] if 'tid' in kwargs else kwargs['vid']
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'nodes.sql']),
+                                   tid=_id, show_sys_objects=self.show_system_objects)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
         assert ('tid' in kwargs or 'vid' in kwargs)
         yield self.generate_browser_collection_node(
-            kwargs['tid'] if 'tid' in kwargs else kwargs['vid']
+            kwargs['tid'] if 'tid' in kwargs else kwargs['vid'], collection_count
         )
 
     @property
@@ -182,56 +245,6 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
         'module.js': [{}, {}, {'get': 'module_js'}],
     })
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            driver = get_driver(PG_DEFAULT_DRIVER)
-            self.manager = driver.connection_manager(
-                kwargs['sid']
-            )
-            self.conn = self.manager.connection(did=kwargs['did'])
-            self.qtIdent = driver.qtIdent
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            ver = self.manager.version
-            # we will set template path for sql scripts
-            if ver >= 90200:
-                self.template_path = 'column/sql/9.2_plus'
-            else:
-                self.template_path = 'column/sql/9.1_plus'
-            # Allowed ACL for column 'Select/Update/Insert/References'
-            self.acl = ['a', 'r', 'w', 'x']
-
-            # We need parent's name eg table name and schema name
-            SQL = render_template("/".join([self.template_path,
-                                            'get_parent.sql']),
-                                  tid=kwargs['tid'])
-            status, rset = self.conn.execute_2darray(SQL)
-            if not status:
-                return internal_server_error(errormsg=rset)
-
-            for row in rset['rows']:
-                self.schema = row['schema']
-                self.table = row['table']
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid, tid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/__init__.py
index a82ee5a..c10d6b5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/__init__.py
@@ -49,11 +49,18 @@ class ConstraintsModule(CollectionNodeModule):
         self.max_ver = None
         super(ConstraintsModule, self).__init__(*args, **kwargs)
 
-    def get_nodes(self, gid, sid, did, scid, tid):
+    def get_nodes(self, **kwargs):
         """
         Generate the collection node
         """
-        yield self.generate_browser_collection_node(tid)
+        cmd = {"cmd": "nodes"}
+        constraints = []
+        for name in ConstraintRegistry.registry:
+            module = (ConstraintRegistry.registry[name])['nodeview']
+            view = module(**cmd)
+            constraints = constraints + view.get_nodes(**kwargs)
+
+        yield self.generate_browser_collection_node(kwargs['tid'], len(constraints))
 
     @property
     def script_load(self):
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
index d79c946..c2ba3c0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
@@ -24,6 +24,53 @@ from pgadmin.utils.driver import get_driver
 
 from config import PG_DEFAULT_DRIVER
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
+            kwargs['sid']
+        )
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        # We need datlastsysoid to check if current index is system index
+        self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
+
+        # we will set template path for sql scripts
+        self.template_path = 'index/sql/9.1_plus'
+
+        # We need parent's name eg table name and schema name
+        # when we create new index in update we can fetch it using
+        # property sql
+        SQL = render_template("/".join([self.template_path,
+                                        'get_parent.sql']),
+                              tid=kwargs['tid'])
+        status, rset = self.conn.execute_2darray(SQL)
+        if not status:
+            return internal_server_error(errormsg=rset)
+
+        for row in rset['rows']:
+            self.schema = row['schema']
+            self.table = row['table']
+
+        return f(*args, **kwargs)
+
+    return wrap
+
 
 class IndexesModule(CollectionNodeModule):
     """
@@ -92,13 +139,26 @@ class IndexesModule(CollectionNodeModule):
             # then true, othewise false
             return res
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid, **kwargs):
         """
         Generate the collection node
         """
+        collection_count = 0
+        _id = kwargs['tid'] if 'tid' in kwargs else kwargs['vid']
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path,
+                                        'nodes.sql']), tid=_id)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
         assert ('tid' in kwargs or 'vid' in kwargs)
         yield self.generate_browser_collection_node(
-            kwargs['tid'] if 'tid' in kwargs else kwargs['vid']
+            kwargs['tid'] if 'tid' in kwargs else kwargs['vid'], collection_count
         )
 
     @property
@@ -213,53 +273,6 @@ class IndexesView(PGChildNodeView):
                          {'get': 'get_op_class'}]
     })
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
-                kwargs['sid']
-            )
-            self.conn = self.manager.connection(did=kwargs['did'])
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            # We need datlastsysoid to check if current index is system index
-            self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
-
-            # we will set template path for sql scripts
-            self.template_path = 'index/sql/9.1_plus'
-
-            # We need parent's name eg table name and schema name
-            # when we create new index in update we can fetch it using
-            # property sql
-            SQL = render_template("/".join([self.template_path,
-                                            'get_parent.sql']),
-                                  tid=kwargs['tid'])
-            status, rset = self.conn.execute_2darray(SQL)
-            if not status:
-                return internal_server_error(errormsg=rset)
-
-            for row in rset['rows']:
-                self.schema = row['schema']
-                self.table = row['table']
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def get_collations(self, gid, sid, did, scid, tid, idx=None):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py
index d462454..3e77338 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py
@@ -26,6 +26,34 @@ from pgadmin.utils.driver import get_driver
 
 from config import PG_DEFAULT_DRIVER
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will check the
+    database connection before running a view. It will also attach
+    manager, conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(
+            PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
+        self.template_path = 'rules/sql'
+        return f(*args, **kwargs)
+
+    return wrap
 
 class RuleModule(CollectionNodeModule):
     """
@@ -79,13 +107,26 @@ class RuleModule(CollectionNodeModule):
             else:
                 return res
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid, **kwargs):
         """
         Generate the collection node
         """
+        collection_count = 0
+        _id = kwargs['tid'] if 'tid' in kwargs else kwargs['vid']
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join(
+            [self.template_path, 'properties.sql']), tid=_id)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
         assert ('tid' in kwargs or 'vid' in kwargs)
         yield self.generate_browser_collection_node(
-            kwargs['tid'] if 'tid' in kwargs else kwargs['vid']
+            kwargs['tid'] if 'tid' in kwargs else kwargs['vid'], collection_count
         )
 
     @property
@@ -188,35 +229,6 @@ class RuleView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will check the
-        database connection before running a view. It will also attach
-        manager, conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(
-                PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
-            self.template_path = 'rules/sql'
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid, tid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/nodes.sql
index 43f14cb..fa11a0e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/nodes.sql
@@ -3,4 +3,4 @@ SELECT rel.oid, rel.relname AS name,
     (SELECT count(*) FROM pg_trigger WHERE tgrelid=rel.oid AND tgisinternal = FALSE AND tgenabled = 'O') AS has_enable_triggers
 FROM pg_class rel
     WHERE rel.relkind IN ('r','s','t') AND rel.relnamespace = {{ scid }}::oid
-    ORDER BY rel.relname;
\ No newline at end of file
+    ORDER BY rel.relname
\ No newline at end of file
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/nodes.sql
index 43f14cb..fa11a0e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/nodes.sql
@@ -3,4 +3,4 @@ SELECT rel.oid, rel.relname AS name,
     (SELECT count(*) FROM pg_trigger WHERE tgrelid=rel.oid AND tgisinternal = FALSE AND tgenabled = 'O') AS has_enable_triggers
 FROM pg_class rel
     WHERE rel.relkind IN ('r','s','t') AND rel.relnamespace = {{ scid }}::oid
-    ORDER BY rel.relname;
\ No newline at end of file
+    ORDER BY rel.relname
\ No newline at end of file
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/9.1_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/9.1_plus/nodes.sql
index 095ada3..80c6491 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/9.1_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/9.1_plus/nodes.sql
@@ -2,4 +2,4 @@ SELECT t.oid, t.tgname as name, (CASE WHEN tgenabled = 'O' THEN true ElSE false
 FROM pg_trigger t
     WHERE NOT tgisinternal
     AND tgrelid = {{tid}}::OID
-    ORDER BY tgname;
+    ORDER BY tgname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
index b3e4eec..f64b127 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
@@ -25,6 +25,67 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
+            kwargs['sid']
+        )
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        # We need datlastsysoid to check if current trigger is system trigger
+        self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
+
+        # we will set template path for sql scripts
+        self.template_path = 'trigger/sql/9.1_plus'
+        # Store server type
+        self.stype = self.manager.server_type
+        # We need parent's name eg table name and schema name
+        # when we create new trigger in update we can fetch it using
+        # property sql
+        SQL = render_template("/".join([self.template_path,
+                                        'get_parent.sql']),
+                              tid=kwargs['tid'])
+        status, rset = self.conn.execute_2darray(SQL)
+        if not status:
+            return internal_server_error(errormsg=rset)
+
+        for row in rset['rows']:
+            self.schema = row['schema']
+            self.table = row['table']
+
+        # Here we are storing trigger definition
+        # We will use it to check trigger type definition
+        self.trigger_definition = {
+            'TRIGGER_TYPE_ROW': (1 << 0),
+            'TRIGGER_TYPE_BEFORE': (1 << 1),
+            'TRIGGER_TYPE_INSERT': (1 << 2),
+            'TRIGGER_TYPE_DELETE': (1 << 3),
+            'TRIGGER_TYPE_UPDATE': (1 << 4),
+            'TRIGGER_TYPE_TRUNCATE': (1 << 5),
+            'TRIGGER_TYPE_INSTEAD': (1 << 6)
+        }
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class TriggerModule(CollectionNodeModule):
     """
      class TriggerModule(CollectionNodeModule)
@@ -91,13 +152,26 @@ class TriggerModule(CollectionNodeModule):
             # then true, othewise false
             return res
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid, **kwargs):
         """
         Generate the collection node
         """
+        collection_count = 0
+        _id = kwargs['tid'] if 'tid' in kwargs else kwargs['vid']
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path,
+                                        'nodes.sql']), tid=_id)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
         assert ('tid' in kwargs or 'vid' in kwargs)
         yield self.generate_browser_collection_node(
-            kwargs['tid'] if 'tid' in kwargs else kwargs['vid']
+            kwargs['tid'] if 'tid' in kwargs else kwargs['vid'], collection_count
         )
 
     @property
@@ -240,66 +314,6 @@ class TriggerView(PGChildNodeView):
         'enable': [{'put': 'enable_disable_trigger'}]
     })
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
-                kwargs['sid']
-            )
-            self.conn = self.manager.connection(did=kwargs['did'])
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            # We need datlastsysoid to check if current trigger is system trigger
-            self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
-
-            # we will set template path for sql scripts
-            self.template_path = 'trigger/sql/9.1_plus'
-            # Store server type
-            self.server_type = self.manager.server_type
-            # We need parent's name eg table name and schema name
-            # when we create new trigger in update we can fetch it using
-            # property sql
-            SQL = render_template("/".join([self.template_path,
-                                            'get_parent.sql']),
-                                  tid=kwargs['tid'])
-            status, rset = self.conn.execute_2darray(SQL)
-            if not status:
-                return internal_server_error(errormsg=rset)
-
-            for row in rset['rows']:
-                self.schema = row['schema']
-                self.table = row['table']
-
-            # Here we are storing trigger definition
-            # We will use it to check trigger type definition
-            self.trigger_definition = {
-                'TRIGGER_TYPE_ROW': (1 << 0),
-                'TRIGGER_TYPE_BEFORE': (1 << 1),
-                'TRIGGER_TYPE_INSERT': (1 << 2),
-                'TRIGGER_TYPE_DELETE': (1 << 3),
-                'TRIGGER_TYPE_UPDATE': (1 << 4),
-                'TRIGGER_TYPE_TRUNCATE': (1 << 5),
-                'TRIGGER_TYPE_INSTEAD': (1 << 6)
-            }
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def get_trigger_functions(self, gid, sid, did, scid, tid, trid=None):
         """
@@ -312,7 +326,7 @@ class TriggerView(PGChildNodeView):
         # If server type is EDB-PPAS then we also need to add
         # inline edb-spl along with options fetched by below sql
 
-        if self.server_type == 'ppas':
+        if self.stype == 'ppas':
             res.append({
                 'label': 'Inline EDB-SPL',
                 'value': 'Inline EDB-SPL'
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.1_plus/sql/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.1_plus/sql/nodes.sql
index 3ad9a90..373088e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.1_plus/sql/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.1_plus/sql/nodes.sql
@@ -13,4 +13,4 @@ WHERE
     (
 {{ CATALOGS.LIST('nsp') }}
     )
-ORDER BY 2;
+ORDER BY 2
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/nodes.sql
index 3ad9a90..373088e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/nodes.sql
@@ -13,4 +13,4 @@ WHERE
     (
 {{ CATALOGS.LIST('nsp') }}
     )
-ORDER BY 2;
+ORDER BY 2
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.1_plus/sql/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.1_plus/sql/nodes.sql
index 4eb3327..7d890cf 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.1_plus/sql/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.1_plus/sql/nodes.sql
@@ -14,4 +14,4 @@ WHERE
     (
 {{ CATALOGS.LIST('nsp') }}
     )
-ORDER BY 2;
+ORDER BY 2
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.2_plus/sql/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.2_plus/sql/nodes.sql
index 71d5535..a125086 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.2_plus/sql/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/ppas/9.2_plus/sql/nodes.sql
@@ -14,4 +14,4 @@ WHERE
     (
 {{ CATALOGS.LIST('nsp') }}
     )
-ORDER BY 2;
+ORDER BY 2
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/pg/9.1_plus/sql/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/pg/9.1_plus/sql/nodes.sql
index 175841c..b4c3890 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/pg/9.1_plus/sql/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/pg/9.1_plus/sql/nodes.sql
@@ -17,4 +17,4 @@ WHERE
     NOT (
 {{ CATALOGS.LIST('nsp') }}
     )
-ORDER BY nspname;
+ORDER BY nspname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/pg/9.2_plus/sql/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/pg/9.2_plus/sql/nodes.sql
index 175841c..b4c3890 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/pg/9.2_plus/sql/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/pg/9.2_plus/sql/nodes.sql
@@ -17,4 +17,4 @@ WHERE
     NOT (
 {{ CATALOGS.LIST('nsp') }}
     )
-ORDER BY nspname;
+ORDER BY nspname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/ppas/9.1_plus/sql/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/ppas/9.1_plus/sql/nodes.sql
index 2fb77ba..a491672 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/ppas/9.1_plus/sql/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/ppas/9.1_plus/sql/nodes.sql
@@ -18,4 +18,4 @@ WHERE
     NOT (
 {{ CATALOGS.LIST('nsp') }}
     )
-ORDER BY nspname;
+ORDER BY nspname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/ppas/9.2_plus/sql/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/ppas/9.2_plus/sql/nodes.sql
index 2fb77ba..a491672 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/ppas/9.2_plus/sql/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/ppas/9.2_plus/sql/nodes.sql
@@ -18,4 +18,4 @@ WHERE
     NOT (
 {{ CATALOGS.LIST('nsp') }}
     )
-ORDER BY nspname;
+ORDER BY nspname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
index 8ea7aa9..737605d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
@@ -28,6 +28,42 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection(did=kwargs['did'])
+
+        # We need datlastsysoid to check if current type is system type
+        self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
+
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        # Declare allows acl on type
+        self.acl = ['U']
+
+        # we will set template path for sql scripts
+        self.template_path = 'type/sql/9.1_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class TypeModule(SchemaChildModule):
     """
      class TypeModule(SchemaChildModule)
@@ -65,11 +101,23 @@ class TypeModule(SchemaChildModule):
         self.min_ver = None
         self.max_ver = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the collection node
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path,'nodes.sql']),
+                                   scid=scid, show_system_objects=self.show_system_objects)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def script_load(self):
@@ -208,41 +256,6 @@ class TypeView(PGChildNodeView, DataTypeReader):
                                    {'get': 'get_external_functions_list'}]
     })
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection(did=kwargs['did'])
-
-            # We need datlastsysoid to check if current type is system type
-            self.datlastsysoid = self.manager.db_info[kwargs['did']]['datlastsysoid']
-
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            # Declare allows acl on type
-            self.acl = ['U']
-
-            # we will set template path for sql scripts
-            self.template_path = 'type/sql/9.1_plus'
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid, did, scid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/sql/9.1_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/sql/9.1_plus/nodes.sql
index 6abcb19..8d6fb8d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/sql/9.1_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/sql/9.1_plus/nodes.sql
@@ -7,4 +7,4 @@ WHERE t.typtype != 'd' AND t.typname NOT LIKE E'\\_%' AND t.typnamespace = {{sci
 {% if not show_system_objects %}
     AND ct.oid is NULL
 {% endif %}
-ORDER BY t.typname;
\ No newline at end of file
+ORDER BY t.typname
\ No newline at end of file
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
index 317a488..43d3617 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
@@ -43,6 +43,65 @@ from config import PG_DEFAULT_DRIVER
 """
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to instance of the method.
+
+    Assumptions:
+        This function will always be used as decorator of a class method.
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        pg_driver = get_driver(PG_DEFAULT_DRIVER)
+        self.qtIdent = pg_driver.qtIdent
+        self.manager = pg_driver.connection_manager(
+            kwargs['sid']
+        )
+        self.conn = self.manager.connection(did=kwargs['did'])
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext("Connection to the server has been lost!")
+            )
+        self.datlastsysoid = self.manager.db_info[
+            kwargs['did']]['datlastsysoid']
+
+        # Set template path for sql scripts
+        if hasattr(self, 'NODE_TYPE'):
+            initial_path = self.NODE_TYPE
+        else:
+            initial_path = self.template_initial
+
+        if initial_path == 'view':
+            self.template_path = initial_path + '/' + (
+                ViewNode.ppas_template_path(self.manager.version)
+                if self.manager.server_type == 'ppas' else
+                ViewNode.pg_template_path(self.manager.version)
+            )
+        else:
+            self.template_path = initial_path + '/' + (
+                MViewNode.ppas_template_path(self.manager.version)
+                if self.manager.server_type == 'ppas' else
+                MViewNode.pg_template_path(self.manager.version)
+            )
+
+        ver = self.manager.version
+        if ver >= 90200:
+            self.column_template_path = 'column/sql/9.2_plus'
+        else:
+            self.column_template_path = 'column/sql/9.1_plus'
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class ViewModule(SchemaChildModule):
     """
     class ViewModule(SchemaChildModule):
@@ -79,11 +138,23 @@ class ViewModule(SchemaChildModule):
         self.min_ver = None
         self.max_ver = None
 
+    @check_precondition
     def get_nodes(self, gid, sid, did, scid):
         """
         Generate the collection node
         """
-        yield self.generate_browser_collection_node(scid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join(
+            [self.template_path, 'sql/properties.sql']), scid=scid)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(scid, collection_count)
 
     @property
     def script_load(self):
@@ -150,53 +221,6 @@ view_blueprint = ViewModule(__name__)
 mview_blueprint = MViewModule(__name__)
 
 
-def check_precondition(f):
-    """
-    This function will behave as a decorator which will checks
-    database connection before running view, it will also attaches
-    manager,conn & template_path properties to instance of the method.
-
-    Assumptions:
-        This function will always be used as decorator of a class method.
-    """
-
-    @wraps(f)
-    def wrap(*args, **kwargs):
-
-        # Here args[0] will hold self & kwargs will hold gid,sid,did
-        self = args[0]
-        pg_driver = get_driver(PG_DEFAULT_DRIVER)
-        self.qtIdent = pg_driver.qtIdent
-        self.manager = pg_driver.connection_manager(
-            kwargs['sid']
-        )
-        self.conn = self.manager.connection(did=kwargs['did'])
-        # If DB not connected then return error to browser
-        if not self.conn.connected():
-            return precondition_required(
-                gettext("Connection to the server has been lost!")
-            )
-        self.datlastsysoid = self.manager.db_info[
-            kwargs['did']]['datlastsysoid']
-
-        # Set template path for sql scripts
-        self.template_path = self.template_initial + '/' + (
-            self.ppas_template_path(self.manager.version)
-            if self.manager.server_type == 'ppas' else
-            self.pg_template_path(self.manager.version)
-        )
-
-        ver = self.manager.version
-        if ver >= 90200:
-            self.column_template_path = 'column/sql/9.2_plus'
-        else:
-            self.column_template_path = 'column/sql/9.1_plus'
-
-        return f(*args, **kwargs)
-
-    return wrap
-
-
 class ViewNode(PGChildNodeView, VacuumSettings):
     """
     This class is responsible for generating routes for view node.
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.1_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.1_plus/nodes.sql
index b05880c..cf9777f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.1_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.1_plus/nodes.sql
@@ -9,4 +9,4 @@ db.oid = {{ did|qtLiteral }}::OID{% else %}
 db.oid > {{ last_system_oid }}::OID
 {% endif %}
 
-ORDER BY datname;
+ORDER BY datname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.2_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.2_plus/nodes.sql
index b05880c..cf9777f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.2_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.2_plus/nodes.sql
@@ -9,4 +9,4 @@ db.oid = {{ did|qtLiteral }}::OID{% else %}
 db.oid > {{ last_system_oid }}::OID
 {% endif %}
 
-ORDER BY datname;
+ORDER BY datname
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.3_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.3_plus/nodes.sql
index b05880c..cf9777f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.3_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.3_plus/nodes.sql
@@ -9,4 +9,4 @@ db.oid = {{ did|qtLiteral }}::OID{% else %}
 db.oid > {{ last_system_oid }}::OID
 {% endif %}
 
-ORDER BY datname;
+ORDER BY datname
diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
index 749e543..2f19499 100644
--- a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
@@ -25,6 +25,35 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,did
+        self = args[0]
+        self.driver = get_driver(PG_DEFAULT_DRIVER)
+        self.manager = self.driver.connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection()
+
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        self.template_path = 'resource_groups/sql'
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class ResourceGroupModule(CollectionNodeModule):
     """
      class ResourceGroupModule(CollectionNodeModule)
@@ -68,6 +97,7 @@ class ResourceGroupModule(CollectionNodeModule):
         self.max_ver = None
         self.server_type = ['ppas']
 
+    @check_precondition
     def get_nodes(self, gid, sid):
         """
         Method is used to generate the browser collection node
@@ -76,7 +106,17 @@ class ResourceGroupModule(CollectionNodeModule):
             gid: Server Group ID
             sid: Server ID
         """
-        yield self.generate_browser_collection_node(sid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'properties.sql']))
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(sid, collection_count)
 
     @property
     def node_inode(self):
@@ -201,34 +241,6 @@ class ResourceGroupView(NodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,did
-            self = args[0]
-            self.driver = get_driver(PG_DEFAULT_DRIVER)
-            self.manager = self.driver.connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection()
-
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            self.template_path = 'resource_groups/sql'
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid):
         """
diff --git a/web/pgadmin/browser/server_groups/servers/roles/__init__.py b/web/pgadmin/browser/server_groups/servers/roles/__init__.py
index bee3d02..56f344a 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/roles/__init__.py
@@ -24,6 +24,122 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(action=None):
+    """
+    This function will behave as a decorator which will checks the status
+    of the database connection for the maintainance database of the server,
+    beforeexecuting rest of the operation for the wrapped function. It will
+    also attach manager, conn (maintenance connection for the server) as
+    properties of the instance.
+    """
+
+    def wrap(f):
+        @wraps(f)
+        def wrapped(self, **kwargs):
+            self.manager = get_driver(
+                PG_DEFAULT_DRIVER
+            ).connection_manager(
+                kwargs['sid']
+            )
+            self.conn = self.manager.connection()
+
+            driver = get_driver(PG_DEFAULT_DRIVER)
+            self.qtIdent = driver.qtIdent
+
+            if not self.conn.connected():
+                return precondition_required(
+                    _("Connection to the server has been lost!")
+                )
+
+            ver = self.manager.version
+
+            self.sql_path = 'role/sql/{0}/'.format(
+                'post9_4' if ver >= 90500 else \
+                    'post9_1' if ver >= 90200 else \
+                        'post9_0' if ver >= 90100 else \
+                            'post8_4'
+            )
+
+            self.alterKeys = [
+                u'rolcanlogin', u'rolsuper', u'rolcreatedb',
+                u'rolcreaterole', u'rolinherit', u'rolreplication',
+                u'rolconnlimit', u'rolvaliduntil', u'rolpassword'
+            ] if ver >= 90200 else [
+                u'rolcanlogin', u'rolsuper', u'rolcreatedb',
+                u'rolcreaterole', u'rolinherit', u'rolconnlimit',
+                u'rolvaliduntil', u'rolpassword'
+            ]
+
+            check_permission = False
+            fetch_name = False
+            forbidden_msg = None
+
+            if action in ['drop', 'update']:
+                check_permission = True
+                fetch_name = True
+                if action == 'drop':
+                    forbidden_msg = _(
+                        "The current user does not have permission to drop the role."
+                    )
+                else:
+                    forbidden_msg = _(
+                        "The current user does not have permission to update the role."
+                    )
+            elif action == 'create':
+                check_permission = True
+                forbidden_msg = _(
+                    "The current user does not have permission to create the role."
+                )
+            elif (action == 'msql' and
+                          'rid' in kwargs and kwargs['rid'] != -1):
+                fetch_name = True
+
+            if check_permission:
+                user = self.manager.user_info
+
+                if not user['is_superuser'] and \
+                        not user['can_create_role']:
+                    if (action != 'update' or
+                                        'rid' in kwargs and kwargs['rid'] != -1 and
+                                    user['id'] != kwargs['rid']):
+                        return forbidden(forbidden_msg)
+
+            if fetch_name:
+
+                status, res = self.conn.execute_dict(
+                    render_template(
+                        self.sql_path + 'permission.sql',
+                        rid=kwargs['rid'],
+                        conn=self.conn
+                    )
+                )
+
+                if not status:
+                    return internal_server_error(
+                        _(
+                            "Error retrieving the role information.\n{0}"
+                        ).format(res)
+                    )
+
+                if len(res['rows']) == 0:
+                    return gone(
+                        _("Couldn't find the role on the database server.")
+                    )
+
+                row = res['rows'][0]
+
+                self.role = row['rolname']
+                self.rolCanLogin = row['rolcanlogin']
+                self.rolCatUpdate = row['rolcatupdate']
+                self.rolSuper = row['rolsuper']
+
+            return f(self, **kwargs)
+
+        return wrapped
+
+    return wrap
+
+
 class RoleModule(CollectionNodeModule):
     NODE_TYPE = 'role'
     COLLECTION_LABEL = _("Login/Group Roles")
@@ -34,12 +150,23 @@ class RoleModule(CollectionNodeModule):
 
         super(RoleModule, self).__init__(*args, **kwargs)
 
+    @check_precondition(action='nodes')
     def get_nodes(self, gid, sid):
         """
         Generate the collection node
         """
         if self.show_node:
-            yield self.generate_browser_collection_node(sid)
+            collection_count = 0
+
+            count_sql = 'SELECT count(*) FROM( '
+            node_sql = render_template(self.sql_path + 'nodes.sql')
+            count_sql += node_sql + ' ) AS collection_count'
+
+            status, rset = self.conn.execute_scalar(count_sql)
+            if status:
+                collection_count = rset
+
+            yield self.generate_browser_collection_node(sid, collection_count)
         pass
 
     @property
@@ -429,121 +556,6 @@ rolmembership:{
 
         return wrap
 
-    def check_precondition(action=None):
-        """
-        This function will behave as a decorator which will checks the status
-        of the database connection for the maintainance database of the server,
-        beforeexecuting rest of the operation for the wrapped function. It will
-        also attach manager, conn (maintenance connection for the server) as
-        properties of the instance.
-        """
-
-        def wrap(f):
-            @wraps(f)
-            def wrapped(self, **kwargs):
-                self.manager = get_driver(
-                    PG_DEFAULT_DRIVER
-                ).connection_manager(
-                    kwargs['sid']
-                )
-                self.conn = self.manager.connection()
-
-                driver = get_driver(PG_DEFAULT_DRIVER)
-                self.qtIdent = driver.qtIdent
-
-                if not self.conn.connected():
-                    return precondition_required(
-                        _("Connection to the server has been lost!")
-                    )
-
-                ver = self.manager.version
-
-                self.sql_path = 'role/sql/{0}/'.format(
-                    'post9_4' if ver >= 90500 else \
-                        'post9_1' if ver >= 90200 else \
-                            'post9_0' if ver >= 90100 else \
-                                'post8_4'
-                )
-
-                self.alterKeys = [
-                    u'rolcanlogin', u'rolsuper', u'rolcreatedb',
-                    u'rolcreaterole', u'rolinherit', u'rolreplication',
-                    u'rolconnlimit', u'rolvaliduntil', u'rolpassword'
-                ] if ver >= 90200 else [
-                    u'rolcanlogin', u'rolsuper', u'rolcreatedb',
-                    u'rolcreaterole', u'rolinherit', u'rolconnlimit',
-                    u'rolvaliduntil', u'rolpassword'
-                ]
-
-                check_permission = False
-                fetch_name = False
-                forbidden_msg = None
-
-                if action in ['drop', 'update']:
-                    check_permission = True
-                    fetch_name = True
-                    if action == 'drop':
-                        forbidden_msg = _(
-                            "The current user does not have permission to drop the role."
-                        )
-                    else:
-                        forbidden_msg = _(
-                            "The current user does not have permission to update the role."
-                        )
-                elif action == 'create':
-                    check_permission = True
-                    forbidden_msg = _(
-                        "The current user does not have permission to create the role."
-                    )
-                elif (action == 'msql' and
-                              'rid' in kwargs and kwargs['rid'] != -1):
-                    fetch_name = True
-
-                if check_permission:
-                    user = self.manager.user_info
-
-                    if not user['is_superuser'] and \
-                            not user['can_create_role']:
-                        if (action != 'update' or
-                                            'rid' in kwargs and kwargs['rid'] != -1 and
-                                        user['id'] != kwargs['rid']):
-                            return forbidden(forbidden_msg)
-
-                if fetch_name:
-
-                    status, res = self.conn.execute_dict(
-                        render_template(
-                            self.sql_path + 'permission.sql',
-                            rid=kwargs['rid'],
-                            conn=self.conn
-                        )
-                    )
-
-                    if not status:
-                        return internal_server_error(
-                            _(
-                                "Error retrieving the role information.\n{0}"
-                            ).format(res)
-                        )
-
-                    if len(res['rows']) == 0:
-                        return gone(
-                            _("Couldn't find the role on the database server.")
-                        )
-
-                    row = res['rows'][0]
-
-                    self.role = row['rolname']
-                    self.rolCanLogin = row['rolcanlogin']
-                    self.rolCatUpdate = row['rolcatupdate']
-                    self.rolSuper = row['rolsuper']
-
-                return f(self, **kwargs)
-
-            return wrapped
-
-        return wrap
-
     @check_precondition(action='list')
     def list(self, gid, sid):
         status, res = self.conn.execute_dict(
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
index 3bed5f9..3211ae8 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
@@ -25,15 +25,68 @@ from pgadmin.utils.driver import get_driver
 from config import PG_DEFAULT_DRIVER
 
 
+def check_precondition(f):
+    """
+    This function will behave as a decorator which will checks
+    database connection before running view, it will also attaches
+    manager,conn & template_path properties to self
+    """
+
+    @wraps(f)
+    def wrap(*args, **kwargs):
+        # Here args[0] will hold self & kwargs will hold gid,sid,tsid
+        self = args[0]
+        self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
+        self.conn = self.manager.connection()
+
+        # If DB not connected then return error to browser
+        if not self.conn.connected():
+            current_app.logger.warning(
+                "Connection to the server has been lost!"
+            )
+            return precondition_required(
+                gettext(
+                    "Connection to the server has been lost!"
+                )
+            )
+
+        ver = self.manager.version
+        if ver >= 90200:
+            self.template_path = 'tablespaces/sql/9.2_plus'
+        else:
+            self.template_path = 'tablespaces/sql/9.1_plus'
+        current_app.logger.debug(
+            "Using the template path: %s", self.template_path
+        )
+        # Allowed ACL on tablespace
+        self.acl = ['C']
+
+        return f(*args, **kwargs)
+
+    return wrap
+
+
 class TablespaceModule(CollectionNodeModule):
     NODE_TYPE = 'tablespace'
     COLLECTION_LABEL = gettext("Tablespaces")
 
+    @check_precondition
     def get_nodes(self, gid, sid):
         """
         Generate the collection node
         """
-        yield self.generate_browser_collection_node(sid)
+        collection_count = 0
+
+        count_sql = 'SELECT count(*) FROM( '
+        node_sql = render_template("/".join([self.template_path, 'nodes.sql']),
+                                   conn=self.conn)
+        count_sql += node_sql + ' ) AS collection_count'
+
+        status, rset = self.conn.execute_scalar(count_sql)
+        if status:
+            collection_count = rset
+
+        yield self.generate_browser_collection_node(sid, collection_count)
 
     @property
     def script_load(self):
@@ -93,46 +146,6 @@ class TablespaceView(PGChildNodeView):
             200, {'Content-Type': 'application/x-javascript'}
         )
 
-    def check_precondition(f):
-        """
-        This function will behave as a decorator which will checks
-        database connection before running view, it will also attaches
-        manager,conn & template_path properties to self
-        """
-
-        @wraps(f)
-        def wrap(*args, **kwargs):
-            # Here args[0] will hold self & kwargs will hold gid,sid,tsid
-            self = args[0]
-            self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
-            self.conn = self.manager.connection()
-
-            # If DB not connected then return error to browser
-            if not self.conn.connected():
-                current_app.logger.warning(
-                    "Connection to the server has been lost!"
-                )
-                return precondition_required(
-                    gettext(
-                        "Connection to the server has been lost!"
-                    )
-                )
-
-            ver = self.manager.version
-            if ver >= 90200:
-                self.template_path = 'tablespaces/sql/9.2_plus'
-            else:
-                self.template_path = 'tablespaces/sql/9.1_plus'
-            current_app.logger.debug(
-                "Using the template path: %s", self.template_path
-            )
-            # Allowed ACL on tablespace
-            self.acl = ['C']
-
-            return f(*args, **kwargs)
-
-        return wrap
-
     @check_precondition
     def list(self, gid, sid):
         SQL = render_template(
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/nodes.sql
index f0ac205..2df254e 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/nodes.sql
@@ -6,4 +6,4 @@ FROM
 WHERE
     ts.oid={{ tsid|qtLiteral }}::OID
 {% endif %}
-ORDER BY name;
+ORDER BY name
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/nodes.sql
index 37d4538..91c8751 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/nodes.sql
@@ -6,4 +6,4 @@ FROM
 WHERE
     ts.oid={{ tsid|qtLiteral }}::OID
 {% endif %}
-ORDER BY name;
+ORDER BY name
diff --git a/web/pgadmin/browser/utils.py b/web/pgadmin/browser/utils.py
index 9799586..fc4fe5e 100644
--- a/web/pgadmin/browser/utils.py
+++ b/web/pgadmin/browser/utils.py
@@ -15,7 +15,7 @@ import flask
 from flask import render_template, current_app
 from flask_babel import gettext
 from flask.views import View, MethodViewType, with_metaclass
-from pgadmin.utils.ajax import make_json_response, precondition_required
+from pgadmin.utils.ajax import make_json_response, precondition_required, gone
 
 from config import PG_DEFAULT_DRIVER
 
@@ -128,7 +128,8 @@ class NodeView(with_metaclass(MethodViewType, View)):
         'dependency': [{'get': 'dependencies'}],
         'dependent': [{'get': 'dependents'}],
         'children': [{'get': 'children'}],
-        'module.js': [{}, {}, {'get': 'module_js'}]
+        'module.js': [{}, {}, {'get': 'module_js'}],
+        'coll': [{}, {'get': 'collection'}]
     })
 
     @classmethod
@@ -289,6 +290,14 @@ class NodeView(with_metaclass(MethodViewType, View)):
             )
         )
 
+    def collection(self, *args, **kwargs):
+        """Build the collection node."""
+        for d in self.blueprint.get_nodes(*args, **kwargs):
+            return make_json_response(
+                data=d
+            )
+        return gone(gettext("Couldn't find the object information."))
+
 
 class PGChildNodeView(NodeView):
     def children(self, **kwargs):


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: RM #1250 Collection node counts
  2016-08-08 10:39 RM #1250 Collection node counts Akshay Joshi <[email protected]>
@ 2016-08-08 12:03 ` Dave Page <[email protected]>
  2016-08-08 12:18   ` Re: RM #1250 Collection node counts Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Dave Page @ 2016-08-08 12:03 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

Hi

On Mon, Aug 8, 2016 at 11:39 AM, Akshay Joshi <[email protected]
> wrote:

> Hi All
>
> I have fixed the RM#1250 "Collection node counts". To fix this RM I need
> to do following changes
>
>    - Move "check_precondition" function from module's view class to
>    global level within that python file itself, so that module class will use
>    it.
>    - Modified "get_nodes" function of each module's class, run the sql
>    query to count the number of objects and pass the count to
>    "generate_browser_collection_node" function to display the collection
>    count.
>    - Reuse SQL queries which is used to fetch nodes. Make that query as
>    inner query like "SELECT count(*) FROM( <node's> query  ) AS
>    collection_count". For that I'll have to remove semicolon's from some of
>    the SQL queries.
>
> One case is not handled with this patch and that is on "Refresh" of
> collection node, count is not updated. If user refresh the parent node then
> it will be updated. I'll create a separate RM for that.
>

Sorry Akshay, but I really don't like the way you've done this. It seems
like an unnecessarily large patch, and if I'm reading the patch correctly,
it doubles the amount of SQL queries run against the database when
navigating the tree, and introduces race conditions where the count
displayed could be different from the actual number of nodes.

I was expecting to see this implemented by watching for tree events (e.g.
'added' and 'removed') and using those events to update the label on the
parent node, if that node is a collection. That should just be a few lines,
and should be correct at all times right?


>
> Attached is the patch file. Please review it and let me know the review
> comments.
>
> --
> *Akshay Joshi*
> *Principal Software Engineer *
>
>
>
> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517>Mobile: +91 976-788-8246*
>
>
> --
> Sent via pgadmin-hackers mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: RM #1250 Collection node counts
  2016-08-08 10:39 RM #1250 Collection node counts Akshay Joshi <[email protected]>
  2016-08-08 12:03 ` Re: RM #1250 Collection node counts Dave Page <[email protected]>
@ 2016-08-08 12:18   ` Akshay Joshi <[email protected]>
  2016-08-08 12:20     ` Re: RM #1250 Collection node counts Dave Page <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Akshay Joshi @ 2016-08-08 12:18 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-hackers

On Mon, Aug 8, 2016 at 5:33 PM, Dave Page <[email protected]> wrote:

> Hi
>
> On Mon, Aug 8, 2016 at 11:39 AM, Akshay Joshi <
> [email protected]> wrote:
>
>> Hi All
>>
>> I have fixed the RM#1250 "Collection node counts". To fix this RM I need
>> to do following changes
>>
>>    - Move "check_precondition" function from module's view class to
>>    global level within that python file itself, so that module class will use
>>    it.
>>    - Modified "get_nodes" function of each module's class, run the sql
>>    query to count the number of objects and pass the count to
>>    "generate_browser_collection_node" function to display the collection
>>    count.
>>    - Reuse SQL queries which is used to fetch nodes. Make that query as
>>    inner query like "SELECT count(*) FROM( <node's> query  ) AS
>>    collection_count". For that I'll have to remove semicolon's from some of
>>    the SQL queries.
>>
>> One case is not handled with this patch and that is on "Refresh" of
>> collection node, count is not updated. If user refresh the parent node then
>> it will be updated. I'll create a separate RM for that.
>>
>
> Sorry Akshay, but I really don't like the way you've done this. It seems
> like an unnecessarily large patch, and if I'm reading the patch correctly,
> it doubles the amount of SQL queries run against the database when
> navigating the tree, and introduces race conditions where the count
> displayed could be different from the actual number of nodes.
>
> I was expecting to see this implemented by watching for tree events (e.g.
> 'added' and 'removed') and using those events to update the label on the
> parent node, if that node is a collection. That should just be a few lines,
> and should be correct at all times right?
>

   With current implementation children's of any collection node will be
fetched/added when user will expand that collection node, in that case we
will update the label once the node gets expanded. For example initially we
will show "Databases"  and when it gets expanded then we will update it to
"Databases (5)".

>
>
>>
>> Attached is the patch file. Please review it and let me know the review
>> comments.
>>
>> --
>> *Akshay Joshi*
>> *Principal Software Engineer *
>>
>>
>>
>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517>Mobile: +91 976-788-8246*
>>
>>
>> --
>> Sent via pgadmin-hackers mailing list ([email protected])
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>



-- 
*Akshay Joshi*
*Principal Software Engineer *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: RM #1250 Collection node counts
  2016-08-08 10:39 RM #1250 Collection node counts Akshay Joshi <[email protected]>
  2016-08-08 12:03 ` Re: RM #1250 Collection node counts Dave Page <[email protected]>
  2016-08-08 12:18   ` Re: RM #1250 Collection node counts Akshay Joshi <[email protected]>
@ 2016-08-08 12:20     ` Dave Page <[email protected]>
  2016-08-09 11:00       ` Re: RM #1250 Collection node counts Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Dave Page @ 2016-08-08 12:20 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

On Mon, Aug 8, 2016 at 1:18 PM, Akshay Joshi <[email protected]>
wrote:

>
>
> On Mon, Aug 8, 2016 at 5:33 PM, Dave Page <[email protected]> wrote:
>
>> Hi
>>
>> On Mon, Aug 8, 2016 at 11:39 AM, Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Hi All
>>>
>>> I have fixed the RM#1250 "Collection node counts". To fix this RM I need
>>> to do following changes
>>>
>>>    - Move "check_precondition" function from module's view class to
>>>    global level within that python file itself, so that module class will use
>>>    it.
>>>    - Modified "get_nodes" function of each module's class, run the sql
>>>    query to count the number of objects and pass the count to
>>>    "generate_browser_collection_node" function to display the
>>>    collection count.
>>>    - Reuse SQL queries which is used to fetch nodes. Make that query as
>>>    inner query like "SELECT count(*) FROM( <node's> query  ) AS
>>>    collection_count". For that I'll have to remove semicolon's from some of
>>>    the SQL queries.
>>>
>>> One case is not handled with this patch and that is on "Refresh" of
>>> collection node, count is not updated. If user refresh the parent node then
>>> it will be updated. I'll create a separate RM for that.
>>>
>>
>> Sorry Akshay, but I really don't like the way you've done this. It seems
>> like an unnecessarily large patch, and if I'm reading the patch correctly,
>> it doubles the amount of SQL queries run against the database when
>> navigating the tree, and introduces race conditions where the count
>> displayed could be different from the actual number of nodes.
>>
>> I was expecting to see this implemented by watching for tree events (e.g.
>> 'added' and 'removed') and using those events to update the label on the
>> parent node, if that node is a collection. That should just be a few lines,
>> and should be correct at all times right?
>>
>
>    With current implementation children's of any collection node will be
> fetched/added when user will expand that collection node, in that case we
> will update the label once the node gets expanded. For example initially we
> will show "Databases"  and when it gets expanded then we will update it to
> "Databases (5)".
>

Right, but you also need to allow for removal and addition of children when
the node is already expanded, and refreshes. Plus my other comments are
still valid I believe - race condition, double the SQL and a very large
change late in the beta cycle which isn't ideal.


>
>>
>>>
>>> Attached is the patch file. Please review it and let me know the review
>>> comments.
>>>
>>> --
>>> *Akshay Joshi*
>>> *Principal Software Engineer *
>>>
>>>
>>>
>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517>Mobile: +91 976-788-8246*
>>>
>>>
>>> --
>>> Sent via pgadmin-hackers mailing list ([email protected])
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>
>>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
>
> --
> *Akshay Joshi*
> *Principal Software Engineer *
>
>
>
> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517>Mobile: +91 976-788-8246*
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: RM #1250 Collection node counts
  2016-08-08 10:39 RM #1250 Collection node counts Akshay Joshi <[email protected]>
  2016-08-08 12:03 ` Re: RM #1250 Collection node counts Dave Page <[email protected]>
  2016-08-08 12:18   ` Re: RM #1250 Collection node counts Akshay Joshi <[email protected]>
  2016-08-08 12:20     ` Re: RM #1250 Collection node counts Dave Page <[email protected]>
@ 2016-08-09 11:00       ` Akshay Joshi <[email protected]>
  2016-08-09 11:12         ` Re: RM #1250 Collection node counts Dave Page <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Akshay Joshi @ 2016-08-09 11:00 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-hackers

Hi Dave

I have implemented the logic as per your suggestion. When user will expand
the collection node label will get updated with collection count. Attached
is the new patch file, please review it and let me know the review
comments.

On Mon, Aug 8, 2016 at 5:50 PM, Dave Page <[email protected]> wrote:

>
>
> On Mon, Aug 8, 2016 at 1:18 PM, Akshay Joshi <
> [email protected]> wrote:
>
>>
>>
>> On Mon, Aug 8, 2016 at 5:33 PM, Dave Page <[email protected]> wrote:
>>
>>> Hi
>>>
>>> On Mon, Aug 8, 2016 at 11:39 AM, Akshay Joshi <
>>> [email protected]> wrote:
>>>
>>>> Hi All
>>>>
>>>> I have fixed the RM#1250 "Collection node counts". To fix this RM I
>>>> need to do following changes
>>>>
>>>>    - Move "check_precondition" function from module's view class to
>>>>    global level within that python file itself, so that module class will use
>>>>    it.
>>>>    - Modified "get_nodes" function of each module's class, run the sql
>>>>    query to count the number of objects and pass the count to
>>>>    "generate_browser_collection_node" function to display the
>>>>    collection count.
>>>>    - Reuse SQL queries which is used to fetch nodes. Make that query
>>>>    as inner query like "SELECT count(*) FROM( <node's> query  ) AS
>>>>    collection_count". For that I'll have to remove semicolon's from some of
>>>>    the SQL queries.
>>>>
>>>> One case is not handled with this patch and that is on "Refresh" of
>>>> collection node, count is not updated. If user refresh the parent node then
>>>> it will be updated. I'll create a separate RM for that.
>>>>
>>>
>>> Sorry Akshay, but I really don't like the way you've done this. It seems
>>> like an unnecessarily large patch, and if I'm reading the patch correctly,
>>> it doubles the amount of SQL queries run against the database when
>>> navigating the tree, and introduces race conditions where the count
>>> displayed could be different from the actual number of nodes.
>>>
>>> I was expecting to see this implemented by watching for tree events
>>> (e.g. 'added' and 'removed') and using those events to update the label on
>>> the parent node, if that node is a collection. That should just be a few
>>> lines, and should be correct at all times right?
>>>
>>
>>    With current implementation children's of any collection node will be
>> fetched/added when user will expand that collection node, in that case we
>> will update the label once the node gets expanded. For example initially we
>> will show "Databases"  and when it gets expanded then we will update it to
>> "Databases (5)".
>>
>
> Right, but you also need to allow for removal and addition of children
> when the node is already expanded, and refreshes. Plus my other comments
> are still valid I believe - race condition, double the SQL and a very large
> change late in the beta cycle which isn't ideal.
>
>
>>
>>>
>>>>
>>>> Attached is the patch file. Please review it and let me know the review
>>>> comments.
>>>>
>>>> --
>>>> *Akshay Joshi*
>>>> *Principal Software Engineer *
>>>>
>>>>
>>>>
>>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517>Mobile: +91 976-788-8246*
>>>>
>>>>
>>>> --
>>>> Sent via pgadmin-hackers mailing list ([email protected])
>>>> To make changes to your subscription:
>>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>
>>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>>
>> --
>> *Akshay Joshi*
>> *Principal Software Engineer *
>>
>>
>>
>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517>Mobile: +91 976-788-8246*
>>
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>



-- 
*Akshay Joshi*
*Principal Software Engineer *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] RM_1250.patch (4.6K, 3-RM_1250.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
index 2d84870..ca0c269 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
@@ -237,6 +237,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
           pgBrowser.serverInfo = pgBrowser.serverInfo || {};
           pgBrowser.serverInfo[data._id] = _.extend({}, data);
 
+          // Call added method of node.js
+          pgAdmin.Browser.Node.callbacks.added.apply(this, arguments);
           return true;
         },
         /* Reload configuration */
diff --git a/web/pgadmin/browser/server_groups/templates/server_groups/server_groups.js b/web/pgadmin/browser/server_groups/templates/server_groups/server_groups.js
index 4221280..316b1f7 100644
--- a/web/pgadmin/browser/server_groups/templates/server_groups/server_groups.js
+++ b/web/pgadmin/browser/server_groups/templates/server_groups/server_groups.js
@@ -10,6 +10,7 @@ function($, _, pgAdmin, Backbone) {
       label: '{{ _('Server Group') }}',
       width: '350px',
       height: '250px',
+      is_collection: true,
       Init: function() {
         /* Avoid multiple registration of menus */
         if (this.initialized)
diff --git a/web/pgadmin/browser/templates/browser/js/collection.js b/web/pgadmin/browser/templates/browser/js/collection.js
index a6c1aab..12c80b7 100644
--- a/web/pgadmin/browser/templates/browser/js/collection.js
+++ b/web/pgadmin/browser/templates/browser/js/collection.js
@@ -50,6 +50,7 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) {
       }
     },
     hasId: false,
+    is_collection: true,
     // A collection will always have a collection of statistics, when the node
     // it represent will have some statistics.
     hasCollectiveStatistics: true,
diff --git a/web/pgadmin/browser/templates/browser/js/node.js b/web/pgadmin/browser/templates/browser/js/node.js
index 494240d..4cc8438 100644
--- a/web/pgadmin/browser/templates/browser/js/node.js
+++ b/web/pgadmin/browser/templates/browser/js/node.js
@@ -633,6 +633,27 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
           this, [undefined, i]
         );
       },
+      added: function(item, data, browser) {
+        var b = browser || pgBrowser,
+            t = b.tree,
+            pItem = t.parent(item),
+            pData = pItem && t.itemData(pItem),
+            pNode = pData && pgBrowser.Nodes[pData._type];
+
+        // Check node is a collection or not.
+        if (pNode && pNode.is_collection) {
+          /* If 'collection_count' is not present in data
+           * it means tree node expanded first time, so we will
+           * kept collection count and label in data itself.
+           */
+          if (!('collection_count' in pData)) {
+            pData.collection_count = 0;
+            pData._label = pData.label;
+          }
+          pData.collection_count++;
+          t.setLabel(pItem, {label: (pData._label + ' <span>(' + pData.collection_count + ')</span>')});
+        }
+      },
       // Callback called - when a node is selected in browser tree.
       selected: function(item, data, browser) {
         // Show the information about the selected node in the below panels,
@@ -691,9 +712,34 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
         return true;
       },
       removed: function(item) {
-        var self = this;
+        var self = this,
+            t = pgBrowser.tree,
+            pItem = t.parent(item),
+            pData = pItem && t.itemData(pItem),
+            pNode = pData && pgBrowser.Nodes[pData._type];
+
+        // Check node is a collection or not.
+        if (pNode && pNode.is_collection &&
+            'collection_count' in pData)
+        {
+          pData.collection_count--;
+          t.setLabel(pItem, {label: (pData._label + ' <span>(' + pData.collection_count + ')</span>')});
+        }
+
         setTimeout(function() { self.clear_cache.apply(self, item); }, 0);
       },
+      unloaded: function(item) {
+        var self = this,
+            t = pgBrowser.tree,
+            data = item && t.itemData(item);
+
+        // In case of unload remove the collection counter
+        if (self.is_collection && 'collection_count' in data)
+        {
+          delete data.collection_count;
+          t.setLabel(item, {label: data._label});
+        }
+      },
       refresh: function(n, i) {
         var self = this,
             t = pgBrowser.tree,


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: RM #1250 Collection node counts
  2016-08-08 10:39 RM #1250 Collection node counts Akshay Joshi <[email protected]>
  2016-08-08 12:03 ` Re: RM #1250 Collection node counts Dave Page <[email protected]>
  2016-08-08 12:18   ` Re: RM #1250 Collection node counts Akshay Joshi <[email protected]>
  2016-08-08 12:20     ` Re: RM #1250 Collection node counts Dave Page <[email protected]>
  2016-08-09 11:00       ` Re: RM #1250 Collection node counts Akshay Joshi <[email protected]>
@ 2016-08-09 11:12         ` Dave Page <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Dave Page @ 2016-08-09 11:12 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

Awesome - just what I was expecting, and it works nicely :-).

Thanks, committed.

On Tue, Aug 9, 2016 at 12:00 PM, Akshay Joshi <[email protected]
> wrote:

> Hi Dave
>
> I have implemented the logic as per your suggestion. When user will expand
> the collection node label will get updated with collection count. Attached
> is the new patch file, please review it and let me know the review
> comments.
>
> On Mon, Aug 8, 2016 at 5:50 PM, Dave Page <[email protected]> wrote:
>
>>
>>
>> On Mon, Aug 8, 2016 at 1:18 PM, Akshay Joshi <
>> [email protected]> wrote:
>>
>>>
>>>
>>> On Mon, Aug 8, 2016 at 5:33 PM, Dave Page <[email protected]> wrote:
>>>
>>>> Hi
>>>>
>>>> On Mon, Aug 8, 2016 at 11:39 AM, Akshay Joshi <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi All
>>>>>
>>>>> I have fixed the RM#1250 "Collection node counts". To fix this RM I
>>>>> need to do following changes
>>>>>
>>>>>    - Move "check_precondition" function from module's view class to
>>>>>    global level within that python file itself, so that module class will use
>>>>>    it.
>>>>>    - Modified "get_nodes" function of each module's class, run the sql
>>>>>    query to count the number of objects and pass the count to
>>>>>    "generate_browser_collection_node" function to display the
>>>>>    collection count.
>>>>>    - Reuse SQL queries which is used to fetch nodes. Make that query
>>>>>    as inner query like "SELECT count(*) FROM( <node's> query  ) AS
>>>>>    collection_count". For that I'll have to remove semicolon's from some of
>>>>>    the SQL queries.
>>>>>
>>>>> One case is not handled with this patch and that is on "Refresh" of
>>>>> collection node, count is not updated. If user refresh the parent node then
>>>>> it will be updated. I'll create a separate RM for that.
>>>>>
>>>>
>>>> Sorry Akshay, but I really don't like the way you've done this. It
>>>> seems like an unnecessarily large patch, and if I'm reading the patch
>>>> correctly, it doubles the amount of SQL queries run against the database
>>>> when navigating the tree, and introduces race conditions where the count
>>>> displayed could be different from the actual number of nodes.
>>>>
>>>> I was expecting to see this implemented by watching for tree events
>>>> (e.g. 'added' and 'removed') and using those events to update the label on
>>>> the parent node, if that node is a collection. That should just be a few
>>>> lines, and should be correct at all times right?
>>>>
>>>
>>>    With current implementation children's of any collection node will be
>>> fetched/added when user will expand that collection node, in that case we
>>> will update the label once the node gets expanded. For example initially we
>>> will show "Databases"  and when it gets expanded then we will update it to
>>> "Databases (5)".
>>>
>>
>> Right, but you also need to allow for removal and addition of children
>> when the node is already expanded, and refreshes. Plus my other comments
>> are still valid I believe - race condition, double the SQL and a very large
>> change late in the beta cycle which isn't ideal.
>>
>>
>>>
>>>>
>>>>>
>>>>> Attached is the patch file. Please review it and let me know the
>>>>> review comments.
>>>>>
>>>>> --
>>>>> *Akshay Joshi*
>>>>> *Principal Software Engineer *
>>>>>
>>>>>
>>>>>
>>>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517>Mobile: +91
>>>>> 976-788-8246*
>>>>>
>>>>>
>>>>> --
>>>>> Sent via pgadmin-hackers mailing list ([email protected])
>>>>> To make changes to your subscription:
>>>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Dave Page
>>>> Blog: http://pgsnake.blogspot.com
>>>> Twitter: @pgsnake
>>>>
>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>
>>>
>>>
>>> --
>>> *Akshay Joshi*
>>> *Principal Software Engineer *
>>>
>>>
>>>
>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517>Mobile: +91 976-788-8246*
>>>
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
>
> --
> *Akshay Joshi*
> *Principal Software Engineer *
>
>
>
> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517>Mobile: +91 976-788-8246*
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2016-08-09 11:12 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-08-08 10:39 RM #1250 Collection node counts Akshay Joshi <[email protected]>
2016-08-08 12:03 ` Dave Page <[email protected]>
2016-08-08 12:18   ` Akshay Joshi <[email protected]>
2016-08-08 12:20     ` Dave Page <[email protected]>
2016-08-09 11:00       ` Akshay Joshi <[email protected]>
2016-08-09 11:12         ` Dave Page <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox