Bug #102496 Workbench crashes when hitting refresh on table info for the partition tab
Submitted: 5 Feb 2021 16:18 Modified: 7 Feb 2021 5:20
Reporter: Brian Trembley Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:8.0.23, 8.0.27 OS:Windows (Microsoft Windows 10 Pro)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[5 Feb 2021 16:18] Brian Trembley
Description:
Here's the important bits from C:\Users\User\AppData\Roaming\MySQL\Workbench\log\wb.log

11:08:43 [INF][      Workbench]: UI is up
11:08:43 [INF][      Workbench]: Running the application
11:09:37 [INF][SQL Editor Form]: Opened connection 'Local instance MySQL80' to MySQL Community Server - GPL version 8.0.23
11:09:37 [ERR][SQL Editor Form]: Unable to create db_mgmt_SSHConnectionRef object
11:09:37 [ERR][SQL Editor Form]: Unable to create db_mgmt_SSHConnectionRef object
11:09:37 [INF][        WQE.net]: Launching SQL IDE
11:09:38 [INF][        WQE.net]: SQL IDE UI is ready
11:09:47 [WRN][         mforms]: Resource file not found: db.Constraints.16x16.png
11:09:47 [WRN][         mforms]: Resource file not found: db.Partitions.16x16.png
11:09:47 [WRN][         mforms]: Resource file not found: db.Grants.16x16.png
11:09:47 [WRN][         mforms]: Resource file not found: db.Grants.16x16.png
11:09:47 [ERR][sqlide_tableman_ext.py:show_table:1186]: Error initializing tab partitions: Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\sqlide_tableman_ext.py", line 1183, in show_table
    tab.show_table(schema, table)
  File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\sqlide_tableman_ext.py", line 854, in show_table
    self.refresh()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\sqlide_catalogman_ext.py", line 373, in refresh
    self.preload_data(self.get_query())
  File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\sqlide_catalogman_ext.py", line 367, in preload_data
    node.set_string(i, rset.stringFieldValueByName(field) or "" if format_func is None else format_func(rset.stringFieldValueByName(field)))
SystemError: invalid column partition_name for resultset

How to repeat:
CREATE TABLE `jo` (
  `a` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
PARTITION BY HASH (`a`)
PARTITIONS 3
(PARTITION p0 ENGINE = InnoDB DATA DIRECTORY = 'C:/temp/DRIVEA',
 PARTITION p1 ENGINE = InnoDB DATA DIRECTORY = 'C:/temp/DRIVEB',
 PARTITION p3 ENGINE = InnoDB DATA DIRECTORY = 'C:/temp/DRIVEC');

Then hit information on the table from the schema navigator.
Go to the partition tab. It shows as blank (prob 1)
Hit refresh and Workbench crashes (prob 2)

Suggested fix:
Don't crash  ;)
I'm guessing the slashes are causing a problem
[7 Feb 2021 5:20] MySQL Verification Team
Hello Brian,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh
[26 Oct 2021 13:14] MySQL Verification Team
Bug #101484 marked as duplicate of this one.
[22 Feb 7:11] Pongrác Németh
The solution:
In file "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\sqlide_tableman_ext.py"
Line number: 931
Change all field-names to uppercase!:

    columns = [("partition_name", IconStringColumnType, "Name", 200, None),
               ("subpartition_name", StringColumnType, "Subpartiton Name", 100, None),
               ("partition_ordinal_position", LongIntegerColumnType, "Ordinal Pos", 100, None),
               ("subpartition_ordinal_position", LongIntegerColumnType, "Subpartiton Ordinal Pos", 100, None),
               ("partition_method", StringColumnType, "Partition Method", 100, None),
               ("subpartition_method", StringColumnType, "Subpartition Method", 100, None),
               ("partition_expression", StringColumnType, "Partition expression", 100, None),
               ("subpartition_expression", StringColumnType, "Subpartition expression", 100, None),
               ("partition_description", StringColumnType, "Partition description", 100, None),
               ("table_rows", LongIntegerColumnType, "Table rows", 100, None),
               ("avg_row_length", LongIntegerColumnType, "AVG row length", 100, None),
               ("data_length", LongIntegerColumnType, "Data length", 100, None),
               ("max_data_length", LongIntegerColumnType, "max data length", 100, None),
               ("index_length", LongIntegerColumnType, "Index length", 100, None),
               ("create_time", StringColumnType, "Create time", 150, None),
               ("update_time", StringColumnType, "Update time", 150, None),
               ("check_time", StringColumnType, "Check time", 150, None)]

----->>

    columns = [("PARTITION_NAME", IconStringColumnType, "Name", 200, None),
               ("SUBPARTITION_NAME", StringColumnType, "Subpartiton Name", 100, None),
               ("PARTITION_ORDINAL_POSITION", LongIntegerColumnType, "Ordinal Pos", 100, None),
               ("SUBPARTITION_ORDINAL_POSITION", LongIntegerColumnType, "Subpartiton Ordinal Pos", 100, None),
               ("PARTITION_METHOD", StringColumnType, "Partition Method", 100, None),
               ("SUBPARTITION_METHOD", StringColumnType, "Subpartition Method", 100, None),
               ("PARTITION_EXPRESSION", StringColumnType, "Partition expression", 100, None),
               ("SUBPARTITION_EXPRESSION", StringColumnType, "Subpartition expression", 100, None),
               ("PARTITION_DESCRIPTION", StringColumnType, "Partition description", 100, None),
               ("TABLE_ROWS", LongIntegerColumnType, "Table rows", 100, None),
               ("AVG_ROW_LENGTH", LongIntegerColumnType, "AVG row length", 100, None),
               ("DATA_LENGTH", LongIntegerColumnType, "Data length", 100, None),
               ("MAX_DATA_LENGTH", LongIntegerColumnType, "max data length", 100, None),
               ("INDEX_LENGTH", LongIntegerColumnType, "Index length", 100, None),
               ("CREATE_TIME", StringColumnType, "Create time", 150, None),
               ("UPDATE_TIME", StringColumnType, "Update time", 150, None),
               ("CHECK_TIME", StringColumnType, "Check time", 150, None)]