Bug #51028 Code format lost when creating view, please preserve line endings.
Submitted: 9 Feb 2010 15:30 Modified: 9 Feb 2010 17:29
Reporter: Neil Davis Email Updates:
Status: Won't fix Impact on me:
Category:MySQL Workbench: SQL Editor Severity:S4 (Feature request)
Version:all OS:Microsoft Windows (any version)
Assigned to: CPU Architecture:Any
Tags: code, format, MySQL, SOURCE, VIEW, workbench

[9 Feb 2010 15:30] Neil Davis
In MySQL workbench, when a view is created, if you need to later edit the view, the source for the view is all on one line in the editor.

This is very painful to work with and requires that you save each view as an SQL script so that you can later work on it without needing to reformat it. With a complex view involving several tables this can become quite painful.

No other database objects have the requirement to save out to a script to preserve formatting.

How to repeat:
create a view and format the code with a new line.
save the view.
close the view.
bring view back up for editing.
Your code formatting has disappeared.

Suggested fix:
preserve \r\n (or do necessary conversions to and from \n) so that code doesn't need to be reformatted every time you need to edit it.
[9 Feb 2010 16:50] Johannes Taxacher
unfortunately, our editor fetches code from server and receives it just as presented (without linebreaks).
[9 Feb 2010 17:10] Valeriy Kravchuk
This is a server-side limitation. See bug #5159, Bug #38137 and other duplicates. When server will preserve formatting for views, WB will be able to show it correctly.
[9 Feb 2010 17:29] Neil Davis
Apologies, I searched feature requests under workbench, not the server.

Using the keywords: view source format 

brought back over 300 results searching everything so I narrowed it to the workbench client only, which is the application where I noticed this.

When working from command line I save/edit everything in text files anyway and pipe them into the client to edit things, so did not notice this when working with the command line client.