public inbox for [email protected]  
help / color / mirror / Atom feed
From: Surinder Kumar <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: RM1595 - "no results to fetch error" displayed if modify definition with other table
Date: Fri, 16 Sep 2016 15:44:41 +0530
Message-ID: <CAM5-9D86OYz7E6ysM6HC7jN1OubihzvhchOvRy0rZ29S8772tg@mail.gmail.com> (raw)
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi

*Issues fixed:*

1) Creating a m-view with *definition* and then updating view with* new
definition,* it results into an error *"No results to fetch"*.

2) When definition of m-view is updated, it creates a new m-view with
different OID, but it wasn't updating the old OID with new OID of tree node
in tree view. thus on switching to another tab (e.g.: sql), it throws
message *"Cannot find materialized view"*.

Please find attached patch and review.

Thanks,
Surinder Kumar


-- 
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] RM1595.patch (2.5K, 3-RM1595.patch)
  download | inline diff:
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 e8a375e..b60e462 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
@@ -536,7 +536,7 @@ class ViewNode(PGChildNodeView, VacuumSettings):
         try:
             SQL, name = self.getSQL(gid, sid, data, vid)
             SQL = SQL.strip('\n').strip(' ')
-            status, res = self.conn.execute_scalar(SQL)
+            status, res = self.conn.execute_void(SQL)
             if not status:
                 return internal_server_error(errormsg=res)

diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js
index e278717..151d05b 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -1140,16 +1140,24 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
           }.bind(ctx),
           updateNode = function() {
             if (
-              this.i && this.d && this.new._id == this.d._id &&
-              this.new._type == this.d._type
+              this.i && this.d && this.new._type == this.d._type
             ) {
-              // Found the currect
-              _.extend(this.d, this.new._id);
-              this.t.setLabel(ctx.i, {label: this.new.label});
-              this.t.addIcon(ctx.i, {icon: this.new.icon});
-              this.t.setId(ctx.id, {id: this.new.id});
-              this.t.openPath(this.i);
-              this.t.select(this.i);
+              var _id = this.d._id;
+              if (this.new._id != this.d._id) {
+                // Found the new oid, update its node_id
+                var node_data = this.t.itemData(ctx.i);
+                node_data._id = _id = this.new._id;
+              }
+              if (this.new._id == _id) {
+                // Found the currect
+                _.extend(this.d, this.new._id);
+                this.t.setLabel(ctx.i, {label: this.new.label});
+                this.t.addIcon(ctx.i, {icon: this.new.icon});
+                this.t.setId(ctx.id, {id: this.new.id});
+                this.t.openPath(this.i);
+                this.t.deselect(this.i);
+                this.t.select(this.i);
+              }
             }
             var success = this.o && this.o.success;
             if (success && typeof(success) == 'function') {


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]: RM1595 - "no results to fetch error" displayed if modify definition with other table
  In-Reply-To: <CAM5-9D86OYz7E6ysM6HC7jN1OubihzvhchOvRy0rZ29S8772tg@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