Bug #13109 | Views are not stored with original formatting | ||
---|---|---|---|
Submitted: | 11 Sep 2005 4:44 | Modified: | 3 Oct 2008 21:10 |
Reporter: | Tom Khoury | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server | Severity: | S4 (Feature request) |
Version: | 5.0.12 | OS: | Windows (Windows XP) |
Assigned to: | CPU Architecture: | Any |
[11 Sep 2005 4:44]
Tom Khoury
[11 Sep 2005 9:27]
Valeriy Kravchuk
Yes, you are right, your "specific formatting" is not preserved: mysql> create view v1 -> as -> select * -> from table_1; Query OK, 0 rows affected (0.02 sec) mysql> show create table v1; +------+------------------------------------------------------------------------ -------------------------------------------------------------------------------- -----------------------------------------------------------+ | View | Create View | +------+------------------------------------------------------------------------ -------------------------------------------------------------------------------- -----------------------------------------------------------+ | v1 | CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select `test`.`table_1`.`Number` AS `Number`,`test`.`table_1`.`hint` AS `hint`,`test`.`table_1`.`id` AS `id`,`test`.`table_1`.`day` AS `day` from `test`.`table_1` | +------+------------------------------------------------------------------------ -------------------------------------------------------------------------------- -----------------------------------------------------------+ 1 row in set (0.02 sec) mysql> select version(); +----------------+ | version() | +----------------+ | 5.0.12-beta-nt | +----------------+ 1 row in set (0.00 sec) But, first of all, current behaviour is not a (serious) bug. In case of view database engine can not just store 'select *', for example, bacause it needs to know exact number, types and names of columns without additional queries to the base tables. So, in any database engine (not only MySQL) DDL statements are not always stored exactly as you enter them. You should save your statements in you own scripts, with any comments and indentation you like. Database stores them as it seemed efficient to its developers. As for storing comments for tables, views, columns - it seems a reasonable feture request for me. At least, Oracle allows to do so. That it why I changed severity of your bug report.
[3 Oct 2008 21:10]
Konstantin Osipov
Thank you, this is a duplicate of Bug#5159
[4 Nov 2009 16:14]
Valeriy Kravchuk
Bug #48535 was marked as a duplicate of this one.