Bug #56971 SQL Editor - VIEW insert/update self-rewriting statement content
Submitted: 23 Sep 2010 14:38 Modified: 23 Sep 2010 17:00
Reporter: Przemek Zawada Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S4 (Feature request)
Version:5.2 OS:Windows (XP SP3)
Assigned to: CPU Architecture:Any
Tags: self-rewriting, statement content, view statement

[23 Sep 2010 14:38] Przemek Zawada
Description:
After adding VIEW statement body and opening it again (ie. for editing [alter view]), the VIEW body is rewritten to one, long, unreadable, non-userfriendly line.

An example of initial VIEW body:
[code]CREATE VIEW `nlc_cup`.`View_Select_CupResult` AS
SELECT
    CupResult.*
FROM
    cup_result CupResult
ORDER BY
    CupResult.ID;[/code]

Re-opened VIEW body:
[code]CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_select_cupresult` AS select `cupresult`.`ID` AS `ID`,`cupresult`.`Result_Event_ID` AS `Result_Event_ID`,`cupresult`.`Result_Request_ID` AS `Result_Request_ID`,`cupresult`.`Result_Lap` AS `Result_Lap`,`cupresult`.`Result_Time` AS `Result_Time`,`cupresult`.`Result_Pens` AS `Result_Pens`,`cupresult`.`Result_Total` AS `Result_Total`,`cupresult`.`Result_Limit` AS `Result_Limit`,`cupresult`.`Result_Finished` AS `Result_Finished` from `cup_result` `cupresult` order by `cupresult`.`ID`[/code]

How to repeat:
Step 1
Create new VIEW in schema (my example name: view_select_cupresult)

Step 2
Build schema with tabs, spaces, random select-output columns, etc.

Step 3
Insert VIEW into your schema

Step 4
Refresh 'Overview' window

Step 5
Right-click on VIEW-name for 'alter view' Context Menu Item for editing VIEW

Output:
Your initial VIEW body does not exists, the body has been rewritten into one, HUGE (especially when many table columns retrieved) line.

Suggested fix:
As I presume, the Workbench do the I/O procedure from the database engine and does not re-parse VIEW statement content, so I think the problem lays on the server ground, which need to be fixed somehow.
[23 Sep 2010 17:00] Valeriy Kravchuk
This is a duplicate of Bug #52004.