diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
index 399fd06..690b243 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
@@ -398,9 +398,13 @@ class IndexConstraintView(PGChildNodeView):
         """
         SQL = render_template("/".join([self.template_path, 'nodes.sql']),
                               cid=cid,
+                              tid=tid,
                               constraint_type=self.constraint_type)
         status, rset = self.conn.execute_2darray(SQL)
 
+        if not status:
+            return internal_server_error(errormsg=rset)
+
         if len(rset['rows']) == 0:
             return gone(_("""Could not find the {} in the table.""".format(
                 "primary key" if self.constraint_type == "p" else "unique key"
@@ -439,6 +443,9 @@ class IndexConstraintView(PGChildNodeView):
                               constraint_type=self.constraint_type)
         status, rset = self.conn.execute_2darray(SQL)
 
+        if not status:
+            return internal_server_error(errormsg=rset)
+
         res = []
 
         for row in rset['rows']:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index_constraint/sql/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index_constraint/sql/nodes.sql
index ed96b44..1e84585 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index_constraint/sql/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index_constraint/sql/nodes.sql
@@ -11,4 +11,7 @@ LEFT JOIN pg_depend dep ON (dep.classid = cls.tableoid AND
 LEFT OUTER JOIN pg_constraint con ON (con.tableoid = dep.refclassid AND
                                       con.oid = dep.refobjid)
 WHERE indrelid = {{tid}}::oid
-AND contype='{{constraint_type}}'
\ No newline at end of file
+AND contype='{{constraint_type}}'
+{% if cid %}
+AND cls.oid = {{cid}}::oid
+{% endif %}
\ No newline at end of file
