public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch] - RM 5270 - [EPAS] Synonym properties does not show OID.
8+ messages / 3 participants
[nested] [flat]

* [pgAdmin4][Patch] - RM 5270 - [EPAS] Synonym properties does not show OID.
@ 2020-04-07 13:07  Khushboo Vashi <[email protected]>
  0 siblings, 2 replies; 8+ messages in thread

From: Khushboo Vashi @ 2020-04-07 13:07 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

Please find the attached patch to fix the RM # 5270 - [EPAS] Synonym
properties does not show OID.

As per the current implementation, we completely ignored OID and instead
considered the name as the unique field, now with this patch OID will be
used as an unique id and also will display OID in the properties tab.

Thanks,
Khushboo


Attachments:

  [application/octet-stream] RM_5270.patch (19.0K, 3-RM_5270.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
index b9f5d57df..dfba24431 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
@@ -270,7 +270,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
         for row in rset['rows']:
             res.append(
                 self.blueprint.generate_browser_node(
-                    row['name'],
+                    row['oid'],
                     scid,
                     row['name'],
                     icon="icon-synonym"
@@ -467,13 +467,16 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
             SQL = render_template("/".join([self.template_path,
                                             'get_parent_oid.sql']),
                                   data=data, conn=self.conn)
-            status, parent_id = self.conn.execute_scalar(SQL)
+            status, res = self.conn.execute_dict(SQL)
             if not status:
                 return internal_server_error(errormsg=res)
 
+            parent_id = res['rows'][0]['scid']
+            syid = res['rows'][0]['syid']
+
             return jsonify(
                 node=self.blueprint.generate_browser_node(
-                    data['name'],
+                    syid,
                     int(parent_id),
                     data['name'],
                     icon="icon-synonym"
@@ -556,7 +559,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
         data = request.form if request.form else json.loads(
             request.data, encoding='utf-8'
         )
-        SQL = self.get_sql(gid, sid, data, scid, syid)
+        SQL, name = self.get_sql(gid, sid, data, scid, syid)
         # Most probably this is due to error
         if not isinstance(SQL, (str, unicode)):
             return SQL
@@ -570,7 +573,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
                 node=self.blueprint.generate_browser_node(
                     syid,
                     scid,
-                    syid,
+                    name,
                     icon="icon-synonym"
                 )
             )
@@ -598,7 +601,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
                 data[k] = v
 
         try:
-            SQL = self.get_sql(gid, sid, data, scid, syid)
+            SQL, name = self.get_sql(gid, sid, data, scid, syid)
             # Most probably this is due to error
             if not isinstance(SQL, (str, unicode)):
                 return SQL
@@ -614,6 +617,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
         """
         This function will genrate sql from model data
         """
+        name = None
         if syid is not None:
             SQL = render_template("/".join([self.template_path,
                                             'properties.sql']),
@@ -626,6 +630,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
                     gettext("Could not find the synonym on the server.")
                 )
             old_data = res['rows'][0]
+            name = old_data['name']
             # If target schema/object is not present then take it from
             # old data, it means it does not changed
             if 'synobjschema' not in data:
@@ -646,10 +651,11 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
                 if arg not in data:
                     return "-- missing definition"
 
+            name = data['name']
             SQL = render_template("/".join([self.template_path,
                                             'create.sql']), comment=False,
                                   data=data, conn=self.conn)
-        return SQL.strip('\n')
+        return SQL.strip('\n'), name
 
     @check_precondition
     def sql(self, gid, sid, did, scid, syid, diff_schema=None,
@@ -781,7 +787,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
         if data:
             if diff_schema:
                 data['schema'] = diff_schema
-            sql = self.get_sql(gid, sid, data, scid, oid)
+            sql, name = self.get_sql(gid, sid, data, scid, oid)
         else:
             if drop_sql:
                 sql = self.delete(gid=gid, sid=sid, did=did,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js
index 42c361633..057cb2d97 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js
@@ -69,7 +69,7 @@ define('pgadmin.node.synonym', [
         isNew: function() {
           return !this.fetchFromServer;
         },
-        idAttribute: 'name',
+        idAttribute: 'oid',
         // Default values!
         initialize: function(attrs, args) {
           var isNew = (_.size(attrs) === 0);
@@ -93,6 +93,9 @@ define('pgadmin.node.synonym', [
           id: 'name', label: gettext('Name'), cell: 'string',
           type: 'text', mode: ['properties', 'create', 'edit'],
           disabled: 'inSchema', readonly: function(m) { return !m.isNew(); },
+        },{
+          id: 'oid', label: gettext('OID'), cell: 'string',
+          type: 'text', mode: ['properties'],
         },{
           id: 'owner', label: gettext('Owner'), cell: 'string',
           type: 'text', mode: ['properties', 'create', 'edit'],
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.2_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.2_plus/properties.sql
index ec2724a0a..cb4c66c28 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.2_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.2_plus/properties.sql
@@ -26,6 +26,6 @@ SELECT synname AS name, pg_get_userbyid(synowner) AS owner,
 FROM pg_synonym s  JOIN pg_namespace ns ON s.synnamespace = ns.oid
  WHERE s.synnamespace={{scid}}::oid
  {% if syid %}
-   AND s.synname={{ syid|qtLiteral }}
+   AND s.oid={{syid}}::oid
  {% endif %}
-ORDER BY synname;
\ No newline at end of file
+ORDER BY synname;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.5_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.5_plus/properties.sql
index ec2724a0a..0b3b82d97 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.5_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.5_plus/properties.sql
@@ -1,4 +1,4 @@
-SELECT synname AS name, pg_get_userbyid(synowner) AS owner,
+SELECT s.oid, synname AS name, pg_get_userbyid(synowner) AS owner,
   synobjschema, synobjname,  ns.nspname as schema,
   COALESCE(
   (SELECT relkind
@@ -26,6 +26,6 @@ SELECT synname AS name, pg_get_userbyid(synowner) AS owner,
 FROM pg_synonym s  JOIN pg_namespace ns ON s.synnamespace = ns.oid
  WHERE s.synnamespace={{scid}}::oid
  {% if syid %}
-   AND s.synname={{ syid|qtLiteral }}
+   AND s.oid={{syid}}::oid
  {% endif %}
-ORDER BY synname;
\ No newline at end of file
+ORDER BY synname;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/get_parent_oid.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/get_parent_oid.sql
index 08f07e031..e21f9683e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/get_parent_oid.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/get_parent_oid.sql
@@ -1,5 +1,5 @@
-SELECT synnamespace as scid
+SELECT s.oid as syid, synnamespace as scid
     FROM pg_synonym s
 WHERE synname = {{ data.name|qtLiteral }}
 AND synnamespace IN
-    ( SELECT oid FROM pg_namespace WHERE nspname = {{ data.schema|qtLiteral }} );
\ No newline at end of file
+    ( SELECT oid FROM pg_namespace WHERE nspname = {{ data.schema|qtLiteral }} );
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/nodes.sql
index 1f8259b4a..c1df07f08 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/nodes.sql
@@ -1,4 +1,4 @@
-SELECT synname as name
+SELECT s.oid, synname as name
 FROM pg_synonym s
     JOIN pg_namespace ns ON s.synnamespace = ns.oid
     AND s.synnamespace = {{scid}}::oid
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/properties.sql
index ce6d59b14..eab57c8e3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/properties.sql
@@ -14,6 +14,6 @@ SELECT synname AS name, pg_get_userbyid(synowner) AS owner,
 FROM pg_synonym s  JOIN pg_namespace ns ON s.synnamespace = ns.oid
  WHERE s.synnamespace={{scid}}::oid
  {% if syid %}
-   AND s.synname={{ syid|qtLiteral }}
+   AND s.oid={{syid}}::oid
  {% endif %}
-ORDER BY synname;
\ No newline at end of file
+ORDER BY synname;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete.py
index 88d749aec..bad95bf50 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete.py
@@ -59,11 +59,11 @@ class SynonymDeleteTestCase(BaseTestGenerator):
         self.sequence_id = sequence_utils.create_sequences(
             self.server, self.db_name, self.schema_name, self.sequence_name)
         self.synonym_name = "test_synonym_delete_%s" % str(uuid.uuid4())[1:8]
-        synonym_utils.create_synonym(self.server,
-                                     self.db_name,
-                                     self.schema_name,
-                                     self.synonym_name,
-                                     self.sequence_name)
+        self.syn_oid = synonym_utils.create_synonym(self.server,
+                                                    self.db_name,
+                                                    self.schema_name,
+                                                    self.synonym_name,
+                                                    self.sequence_name)
 
     def runTest(self):
         """This function will delete synonym under schema node."""
@@ -77,7 +77,7 @@ class SynonymDeleteTestCase(BaseTestGenerator):
         response = self.tester.delete(
             self.url + str(utils.SERVER_GROUP) + '/' +
             str(self.server_id) + '/' + str(self.db_id) + '/' +
-            str(self.schema_id) + '/' + str(self.synonym_name),
+            str(self.schema_id) + '/' + str(self.syn_oid),
             follow_redirects=True)
         self.assertEquals(response.status_code, 200)
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete_multiple.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete_multiple.py
index e5b17469f..361f54713 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete_multiple.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete_multiple.py
@@ -60,17 +60,18 @@ class SynonymDeleteMultipleTestCase(BaseTestGenerator):
         self.sequence_id = sequence_utils.create_sequences(
             self.server, self.db_name, self.schema_name, self.sequence_name)
         self.synonym_name = "test_synonym_delete_%s" % str(uuid.uuid4())[1:8]
-        synonym_utils.create_synonym(self.server,
-                                     self.db_name,
-                                     self.schema_name,
-                                     self.synonym_name,
-                                     self.sequence_name)
+        self.syn_oid = synonym_utils.create_synonym(self.server,
+                                                    self.db_name,
+                                                    self.schema_name,
+                                                    self.synonym_name,
+                                                    self.sequence_name)
+
         self.synonym_name_1 = "test_synonym_delete_%s" % str(uuid.uuid4())[1:8]
-        synonym_utils.create_synonym(self.server,
-                                     self.db_name,
-                                     self.schema_name,
-                                     self.synonym_name_1,
-                                     self.sequence_name)
+        self.syn_oid_1 = synonym_utils.create_synonym(self.server,
+                                                      self.db_name,
+                                                      self.schema_name,
+                                                      self.synonym_name_1,
+                                                      self.sequence_name)
 
     def runTest(self):
         """This function will delete synonym under schema node."""
@@ -87,7 +88,7 @@ class SynonymDeleteMultipleTestCase(BaseTestGenerator):
         if not synonym_response:
             raise Exception("No synonym node to delete.")
 
-        data = {'ids': [self.synonym_name, self.synonym_name_1]}
+        data = {'ids': [self.syn_oid, self.syn_oid_1]}
         response = self.tester.delete(
             self.url + str(utils.SERVER_GROUP) + '/' +
             str(self.server_id) + '/' + str(self.db_id) + '/' +
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_get.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_get.py
index 60f565b35..6681f1e6d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_get.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_get.py
@@ -59,11 +59,11 @@ class SynonymGetTestCase(BaseTestGenerator):
         self.sequence_id = sequence_utils.create_sequences(
             self.server, self.db_name, self.schema_name, self.sequence_name)
         self.synonym_name = "test_synonym_get_%s" % str(uuid.uuid4())[1:8]
-        synonym_utils.create_synonym(self.server,
-                                     self.db_name,
-                                     self.schema_name,
-                                     self.synonym_name,
-                                     self.sequence_name)
+        self.syn_oid = synonym_utils.create_synonym(self.server,
+                                                    self.db_name,
+                                                    self.schema_name,
+                                                    self.synonym_name,
+                                                    self.sequence_name)
 
     def runTest(self):
         """This function will fetch synonym under schema node."""
@@ -71,7 +71,7 @@ class SynonymGetTestCase(BaseTestGenerator):
         response = self.tester.get(
             self.url + str(utils.SERVER_GROUP) + '/' +
             str(self.server_id) + '/' + str(self.db_id) + '/' +
-            str(self.schema_id) + '/' + str(self.synonym_name),
+            str(self.schema_id) + '/' + str(self.syn_oid),
             follow_redirects=True)
         self.assertEquals(response.status_code, 200)
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_put.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_put.py
index df0ab0000..b9faa7087 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_put.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_put.py
@@ -66,11 +66,11 @@ class SynonymPutTestCase(BaseTestGenerator):
         self.sequence_id = sequence_utils.create_sequences(
             self.server, self.db_name, self.schema_name, self.sequence_name)
         self.synonym_name = "test_synonym_put_%s" % str(uuid.uuid4())[1:8]
-        synonym_utils.create_synonym(self.server,
-                                     self.db_name,
-                                     self.schema_name,
-                                     self.synonym_name,
-                                     self.sequence_name)
+        self.syn_oid = synonym_utils.create_synonym(self.server,
+                                                    self.db_name,
+                                                    self.schema_name,
+                                                    self.synonym_name,
+                                                    self.sequence_name)
 
     def runTest(self):
         """This function will update synonym under schema node."""
@@ -96,7 +96,7 @@ class SynonymPutTestCase(BaseTestGenerator):
             str(self.server_id) + '/' +
             str(self.db_id) + '/' +
             str(self.schema_id) + '/' +
-            str(self.synonym_name),
+            str(self.syn_oid),
             data=json.dumps(data),
             follow_redirects=True)
         self.assertEquals(response.status_code, 200)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/utils.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/utils.py
index a62cd706e..f5f4cbd42 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/utils.py
@@ -40,6 +40,14 @@ def create_synonym(server, db_name, schema_name, synonym_name, sequence_name):
             schema_name, synonym_name, schema_name, sequence_name)
         pg_cursor.execute(query)
         connection.commit()
+
+        # Get 'oid' from newly created synonym
+        pg_cursor.execute("SELECT s.oid as name FROM"
+                          " pg_synonym s WHERE s.synname='%s'" %
+                          synonym_name)
+        synonym = pg_cursor.fetchone()
+        connection.close()
+        return synonym[0]
     except Exception:
         traceback.print_exc(file=sys.stderr)
 


^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgAdmin4][Patch] - RM 5270 - [EPAS] Synonym properties does not show OID.
@ 2020-04-08 07:03  Akshay Joshi <[email protected]>
  parent: Khushboo Vashi <[email protected]>
  1 sibling, 1 reply; 8+ messages in thread

From: Akshay Joshi @ 2020-04-08 07:03 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers

Hi Khushboo

Schema Diff test cases are failing with this patch. Please fix and resend
the patch.

On Tue, Apr 7, 2020 at 6:37 PM Khushboo Vashi <
[email protected]> wrote:

> Hi,
>
> Please find the attached patch to fix the RM # 5270 - [EPAS] Synonym
> properties does not show OID.
>
> As per the current implementation, we completely ignored OID and instead
> considered the name as the unique field, now with this patch OID will be
> used as an unique id and also will display OID in the properties tab.
>
> Thanks,
> Khushboo
>
>

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgAdmin4][Patch] - RM 5270 - [EPAS] Synonym properties does not show OID.
@ 2020-04-08 07:09  Ashesh Vashi <[email protected]>
  parent: Khushboo Vashi <[email protected]>
  1 sibling, 1 reply; 8+ messages in thread

From: Ashesh Vashi @ 2020-04-08 07:09 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers

On Tue, Apr 7, 2020 at 6:37 PM Khushboo Vashi <
[email protected]> wrote:

> Hi,
>
> Please find the attached patch to fix the RM # 5270 - [EPAS] Synonym
> properties does not show OID.
>
> As per the current implementation, we completely ignored OID and instead
> considered the name as the unique field, now with this patch OID will be
> used as an unique id and also will display OID in the properties tab.
>
Question is: When we rename a synonym, does it create a new OID, or keep
the same?

-- Ashesh

>
> Thanks,
> Khushboo
>
>


^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgAdmin4][Patch] - RM 5270 - [EPAS] Synonym properties does not show OID.
@ 2020-04-08 07:17  Khushboo Vashi <[email protected]>
  parent: Ashesh Vashi <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Khushboo Vashi @ 2020-04-08 07:17 UTC (permalink / raw)
  To: Ashesh Vashi <[email protected]>; +Cc: pgadmin-hackers

On Wed, Apr 8, 2020 at 12:40 PM Ashesh Vashi <[email protected]>
wrote:

> On Tue, Apr 7, 2020 at 6:37 PM Khushboo Vashi <
> [email protected]> wrote:
>
>> Hi,
>>
>> Please find the attached patch to fix the RM # 5270 - [EPAS] Synonym
>> properties does not show OID.
>>
>> As per the current implementation, we completely ignored OID and instead
>> considered the name as the unique field, now with this patch OID will be
>> used as an unique id and also will display OID in the properties tab.
>>
> Question is: When we rename a synonym, does it create a new OID, or keep
> the same?
>
> We can not rename a synonym, must drop it and recreate it.


> -- Ashesh
>
>>
>> Thanks,
>> Khushboo
>>
>>


^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgAdmin4][Patch] - RM 5270 - [EPAS] Synonym properties does not show OID.
@ 2020-04-08 07:23  Akshay Joshi <[email protected]>
  parent: Khushboo Vashi <[email protected]>
  0 siblings, 0 replies; 8+ messages in thread

From: Akshay Joshi @ 2020-04-08 07:23 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: Ashesh Vashi <[email protected]>; pgadmin-hackers

Hi Khushboo

View/MView test also failing with the commit of #5053. Please fix those as
well and send a combined patch.

On Wed, Apr 8, 2020 at 12:47 PM Khushboo Vashi <
[email protected]> wrote:

>
>
> On Wed, Apr 8, 2020 at 12:40 PM Ashesh Vashi <
> [email protected]> wrote:
>
>> On Tue, Apr 7, 2020 at 6:37 PM Khushboo Vashi <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> Please find the attached patch to fix the RM # 5270 - [EPAS] Synonym
>>> properties does not show OID.
>>>
>>> As per the current implementation, we completely ignored OID and instead
>>> considered the name as the unique field, now with this patch OID will be
>>> used as an unique id and also will display OID in the properties tab.
>>>
>> Question is: When we rename a synonym, does it create a new OID, or keep
>> the same?
>>
>> We can not rename a synonym, must drop it and recreate it.
>
>
>> -- Ashesh
>>
>>>
>>> Thanks,
>>> Khushboo
>>>
>>>

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgAdmin4][Patch] - RM 5270 - [EPAS] Synonym properties does not show OID.
@ 2020-04-10 05:11  Khushboo Vashi <[email protected]>
  parent: Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Khushboo Vashi @ 2020-04-10 05:11 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

Hi Akshay,

On Wed, Apr 8, 2020 at 12:33 PM Akshay Joshi <[email protected]>
wrote:

> Hi Khushboo
>
> Schema Diff test cases are failing with this patch. Please fix and resend
> the patch.
>
> Can you please re-verify as I don't think schema diff test cases are
failing due to this patch.

Thanks,
Khushboo

> On Tue, Apr 7, 2020 at 6:37 PM Khushboo Vashi <
> [email protected]> wrote:
>
>> Hi,
>>
>> Please find the attached patch to fix the RM # 5270 - [EPAS] Synonym
>> properties does not show OID.
>>
>> As per the current implementation, we completely ignored OID and instead
>> considered the name as the unique field, now with this patch OID will be
>> used as an unique id and also will display OID in the properties tab.
>>
>> Thanks,
>> Khushboo
>>
>>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
>
> *Sr. Software Architect*
> *EnterpriseDB Software India Private Limited*
> *Mobile: +91 976-788-8246*
>


^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgAdmin4][Patch] - RM 5270 - [EPAS] Synonym properties does not show OID.
@ 2020-04-10 06:28  Khushboo Vashi <[email protected]>
  parent: Khushboo Vashi <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Khushboo Vashi @ 2020-04-10 06:28 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

Hi,

Please find the attached updated patch.

Thanks,
Khushboo

On Fri, Apr 10, 2020 at 10:41 AM Khushboo Vashi <
[email protected]> wrote:

> Hi Akshay,
>
> On Wed, Apr 8, 2020 at 12:33 PM Akshay Joshi <
> [email protected]> wrote:
>
>> Hi Khushboo
>>
>> Schema Diff test cases are failing with this patch. Please fix and resend
>> the patch.
>>
>> Fixed.

Thanks,
Khushboo

> Can you please re-verify as I don't think schema diff test cases are
> failing due to this patch.
>
> Thanks,
> Khushboo
>
>> On Tue, Apr 7, 2020 at 6:37 PM Khushboo Vashi <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> Please find the attached patch to fix the RM # 5270 - [EPAS] Synonym
>>> properties does not show OID.
>>>
>>> As per the current implementation, we completely ignored OID and instead
>>> considered the name as the unique field, now with this patch OID will be
>>> used as an unique id and also will display OID in the properties tab.
>>>
>>> Thanks,
>>> Khushboo
>>>
>>>
>>
>> --
>> *Thanks & Regards*
>> *Akshay Joshi*
>>
>> *Sr. Software Architect*
>> *EnterpriseDB Software India Private Limited*
>> *Mobile: +91 976-788-8246*
>>
>


Attachments:

  [application/octet-stream] RM_5270_v1.patch (21.0K, 3-RM_5270_v1.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
index b9f5d57df..648fe401e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
@@ -270,7 +270,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
         for row in rset['rows']:
             res.append(
                 self.blueprint.generate_browser_node(
-                    row['name'],
+                    row['oid'],
                     scid,
                     row['name'],
                     icon="icon-synonym"
@@ -467,13 +467,16 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
             SQL = render_template("/".join([self.template_path,
                                             'get_parent_oid.sql']),
                                   data=data, conn=self.conn)
-            status, parent_id = self.conn.execute_scalar(SQL)
+            status, res = self.conn.execute_dict(SQL)
             if not status:
                 return internal_server_error(errormsg=res)
 
+            parent_id = res['rows'][0]['scid']
+            syid = res['rows'][0]['syid']
+
             return jsonify(
                 node=self.blueprint.generate_browser_node(
-                    data['name'],
+                    syid,
                     int(parent_id),
                     data['name'],
                     icon="icon-synonym"
@@ -556,7 +559,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
         data = request.form if request.form else json.loads(
             request.data, encoding='utf-8'
         )
-        SQL = self.get_sql(gid, sid, data, scid, syid)
+        SQL, name = self.get_sql(gid, sid, data, scid, syid)
         # Most probably this is due to error
         if not isinstance(SQL, (str, unicode)):
             return SQL
@@ -570,7 +573,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
                 node=self.blueprint.generate_browser_node(
                     syid,
                     scid,
-                    syid,
+                    name,
                     icon="icon-synonym"
                 )
             )
@@ -598,7 +601,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
                 data[k] = v
 
         try:
-            SQL = self.get_sql(gid, sid, data, scid, syid)
+            SQL, name = self.get_sql(gid, sid, data, scid, syid)
             # Most probably this is due to error
             if not isinstance(SQL, (str, unicode)):
                 return SQL
@@ -614,6 +617,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
         """
         This function will genrate sql from model data
         """
+        name = None
         if syid is not None:
             SQL = render_template("/".join([self.template_path,
                                             'properties.sql']),
@@ -626,6 +630,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
                     gettext("Could not find the synonym on the server.")
                 )
             old_data = res['rows'][0]
+            name = old_data['name']
             # If target schema/object is not present then take it from
             # old data, it means it does not changed
             if 'synobjschema' not in data:
@@ -646,10 +651,11 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
                 if arg not in data:
                     return "-- missing definition"
 
+            name = data['name']
             SQL = render_template("/".join([self.template_path,
                                             'create.sql']), comment=False,
                                   data=data, conn=self.conn)
-        return SQL.strip('\n')
+        return SQL.strip('\n'), name
 
     @check_precondition
     def sql(self, gid, sid, did, scid, syid, diff_schema=None,
@@ -757,7 +763,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
             return internal_server_error(errormsg=res)
 
         for row in rset['rows']:
-            status, data = self._fetch_properties(scid, row['name'])
+            status, data = self._fetch_properties(scid, row['oid'])
             if status:
                 res[row['name']] = data
 
@@ -781,7 +787,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
         if data:
             if diff_schema:
                 data['schema'] = diff_schema
-            sql = self.get_sql(gid, sid, data, scid, oid)
+            sql, name = self.get_sql(gid, sid, data, scid, oid)
         else:
             if drop_sql:
                 sql = self.delete(gid=gid, sid=sid, did=did,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js
index 42c361633..057cb2d97 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym.js
@@ -69,7 +69,7 @@ define('pgadmin.node.synonym', [
         isNew: function() {
           return !this.fetchFromServer;
         },
-        idAttribute: 'name',
+        idAttribute: 'oid',
         // Default values!
         initialize: function(attrs, args) {
           var isNew = (_.size(attrs) === 0);
@@ -93,6 +93,9 @@ define('pgadmin.node.synonym', [
           id: 'name', label: gettext('Name'), cell: 'string',
           type: 'text', mode: ['properties', 'create', 'edit'],
           disabled: 'inSchema', readonly: function(m) { return !m.isNew(); },
+        },{
+          id: 'oid', label: gettext('OID'), cell: 'string',
+          type: 'text', mode: ['properties'],
         },{
           id: 'owner', label: gettext('Owner'), cell: 'string',
           type: 'text', mode: ['properties', 'create', 'edit'],
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.2_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.2_plus/properties.sql
index ec2724a0a..cb4c66c28 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.2_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.2_plus/properties.sql
@@ -26,6 +26,6 @@ SELECT synname AS name, pg_get_userbyid(synowner) AS owner,
 FROM pg_synonym s  JOIN pg_namespace ns ON s.synnamespace = ns.oid
  WHERE s.synnamespace={{scid}}::oid
  {% if syid %}
-   AND s.synname={{ syid|qtLiteral }}
+   AND s.oid={{syid}}::oid
  {% endif %}
-ORDER BY synname;
\ No newline at end of file
+ORDER BY synname;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.5_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.5_plus/properties.sql
index ec2724a0a..0b3b82d97 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.5_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/9.5_plus/properties.sql
@@ -1,4 +1,4 @@
-SELECT synname AS name, pg_get_userbyid(synowner) AS owner,
+SELECT s.oid, synname AS name, pg_get_userbyid(synowner) AS owner,
   synobjschema, synobjname,  ns.nspname as schema,
   COALESCE(
   (SELECT relkind
@@ -26,6 +26,6 @@ SELECT synname AS name, pg_get_userbyid(synowner) AS owner,
 FROM pg_synonym s  JOIN pg_namespace ns ON s.synnamespace = ns.oid
  WHERE s.synnamespace={{scid}}::oid
  {% if syid %}
-   AND s.synname={{ syid|qtLiteral }}
+   AND s.oid={{syid}}::oid
  {% endif %}
-ORDER BY synname;
\ No newline at end of file
+ORDER BY synname;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/get_parent_oid.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/get_parent_oid.sql
index 08f07e031..e21f9683e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/get_parent_oid.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/get_parent_oid.sql
@@ -1,5 +1,5 @@
-SELECT synnamespace as scid
+SELECT s.oid as syid, synnamespace as scid
     FROM pg_synonym s
 WHERE synname = {{ data.name|qtLiteral }}
 AND synnamespace IN
-    ( SELECT oid FROM pg_namespace WHERE nspname = {{ data.schema|qtLiteral }} );
\ No newline at end of file
+    ( SELECT oid FROM pg_namespace WHERE nspname = {{ data.schema|qtLiteral }} );
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/nodes.sql
index 1f8259b4a..c1df07f08 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/nodes.sql
@@ -1,4 +1,4 @@
-SELECT synname as name
+SELECT s.oid, synname as name
 FROM pg_synonym s
     JOIN pg_namespace ns ON s.synnamespace = ns.oid
     AND s.synnamespace = {{scid}}::oid
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/properties.sql
index ce6d59b14..eab57c8e3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonyms/sql/default/properties.sql
@@ -14,6 +14,6 @@ SELECT synname AS name, pg_get_userbyid(synowner) AS owner,
 FROM pg_synonym s  JOIN pg_namespace ns ON s.synnamespace = ns.oid
  WHERE s.synnamespace={{scid}}::oid
  {% if syid %}
-   AND s.synname={{ syid|qtLiteral }}
+   AND s.oid={{syid}}::oid
  {% endif %}
-ORDER BY synname;
\ No newline at end of file
+ORDER BY synname;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete.py
index 88d749aec..bad95bf50 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete.py
@@ -59,11 +59,11 @@ class SynonymDeleteTestCase(BaseTestGenerator):
         self.sequence_id = sequence_utils.create_sequences(
             self.server, self.db_name, self.schema_name, self.sequence_name)
         self.synonym_name = "test_synonym_delete_%s" % str(uuid.uuid4())[1:8]
-        synonym_utils.create_synonym(self.server,
-                                     self.db_name,
-                                     self.schema_name,
-                                     self.synonym_name,
-                                     self.sequence_name)
+        self.syn_oid = synonym_utils.create_synonym(self.server,
+                                                    self.db_name,
+                                                    self.schema_name,
+                                                    self.synonym_name,
+                                                    self.sequence_name)
 
     def runTest(self):
         """This function will delete synonym under schema node."""
@@ -77,7 +77,7 @@ class SynonymDeleteTestCase(BaseTestGenerator):
         response = self.tester.delete(
             self.url + str(utils.SERVER_GROUP) + '/' +
             str(self.server_id) + '/' + str(self.db_id) + '/' +
-            str(self.schema_id) + '/' + str(self.synonym_name),
+            str(self.schema_id) + '/' + str(self.syn_oid),
             follow_redirects=True)
         self.assertEquals(response.status_code, 200)
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete_multiple.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete_multiple.py
index e5b17469f..361f54713 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete_multiple.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_delete_multiple.py
@@ -60,17 +60,18 @@ class SynonymDeleteMultipleTestCase(BaseTestGenerator):
         self.sequence_id = sequence_utils.create_sequences(
             self.server, self.db_name, self.schema_name, self.sequence_name)
         self.synonym_name = "test_synonym_delete_%s" % str(uuid.uuid4())[1:8]
-        synonym_utils.create_synonym(self.server,
-                                     self.db_name,
-                                     self.schema_name,
-                                     self.synonym_name,
-                                     self.sequence_name)
+        self.syn_oid = synonym_utils.create_synonym(self.server,
+                                                    self.db_name,
+                                                    self.schema_name,
+                                                    self.synonym_name,
+                                                    self.sequence_name)
+
         self.synonym_name_1 = "test_synonym_delete_%s" % str(uuid.uuid4())[1:8]
-        synonym_utils.create_synonym(self.server,
-                                     self.db_name,
-                                     self.schema_name,
-                                     self.synonym_name_1,
-                                     self.sequence_name)
+        self.syn_oid_1 = synonym_utils.create_synonym(self.server,
+                                                      self.db_name,
+                                                      self.schema_name,
+                                                      self.synonym_name_1,
+                                                      self.sequence_name)
 
     def runTest(self):
         """This function will delete synonym under schema node."""
@@ -87,7 +88,7 @@ class SynonymDeleteMultipleTestCase(BaseTestGenerator):
         if not synonym_response:
             raise Exception("No synonym node to delete.")
 
-        data = {'ids': [self.synonym_name, self.synonym_name_1]}
+        data = {'ids': [self.syn_oid, self.syn_oid_1]}
         response = self.tester.delete(
             self.url + str(utils.SERVER_GROUP) + '/' +
             str(self.server_id) + '/' + str(self.db_id) + '/' +
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_get.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_get.py
index 60f565b35..6681f1e6d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_get.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_get.py
@@ -59,11 +59,11 @@ class SynonymGetTestCase(BaseTestGenerator):
         self.sequence_id = sequence_utils.create_sequences(
             self.server, self.db_name, self.schema_name, self.sequence_name)
         self.synonym_name = "test_synonym_get_%s" % str(uuid.uuid4())[1:8]
-        synonym_utils.create_synonym(self.server,
-                                     self.db_name,
-                                     self.schema_name,
-                                     self.synonym_name,
-                                     self.sequence_name)
+        self.syn_oid = synonym_utils.create_synonym(self.server,
+                                                    self.db_name,
+                                                    self.schema_name,
+                                                    self.synonym_name,
+                                                    self.sequence_name)
 
     def runTest(self):
         """This function will fetch synonym under schema node."""
@@ -71,7 +71,7 @@ class SynonymGetTestCase(BaseTestGenerator):
         response = self.tester.get(
             self.url + str(utils.SERVER_GROUP) + '/' +
             str(self.server_id) + '/' + str(self.db_id) + '/' +
-            str(self.schema_id) + '/' + str(self.synonym_name),
+            str(self.schema_id) + '/' + str(self.syn_oid),
             follow_redirects=True)
         self.assertEquals(response.status_code, 200)
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_put.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_put.py
index df0ab0000..b9faa7087 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_put.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/test_synonym_put.py
@@ -66,11 +66,11 @@ class SynonymPutTestCase(BaseTestGenerator):
         self.sequence_id = sequence_utils.create_sequences(
             self.server, self.db_name, self.schema_name, self.sequence_name)
         self.synonym_name = "test_synonym_put_%s" % str(uuid.uuid4())[1:8]
-        synonym_utils.create_synonym(self.server,
-                                     self.db_name,
-                                     self.schema_name,
-                                     self.synonym_name,
-                                     self.sequence_name)
+        self.syn_oid = synonym_utils.create_synonym(self.server,
+                                                    self.db_name,
+                                                    self.schema_name,
+                                                    self.synonym_name,
+                                                    self.sequence_name)
 
     def runTest(self):
         """This function will update synonym under schema node."""
@@ -96,7 +96,7 @@ class SynonymPutTestCase(BaseTestGenerator):
             str(self.server_id) + '/' +
             str(self.db_id) + '/' +
             str(self.schema_id) + '/' +
-            str(self.synonym_name),
+            str(self.syn_oid),
             data=json.dumps(data),
             follow_redirects=True)
         self.assertEquals(response.status_code, 200)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/utils.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/utils.py
index a62cd706e..f5f4cbd42 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/utils.py
@@ -40,6 +40,14 @@ def create_synonym(server, db_name, schema_name, synonym_name, sequence_name):
             schema_name, synonym_name, schema_name, sequence_name)
         pg_cursor.execute(query)
         connection.commit()
+
+        # Get 'oid' from newly created synonym
+        pg_cursor.execute("SELECT s.oid as name FROM"
+                          " pg_synonym s WHERE s.synname='%s'" %
+                          synonym_name)
+        synonym = pg_cursor.fetchone()
+        connection.close()
+        return synonym[0]
     except Exception:
         traceback.print_exc(file=sys.stderr)
 
diff --git a/web/pgadmin/tools/schema_diff/directory_compare.py b/web/pgadmin/tools/schema_diff/directory_compare.py
index 4fabca1e7..23d195329 100644
--- a/web/pgadmin/tools/schema_diff/directory_compare.py
+++ b/web/pgadmin/tools/schema_diff/directory_compare.py
@@ -53,9 +53,6 @@ def compare_dictionaries(view_object, source_params, target_params,
         source_object_id = None
         if 'oid' in source_dict[item]:
             source_object_id = source_dict[item]['oid']
-        elif 'name' in source_dict[item]:
-            # For synonyms use name as OID
-            source_object_id = source_dict[item]['name']
 
         if node == 'table':
             temp_src_params = copy.deepcopy(source_params)
@@ -96,9 +93,6 @@ def compare_dictionaries(view_object, source_params, target_params,
         target_object_id = None
         if 'oid' in target_dict[item]:
             target_object_id = target_dict[item]['oid']
-        elif 'name' in target_dict[item]:
-            # For synonyms use name as OID
-            target_object_id = target_dict[item]['name']
 
         if node == 'table':
             temp_tgt_params = copy.deepcopy(target_params)
@@ -140,10 +134,6 @@ def compare_dictionaries(view_object, source_params, target_params,
         if 'oid' in source_dict[key]:
             source_object_id = source_dict[key]['oid']
             target_object_id = target_dict[key]['oid']
-        elif 'name' in target_dict[key]:
-            # For synonyms use name as OID
-            source_object_id = source_dict[key]['name']
-            target_object_id = target_dict[key]['name']
 
         # Recursively Compare the two dictionary
         if are_dictionaries_identical(dict1[key], dict2[key], ignore_keys):


^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgAdmin4][Patch] - RM 5270 - [EPAS] Synonym properties does not show OID.
@ 2020-04-10 09:25  Akshay Joshi <[email protected]>
  parent: Khushboo Vashi <[email protected]>
  0 siblings, 0 replies; 8+ messages in thread

From: Akshay Joshi @ 2020-04-10 09:25 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers

Thanks patch applied.

On Fri, Apr 10, 2020 at 11:58 AM Khushboo Vashi <
[email protected]> wrote:

> Hi,
>
> Please find the attached updated patch.
>
> Thanks,
> Khushboo
>
> On Fri, Apr 10, 2020 at 10:41 AM Khushboo Vashi <
> [email protected]> wrote:
>
>> Hi Akshay,
>>
>> On Wed, Apr 8, 2020 at 12:33 PM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Hi Khushboo
>>>
>>> Schema Diff test cases are failing with this patch. Please fix and
>>> resend the patch.
>>>
>>> Fixed.
>
> Thanks,
> Khushboo
>
>> Can you please re-verify as I don't think schema diff test cases are
>> failing due to this patch.
>>
>> Thanks,
>> Khushboo
>>
>>> On Tue, Apr 7, 2020 at 6:37 PM Khushboo Vashi <
>>> [email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> Please find the attached patch to fix the RM # 5270 - [EPAS] Synonym
>>>> properties does not show OID.
>>>>
>>>> As per the current implementation, we completely ignored OID and
>>>> instead considered the name as the unique field, now with this patch OID
>>>> will be used as an unique id and also will display OID in the properties
>>>> tab.
>>>>
>>>> Thanks,
>>>> Khushboo
>>>>
>>>>
>>>
>>> --
>>> *Thanks & Regards*
>>> *Akshay Joshi*
>>>
>>> *Sr. Software Architect*
>>> *EnterpriseDB Software India Private Limited*
>>> *Mobile: +91 976-788-8246*
>>>
>>

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2020-04-10 09:25 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 13:07 [pgAdmin4][Patch] - RM 5270 - [EPAS] Synonym properties does not show OID. Khushboo Vashi <[email protected]>
2020-04-08 07:03 ` Akshay Joshi <[email protected]>
2020-04-10 05:11   ` Khushboo Vashi <[email protected]>
2020-04-10 06:28     ` Khushboo Vashi <[email protected]>
2020-04-10 09:25       ` Akshay Joshi <[email protected]>
2020-04-08 07:09 ` Ashesh Vashi <[email protected]>
2020-04-08 07:17   ` Khushboo Vashi <[email protected]>
2020-04-08 07:23     ` Akshay Joshi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox