From fc5ce22de90b214e890d330f1760ae590ccb45c4 Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Fri, 16 Sep 2016 17:02:57 +0100 Subject: [PATCH] Allow creation of objects in schemas with special chars in the name. Fixes #1598 This was caused through generation of SQL based on HTML-escaped labels, not the raw versions. --- .../schemas/collations/templates/collation/js/collation.js | 2 +- .../templates/foreign_tables/js/foreign_tables.js | 2 +- .../schemas/sequences/templates/sequence/js/sequence.js | 2 +- .../schemas/synonyms/templates/synonym/js/synonym.js | 4 ++-- .../databases/schemas/tables/templates/table/js/table.js | 2 +- .../servers/databases/schemas/types/templates/type/js/type.js | 2 +- .../databases/schemas/views/templates/mview/js/mview.js | 2 +- .../servers/databases/schemas/views/templates/view/js/view.js | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js index eb331a496..05dad554a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js @@ -73,7 +73,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { var schemaInfo = args.node_info.schema; this.set({'owner': userInfo.name}, {silent: true}); - this.set({'schema': schemaInfo.label}, {silent: true}); + this.set({'schema': schemaInfo._label}, {silent: true}); } pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js index 230b6c2f2..7b75de1db 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js @@ -492,7 +492,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { var isNew = (_.size(attrs) === 0); if (isNew) { // Set Selected Schema - schema = args.node_info.schema.label + schema = args.node_info.schema._label this.set({'basensp': schema}, {silent: true}); // Set Current User diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js index 47ea21728..c2f6fd1e3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js @@ -114,7 +114,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { var schemaInfo = args.node_info.schema; this.set({'seqowner': userInfo.name}, {silent: true}); - this.set({'schema': schemaInfo.label}, {silent: true}); + this.set({'schema': schemaInfo._label}, {silent: true}); } pgBrowser.Node.Model.prototype.initialize.apply(this, arguments); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/js/synonym.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/js/synonym.js index 2d0be1fc8..c0de43420 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/js/synonym.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/js/synonym.js @@ -65,8 +65,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { var schemaInfo = args.node_info.schema; this.set({ 'owner': userInfo.name, - 'synobjschema': schemaInfo.label, - 'schema': schemaInfo.label, + 'synobjschema': schemaInfo._label, + 'schema': schemaInfo._label, 'targettype': 'r' }, {silent: true}); } else { diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js index 50a9032b8..44b4521ff 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js @@ -284,7 +284,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { var schemaInfo = args.node_info.schema; this.set({'relowner': userInfo.name}, {silent: true}); - this.set({'schema': schemaInfo.label}, {silent: true}); + this.set({'schema': schemaInfo._label}, {silent: true}); } pgBrowser.Node.Model.prototype.initialize.apply(this, arguments); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js index 23285311b..08f1a3a48 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js @@ -311,7 +311,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { var schemaInfo = args.node_info.schema; this.set({'typeowner': userInfo.name}, {silent: true}); - this.set({'schema': schemaInfo.label}, {silent: true}); + this.set({'schema': schemaInfo._label}, {silent: true}); } pgBrowser.Node.Model.prototype.initialize.apply(this, arguments); }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js index 9f9c9b7ac..50e49884c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js @@ -118,7 +118,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { var isNew = (_.size(attrs) === 0); if (isNew) { // Set Selected Schema - var schemaLabel = args.node_info.schema.label; + var schemaLabel = args.node_info.schema._label; if (schemaLabel == '') { this.set({'schema': 'public'}, {silent: true}); } else { diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js index c77caffbd..7f87044fd 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js @@ -92,7 +92,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { var isNew = (_.size(attrs) === 0); if (isNew) { // Set Selected Schema - var schemaLabel = args.node_info.schema.label; + var schemaLabel = args.node_info.schema._label; if (schemaLabel == '') { this.set({'schema': 'public'}, {silent: true}); } else {