public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch] - RM 4380 - Table properties dialog - can not edit columns and partitions at the same time
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][Patch] - RM 4380 - Table properties dialog - can not edit columns and partitions at the same time
@ 2019-06-20 11:24  Khushboo Vashi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Khushboo Vashi @ 2019-06-20 11:24 UTC (permalink / raw)
  To: pgadmin-hackers

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(


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

* Re: [pgAdmin4][Patch] - RM 4380 - Table properties dialog - can not edit columns and partitions at the same time
@ 2019-06-20 12:38  Dave Page <[email protected]>
  parent: Khushboo Vashi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2019-06-20 12:38 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers

Thanks, applied.

On Thu, Jun 20, 2019 at 12:25 PM Khushboo Vashi <
[email protected]> wrote:

> 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
>
>
>
>

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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


end of thread, other threads:[~2019-06-20 12:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 11:24 [pgAdmin4][Patch] - RM 4380 - Table properties dialog - can not edit columns and partitions at the same time Khushboo Vashi <[email protected]>
2019-06-20 12:38 ` Dave Page <[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