public inbox for [email protected]  
help / color / mirror / Atom feed
From: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch] - RM 4380 - Table properties dialog - can not edit columns and partitions at the same time
Date: Thu, 20 Jun 2019 16:54:46 +0530
Message-ID: <CAFOhELdABPhOXgRfm8ARXHXL5HKcz+G6DoC0PmMuJKXX8c2qVw@mail.gmail.com> (raw)

Hi,

Please find the attached patch to fix the RM #4380 - Table properties
dialog - can not edit columns and partitions at the same time.

Thanks,
Khushboo


Attachments:

  [application/octet-stream] RM_4380.patch (4.8K, 3-RM_4380.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py
index 639e252b..e12d4e50 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py
@@ -1765,21 +1765,21 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
                         status, res = self.conn.execute_dict(properties_sql)
                         if not status:
                             return internal_server_error(errormsg=res)
-                        old_data = res['rows'][0]
+                        old_col_data = res['rows'][0]
 
-                        old_data['cltype'], old_data['hasSqrBracket'] = \
-                            self._cltype_formatter(old_data['cltype'])
-                        old_data = \
+                        old_col_data['cltype'], old_col_data['hasSqrBracket'] = \
+                            self._cltype_formatter(old_col_data['cltype'])
+                        old_col_data = \
                             BaseTableView.convert_length_precision_to_string(
-                                old_data
+                                old_col_data
                             )
 
                         fulltype = self.get_full_type(
-                            old_data['typnspname'],
-                            old_data['typname'],
-                            old_data['isdup'],
-                            old_data['attndims'],
-                            old_data['atttypmod']
+                            old_col_data['typnspname'],
+                            old_col_data['typname'],
+                            old_col_data['isdup'],
+                            old_col_data['attndims'],
+                            old_col_data['atttypmod']
                         )
 
                         def get_type_attr(key, data):
@@ -1790,9 +1790,9 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
 
                         # If the column data type has not changed then fetch
                         # old length and precision
-                        if 'elemoid' in old_data and 'cltype' not in c:
+                        if 'elemoid' in old_col_data and 'cltype' not in c:
                             length, precision, typeval = \
-                                self.get_length_precision(old_data['elemoid'])
+                                self.get_length_precision(old_col_data['elemoid'])
 
                             # If we have length & precision both
                             if length and precision:
@@ -1828,25 +1828,25 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
                             # datatype to new one.
 
                             if not length:
-                                old_data['attlen'] = -1
+                                old_col_data['attlen'] = -1
 
                             if not precision:
-                                old_data['attprecision'] = None
+                                old_col_data['attprecision'] = None
 
-                        old_data['cltype'] = DataTypeReader.parse_type_name(
-                            old_data['cltype']
+                        old_col_data['cltype'] = DataTypeReader.parse_type_name(
+                            old_col_data['cltype']
                         )
 
-                        if int(old_data['attlen']) == -1:
-                            old_data['attlen'] = None
-                        if 'attprecision' not in old_data:
-                            old_data['attprecision'] = None
+                        if int(old_col_data['attlen']) == -1:
+                            old_col_data['attlen'] = None
+                        if 'attprecision' not in old_col_data:
+                            old_col_data['attprecision'] = None
 
                         # Sql for alter column
                         if 'inheritedfrom' not in c:
                             column_sql += render_template("/".join(
                                 [self.column_template_path, 'update.sql']),
-                                data=c, o_data=old_data, conn=self.conn
+                                data=c, o_data=old_col_data, conn=self.conn
                             ).strip('\n') + '\n\n'
 
                 # If column(s) is/are added
@@ -1911,7 +1911,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
                         self.get_partitions_sql(temp_data).strip('\n') + '\n\n'
 
                 # Combine all the SQL together
-                SQL += partitions_sql.strip('\n')
+                SQL += '\n' + partitions_sql.strip('\n')
 
             # Check if index constraints are added/changed/deleted
             index_constraint_sql = self.get_index_constraint_sql(


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] - RM 4380 - Table properties dialog - can not edit columns and partitions at the same time
  In-Reply-To: <CAFOhELdABPhOXgRfm8ARXHXL5HKcz+G6DoC0PmMuJKXX8c2qVw@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