问题
Using Firebird and SQL Server, when I create an VIEW the query text remain exactly as I wrote. No matter if I use SQLDBX, IbExpert, FlameRobin or SSMS, it extracts the same query text.
But when it comes to MySQL, it COMPLETELY changes the query text. And when I extract it to a script, the carefully indented query text converts in a one BIG line of text.
It's indifferent if using an ODBC application (SQLDBX) or MySQL WorkBench, it's absolutely annoying.
After said that:
- There's some reasoning about why this works that way?
- There's any workaround?
回答1:
- Because mysql was designed this way. It interprets the code and transforms it into canonical form and in this process all indendations are lost. I would not even expect an rdbms to store the command in a nicely formatted way. That is not its purpose.
- Store the views', stored procedures', tables', etc nicely indented code in your version control system, where they belong.
来源:https://stackoverflow.com/questions/37475395/why-mysql-completely-reformat-the-view-query-text