Bug #65668 TEMPORARY tables not editable using the SQL editor
Submitted: 19 Jun 2012 9:09 Modified: 19 Jun 2012 10:03
Reporter: Craig Fowler Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.38, 5.2.40 OS:Any
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D3 (Medium)

[19 Jun 2012 9:09] Craig Fowler
Description:
It would appear that temporary tables are not properly editable using the SQL editor, even when they meet the requirements (EG: they have a non-null primary key).  The UI presented indicates that the table is read-only and cannot be edited interactively.

How to repeat:
The SQL to repeat this is:

-- Begin SQL

DROP TABLE IF EXISTS `foo`;
CREATE TEMPORARY TABLE `foo` (
  `foo_id` INT NOT NULL,
  `note` VARCHAR(100) NOT NULL,
  PRIMARY KEY(`foo_id`)
);
INSERT INTO `foo` (`foo_id`, `note`) VALUES (1, 'Some text');
SELECT * FROM `foo`;

-- End SQL

The SQL editor should activate the interactive editing functionality (the table in question has a non-null PK) but where the table was created using CREATE TEMPORARY TABLE it is still displayed to the user as read-only.
[19 Jun 2012 10:03] Valeriy Kravchuk
Thank you for the problem report. Verified with 5.2.40 on Mac OS X also. Same table created without TEMPORARY keyword is editable, temporary one is read only.
[2 Nov 2012 3:10] Alfredo Kojima
The problem with temporary tables is that they are only visible in the same session where it was created and WB uses an auxiliary connection for anything that the user did not execute directly.  Because of that the query that fetches the table definition doesn't see the temporary table.