Bug #18100 | EXTRACT(QUARTER FROM {date}) returns unexpected results | ||
---|---|---|---|
Submitted: | 9 Mar 2006 10:02 | Modified: | 8 Apr 2006 13:46 |
Reporter: | Giles McArdell | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.0 | OS: | Linux (Linux (SUSE)) |
Assigned to: | Hartmut Holzgraefe | CPU Architecture: | Any |
[9 Mar 2006 10:02]
Giles McArdell
[9 Mar 2006 10:13]
Giles McArdell
Additional workaround, the following works in all cases: SELECT CAST((EXTRACT(MONTH FROM '2004-03-01') / 3) AS SIGNED)
[9 Mar 2006 11:52]
Hartmut Holzgraefe
Verified using the following statement which shows the result in a more meaningfull way, also changed the day from 1st to 15th to rule out time zone related problem: SELECT EXTRACT(QUARTER FROM '2004-00-15'), EXTRACT(QUARTER FROM '2004-01-15'), EXTRACT(QUARTER FROM '2004-02-15'), EXTRACT(QUARTER FROM '2004-03-15'), EXTRACT(QUARTER FROM '2004-04-15'), EXTRACT(QUARTER FROM '2004-05-15'), EXTRACT(QUARTER FROM '2004-06-15'), EXTRACT(QUARTER FROM '2004-07-15'), EXTRACT(QUARTER FROM '2004-08-15'), EXTRACT(QUARTER FROM '2004-09-15'), EXTRACT(QUARTER FROM '2004-10-15'), EXTRACT(QUARTER FROM '2004-11-15'), EXTRACT(QUARTER FROM '2004-12-15')\G *************************** 1. row *************************** EXTRACT(QUARTER FROM '2004-00-15'): 1 EXTRACT(QUARTER FROM '2004-01-15'): 1 EXTRACT(QUARTER FROM '2004-02-15'): 1 EXTRACT(QUARTER FROM '2004-03-15'): 2 EXTRACT(QUARTER FROM '2004-04-15'): 2 EXTRACT(QUARTER FROM '2004-05-15'): 2 EXTRACT(QUARTER FROM '2004-06-15'): 3 EXTRACT(QUARTER FROM '2004-07-15'): 3 EXTRACT(QUARTER FROM '2004-08-15'): 3 EXTRACT(QUARTER FROM '2004-09-15'): 4 EXTRACT(QUARTER FROM '2004-10-15'): 4 EXTRACT(QUARTER FROM '2004-11-15'): 4 EXTRACT(QUARTER FROM '2004-12-15'): 5 1 row in set, 1 warning (0.00 sec)
[22 Mar 2006 7:20]
Hartmut Holzgraefe
test case
Attachment: bug18100.tar.gz (application/x-gzip, text), 722 bytes.
[31 Mar 2006 23:22]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/4377
[7 Apr 2006 9:15]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/4606
[8 Apr 2006 13:46]
Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html Additional info: Documented bugfix in 5.0.21 and 5.1.9 changelogs. Closed.