Why MySQL completely reformat the VIEW query text?

为君一笑 提交于 2021-02-16 21:08:27

问题


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:

  1. There's some reasoning about why this works that way?
  2. There's any workaround?

回答1:


  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.
  2. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!