Bug #12971 | Inconsistent data in a view | ||
---|---|---|---|
Submitted: | 3 Sep 2005 20:10 | Modified: | 7 Sep 2005 17:46 |
Reporter: | Jakub Velkoborsky | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.0.12-beta | OS: | Linux (Linux, Windows) |
Assigned to: | Evgeny Potemkin | CPU Architecture: | Any |
[3 Sep 2005 20:10]
Jakub Velkoborsky
[4 Sep 2005 10:32]
Valeriy Kravchuk
I repeated this behaviour using the test case provided, also on Windows. The table used was the following: create table Tkupon ( id_kupon smallint(5) unsigned primary key auto_increment, kod char(12) unique not null, castka double(6,2) not null, id_user_pouzil smallint(5) unsigned, cas_pouziti datetime, cas_vydani datetime); Compare the results of: INSERT INTO Tkupon (kod,castka,cas_vydani) VALUES ('ASDFGHJKZXCV', 200, NOW()); SELECT * FROM Tkupon_aktivni; (newly inserted row is NOT visible in the select results) with the results of: INSERT INTO Tkupon (kod,castka,cas_vydani) VALUES ('ASDFGHJKZXCY', 200, NOW());SELECT * FROM Tkupon; (newly inserted row IS visible). This is definitely a bug, and no restrictions like that are desacribed at http://dev.mysql.com/doc/mysql/en/view-restrictions.html
[7 Sep 2005 17:46]
Evgeny Potemkin
View Tkupon_aktivni have condition cas_vydani < NOW(). NOW() measures time in seconds. INSERT just before SELECT takes less than second, thus in INSERT and in SELECT FROM tkupon_activni NOW() have the same value. Because of this just inserted record isn't selected.