From 92bc312d2dc58923c4463569edd83f8f2242304f Mon Sep 17 00:00:00 2001 From: Surinder Kumar Date: Fri, 16 Sep 2016 15:41:07 +0100 Subject: [PATCH] Fix updating of matview definitions. Fixes #1595 --- .../databases/schemas/views/__init__.py | 2 +- .../browser/templates/browser/js/browser.js | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) 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 e8a375eab..b60e462f1 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 e278717d8..151d05b2c 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') {