Current state of VIEW bugs in MySQL 5.0
While the majority of the really serious and crashing bugs are fixed right now in MySQL 5.0, there are still a lot of bugs that only surface in some very specific queries. One area that seems to be more heavily affected in particular are VIEWs.
To keep track of the ongoing progress I just compiled a list of my VIEW bugs that have just been fixed with the current releases or are probably going to be fixed in one of the next. Interestingly, I hit five of them (#19077, #19089, #19111, #19114, #19714) with just one single set of nested VIEWs. I bet you believe me, that it took me some time to figure out why my final query just wouldn't return the result I expected.
- Bug #15950 (no schedule for fix available yet)
- Functions returning the current date or time (such as
NOW()) get optimized away to a constant when used insideBETWEEN ... AND ...at the time of the creation of aVIEW. This will of course render theVIEWuseless as time progresses.
This is the longest standing of myVIEWbugs, posted back at the end of last year, and still in verified state. But you can easily work around it by just using<=and>=operators instead ofBETWEEN ... AND .... - Bug #19111 (no schedule for fix available yet)
- A
TRIGGERthat selects from aVIEWon the same table that fires thatTRIGGERfails withERROR 1443 (HY000): The definition of table 'v' prevents operation INSERT on table 't'. The strange thing is, that this worked (at least for some cases) in versions before 5.0.20. If you convert theVIEWto an inlinedSELECTstatement directly inside theTRIGGERit also works. - Bug #19714 (no schedule for fix available yet)
COALESCE()returns a wrong data type in someVIEWs, e.g.BIGINTeven if onlyINTs are listed as arguments.- Bug #19089 (to be fixed in 5.0.23 or 5.0.24)
- There are problems with
VIEWs regardingDEFAULTvalues of underlying tables. The bug affects someCREATE TABLE ... SELECTstatements selecting from aVIEW. MySQL could fail with anERROR 1067 (42000): Invalid default valueon such a command or could succeed but wouldn't propagate theDEFAULTsettings to the newly created table.
This is currently in patch approved state and will probably be fixed in 5.0.23 or 5.0.24. - Bug #19077 (fixed in 5.0.23)
- Nested derived tables (built from unnamed views or real
VIEWs alike) returned wrong results for certain data types if they were using certain aggregate functions (such asMAX()orMIN()).
This will be fixed in 5.0.23. - Bug #19114 (fixed in 5.0.21)
DESCRIBEandinformation_schemawas broken forVIEWSwith a storedFUNCTIONin theSELECTlist to which the user had no explicitEXECUTErights but only implicit through the use of theVIEWdefined asSQL SECURITY DEFINER.
This had been detected in 5.0.20 and just disappeared in 5.0.21.- Bug #15153 (fixed in 5.0.21)
- A
CONVERT_TZ()failed if used in theSELECTlist of aVIEW(even after a corresponding earlier bug had been fixed).
This had been fixed in 5.0.21.
Please note that there were and are other issues with VIEWs. This is just the list of bugs that I discovered.
I also think there might still be some more of the especially minor bugs (such as data type issues) hidden inside VIEWs. So please pay attention when you discover something that just seems to look strange and try to post repeatable bug reports. The developers do a great job in fixing them.