Bug #36633 MICROSECOND accepted, SQL_TSI_MICROSECOND not accepted
Description:
In the work done for Bug#33834, MICROSECOND was implemented as an allowable unit type for TIMESTAMPADD(). However, all other unit types can be specified with a SQL_TSI_ prefix. This seems to have been overlooked for SQL_TSI_MICROSECOND. It should be implemented to be consistent with the documentation for TIMESTAMPADD():
"
The unit value may be specified using one of keywords as shown, or with a prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.
"
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
How to repeat:
mysql> select timestampadd(DAY,1,'2000-01-01 00:00:00');
+-------------------------------------------+
| timestampadd(DAY,1,'2000-01-01 00:00:00') |
+-------------------------------------------+
| 2000-01-02 00:00:00 |
+-------------------------------------------+
1 row in set (0.01 sec)
mysql> select timestampadd(SQL_TSI_DAY,1,'2000-01-01 00:00:00');
+---------------------------------------------------+
| timestampadd(SQL_TSI_DAY,1,'2000-01-01 00:00:00') |
+---------------------------------------------------+
| 2000-01-02 00:00:00 |
+---------------------------------------------------+
1 row in set (0.00 sec)
mysql> select timestampadd(MICROSECOND,1,'2000-01-01 00:00:00');
+---------------------------------------------------+
| timestampadd(MICROSECOND,1,'2000-01-01 00:00:00') |
+---------------------------------------------------+
| 2000-01-01 00:00:00.000001 |
+---------------------------------------------------+
1 row in set (0.00 sec)
mysql> select timestampadd(SQL_TSI_MICROSECOND,1,'2000-01-01 00:00:00');
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 'SQL_TSI_MICROSECOND,1,'2000-01-01 00:00:00')' at line 1
Suggested fix:
I suppose, add this to lex.h, in the section where the other SQL_TSI_ symbols are defined:
{ "SQL_TSI_MICROSECOND", SYM(MICROSECOND_SYM)},
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.