Bug #68873 after DESC bad view; SHOW CREATE VIEW bad; server crash
Submitted: 5 Apr 2013 12:31 Modified: 9 Apr 2013 0:35
Reporter: Programmer Old Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.5.8-log OS:Windows (Vista)
Assigned to: CPU Architecture:Any

[5 Apr 2013 12:31] Programmer Old
Description:
After use of DESCRIBE and SHOW CREATE VIEW on a view made bad by loss of a table, the server crashes. This seems like bugs 44281, 44283, 45251, 34902.

The complex join seems needful.

How to repeat:
-- like 44281, 44283, 45251, 34902

CREATE TABLE eMail2
(	MemberID int(11) NOT NULL
,	CONSTRAINT FOREIGN KEY (MemberID) REFERENCES address (MemberID)
,	Rank tinyint(3) unsigned NULL
,	CONSTRAINT UNIQUE (MemberID, Rank)
,	eMail varchar(57) PRIMARY KEY
);

CREATE TABLE eMail2
(	MemberID INTEGER REFERENCES Address (MemberID)
,	Rank tinyint(3) unsigned NULL
,	CONSTRAINT UNIQUE (MemberID, Rank)
,	eMail varchar(57) PRIMARY KEY
);

CREATE TABLE Nam
(	MemberID	INTEGER REFERENCES Address (MemberID)
,	Rank	TINYINT
,	PRIMARY KEY(MemberID, Rank)
);

CREATE OR REPLACE VIEW M0N AS
SELECT Nam.MemberID, GROUP_CONCAT(Email SEPARATOR ' ') AS eMail
FROM Nam LEFT JOIN eMail2 ON Nam.MemberID = eMail2.MemberID AND MOD(eMail2.Rank, 50) > 0 IS NOT TRUE;

DROP TABLE eMail2;	-- view is now bad
DESC M0N;
SHOW CREATE VIEW M0N

Suggested fix:
The server not crash on a bad view
[5 Apr 2013 17:11] MySQL Verification Team
Please try latest version.

mysql> DROP TABLE eMail2;       -- view is now bad
Query OK, 0 rows affected (0.01 sec)

mysql> DESC M0N;
ERROR 1356 (HY000): View 'test.m0n' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
mysql> SHOW CREATE VIEW M0N
    -> ;
+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+---
-------------------+
| View | Create View
                                                                                                                                                                   | character_set_client | co
llation_connection |
+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+---
-------------------+
| m0n  | CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `m0n` AS select `test`.`nam`.`MemberID` AS `MemberID`,group_concat(`test`.`email2`.`eMail` separator
' ') AS `eMail` from (`nam` left join `email2` on(((`test`.`nam`.`MemberID` = `test`.`email2`.`MemberID`) and (((`test`.`email2`.`Rank` % 50) > 0) is not true)))) | latin1               | la
tin1_swedish_ci    |
+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+---
-------------------+
1 row in set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+----------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                                    |
+---------+------+----------------------------------------------------------------------------------------------------------------------------+
| Warning | 1356 | View 'test.m0n' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them |
+---------+------+----------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show variables like "%version%";
+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| innodb_version          | 5.5.30                       |
| protocol_version        | 10                           |
| slave_type_conversions  |                              |
| version                 | 5.5.30                       |
| version_comment         | MySQL Community Server (GPL) |
| version_compile_machine | x86                          |
| version_compile_os      | Win64                        |
+-------------------------+------------------------------+
7 rows in set (0.00 sec)

mysql>
[5 Apr 2013 17:33] Programmer Old
Since only I program this instance, and I can avoid the bug, the first I found that crashes this server, I am not moved to try the latest--but I am curious, I want to know whether I gave you something that over by you crashes the very version that I have--and if I go to 5.6, which has features that interest me, is this all right.
[9 Apr 2013 0:35] MySQL Verification Team
Call stack from 5.5.8:

mysqld.exe!Item_func_group_concat::print()[item_sum.cc:3405]
mysqld.exe!Item::print_item_w_name()[item.cc:501]
mysqld.exe!st_select_lex::print()[sql_select.cc:17227]
mysqld.exe!st_select_lex_unit::print()[sql_lex.cc:2150]
mysqld.exe!view_store_create_info()[sql_show.cc:1709]
mysqld.exe!mysqld_show_create()[sql_show.cc:715]
mysqld.exe!mysql_execute_command()[sql_parse.cc:2638]
mysqld.exe!mysql_parse()[sql_parse.cc:5501]
mysqld.exe!dispatch_command()[sql_parse.cc:1035]
mysqld.exe!do_command()[sql_parse.cc:772]
mysqld.exe!do_handle_one_connection()[sql_connect.cc:745]
mysqld.exe!handle_one_connection()[sql_connect.cc:686]
mysqld.exe!pthread_start()[my_winthread.c:63]
mysqld.exe!_callthreadstartex()[threadex.c:348]
mysqld.exe!_threadstartex()[threadex.c:326]
kernel32.dll!BaseThreadInitThunk()

Not repeatable on current 5.5.30 and 5.6.10.
Probably a duplicate of private bug:
http://bugs.mysql.com/bug.php?id=57130