Hi,

PFA patch to fix the issue in table node,
1) In 'UPDATE Script', '?' is missing with last column.
2) If there are multiple primary keys in table then the order of columns is
incorrect in view data ORDER BY clause.
RM#2417

Also fixed minor issue in Materialized view which I found during testing,
we were not passing database id in properties.sql which is required for
Select and Insert script to work.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
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 54bab0d..99f0ddc 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
@@ -2870,9 +2870,9 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
         if len(columns) > 0:
             if len(columns) == 1:
                 columns = columns[0]
-                columns += "=?"
             else:
                 columns = "=?, ".join(columns)
+            columns += "=?"
 
             sql = u"UPDATE {0}\n\tSET {1}\n\tWHERE <condition>;".format(
                 self.qtIdent(self.conn, data['schema'], data['name']),
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 0ead437..836018b 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
@@ -1119,7 +1119,7 @@ class ViewNode(PGChildNodeView, VacuumSettings):
             "/".join([
                 self.template_path, 'sql/properties.sql'
             ]),
-            scid=scid, vid=vid,
+            scid=scid, vid=vid, did=did,
             datlastsysoid=self.datlastsysoid
         )
         status, res = self.conn.execute_dict(SQL)
@@ -1180,7 +1180,7 @@ class ViewNode(PGChildNodeView, VacuumSettings):
             "/".join([
                 self.template_path, 'sql/properties.sql'
             ]),
-            scid=scid, vid=vid,
+            scid=scid, vid=vid, did=did,
             datlastsysoid=self.datlastsysoid
         )
         status, res = self.conn.execute_dict(SQL)
diff --git a/web/pgadmin/tools/sqleditor/command.py 
b/web/pgadmin/tools/sqleditor/command.py
index 2bb90c2..9ed9154 100644
--- a/web/pgadmin/tools/sqleditor/command.py
+++ b/web/pgadmin/tools/sqleditor/command.py
@@ -10,7 +10,7 @@
 """ Implemented classes for the different object type used by data grid """
 
 from abc import ABCMeta, abstractmethod
-
+from collections import OrderedDict
 import six
 from flask import render_template
 from flask_babel import gettext
@@ -368,7 +368,7 @@ class TableCommand(GridCommand):
         conn = manager.connection(did=self.did, conn_id=self.conn_id)
 
         pk_names = ''
-        primary_keys = dict()
+        primary_keys = OrderedDict()
 
         if conn.connected():
 
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to