| Bug #77015 | create view ignores precision parameter in time functions | ||
|---|---|---|---|
| Submitted: | 12 May 2015 11:29 | Modified: | 19 May 2015 10:07 |
| Reporter: | Ronald Evers | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
| Version: | 5.6.22, 5.6.24, 5.6.26 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[14 May 2015 5:41]
MySQL Verification Team
Hello Ronald Evers, Thank you for the report. Repeatable on 5.6 builds, most likely fixed in 5.7 builds after Bug #72472. Thanks, Umesh
[19 May 2015 10:07]
Ronald Evers
Looks very similar indeed! Sorry I did not find that report, I did search but me and the search form did not become friends. R

Description: Precision information for time functions like the 6 in "UTC_TIMESTAMP(6)" get ignored in CREATE VIEW statements. Instead, UTC_TIMESTAMP() is used. This also affects UTC_TIME, CURRENT_TIMESTAMP, CURRENT_TIME and possibly other time related functions. How to repeat: mysql> create view test as select utc_timestamp(6) as utcnow; mysql> show create view test\G View: test Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test` AS select utc_timestamp() AS `utcnow` character_set_client: utf8 collation_connection: utf8_general_ci mysql> select utcnow from test\G utc_timestamp(6): 2015-05-12 11:26:13 mysql> select date_format(utcnow, '%f') from test; date_format(`utc_timestamp(6)`, '%f'): 000000 You would expect to see a date/time with milliseconds in the output of the first select. But the value in the output is the result of utc_timestamp(), not of utc_timestamp(6). I.e.: there will be no milliseconds in the output. The second select using DATE_FORMAT to show only the milliseconds returns '000000'. Suggested fix: Properly process precision information for time functions in create view statements.