public inbox for [email protected]
help / color / mirror / Atom feedFrom: Murtuza Zabuawala <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4] [PATCH] To fix issue in UPDATE Script and Primary key order when view data
Date: Fri, 26 May 2017 15:42:55 +0530
Message-ID: <CAKKotZTk6yj5T8VvKRyqK0_Q__O8L-fpFoqQh3E3J+MyhBz25g@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
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 ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[text/plain] RM_2417.diff (2.6K, 3-RM_2417.diff)
download | inline diff:
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():
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin4] [PATCH] To fix issue in UPDATE Script and Primary key order when view data
In-Reply-To: <CAKKotZTk6yj5T8VvKRyqK0_Q__O8L-fpFoqQh3E3J+MyhBz25g@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox