[MDEV-16358] select current_date, current_date + 1 giving wrong results Created: 2018-05-31 Updated: 2018-05-31 Resolved: 2018-05-31 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Temporal Types |
| Affects Version/s: | 10.0.29-galera |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Prakash Reddy | Assignee: | Sergei Golubchik |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | foundation | ||
| Attachments: |
|
| Description |
|
When i used the below statement select current_date, current_date + 1 |
| Comments |
| Comment by Sergei Golubchik [ 2018-05-31 ] |
|
This is correct. You want to use current_date + interval 1 day or adddate(current_date, 1) or date_add(), see the manual: https://mariadb.com/kb/en/library/date-time-functions/ What you do, you use the date in a numeric context, so the date is converted to a number, producing a number (not a date!) 20180531. And then you add 1 to that. |
| Comment by Alexander Barkov [ 2018-05-31 ] |
|
We've just updated the documentation at https://mariadb.com/kb/en/library/type-conversion/ to make it more clear what happens on arithmetic operations. |