Bug #5150 Views: View using function: fails
Submitted: 23 Aug 2004 0:40 Modified: 6 Sep 2004 13:43
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[23 Aug 2004 0:40] Peter Gulutzan
Description:
The trouble is that MySQL allows DROP without CASCADE or 
RESTRICT. Therefore I can drop something that a view 
depends on, and make it again in a different way. That 
will cause a crash. See also bug#4605, which is marked 
"Can't repeat". This is similar, but maybe you can repeat 
it this time. 

How to repeat:
mysql> create function x () returns int return 5; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> create view vx as select x (); 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> select * from vx; 
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use near ') AS `x ()`' at 
line 1 
mysql> select * from vx; 
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use near ') AS `x ()`' at 
line 1 
mysql> select * from vx; 
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use near ') AS `x ()`' at 
line 1 
mysql> select x (); 
+------+ 
| x () | 
+------+ 
|    5 | 
+------+ 
1 row in set (0.00 sec) 
 
mysql> show create view vx; 
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use near ') AS `x ()`' at 
line 1 
mysql> show create view vx; 
Packets out of order (Found: 2, expected 1) 
ERROR 2013 (HY000): Lost connection to MySQL server during query
[23 Aug 2004 0:55] Peter Gulutzan
The initial comment was incorrect. This bug applies to views with any function, not 
dropped functions.
[30 Aug 2004 21:54] Oleksandr Byelkin
ChangeSet 
  1.1738 04/08/30 22:52:50 bell@sanja.is.com.ua +3 -0 
  fixed case when real length very close to calculated (BUG#5150)
[6 Sep 2004 13:43] Oleksandr Byelkin
Thank you for bugreport! 
Bug is fixed patch ios pushed into our source repository.