» tagged pages
» logout

(Feed found, click Add Page to syndicate.) Error finding feed, please try again » Find feed title

A Blog Page allows you to add entries, for news or other time sensitive postings

(Login required to save to your tagged pages.)
(or Cancel)

Make further edits, (or Cancel)

(Login required to save to your tagged pages.)
(or Cancel)

(Editing anonymously: to be credited for your changes, login or register a new account)

Change Page Permissions? Changing these permissions will adjust who can modify this page.

Anonymous (change)
(change)
(or Cancel)
Upload an image from your computer:
or Copy an image from a URL:
or Erase the current icon:
Icon Preview:

or Cancel

Erase bugfixes? The contents of bugfixes page and all pages directly attached to bugfixes will be erased.

or Cancel

(Editing anonymously: to be credited for your changes, login or register a new account)

other page actions:
bugfixes

bugfixes

Tags Applied to bugfixes

No one has tagged this page.

bugfixes Wiki Pages

What is bugfixes? Edit this page and describe it here.

sorted by: recent | see : popular
Content Tagged bugfixes

Bugfix: DATE vs DATETIME comparisons are now sargable again

We (me coding, Igor and Evgen reviewing) have fixed BUG#32198. According to Support/Bugs team, the bug was causing pain to a number of people, so I thought it deserved a post. The problem was as follows:

  • Before MySQL 5.0.42, comparisons in form
      date_column CMP datetime_const

    were interpreted as comparisons of DATEs (CMP is one of =, <, > , <=, or >=). The time part of datetime_const was ignored.

  • In 5.0.42 we've fixed it to perform in a way that is closer to the SQL standard: the comparisons are now resolved by comparing values as DATETIMEs. Our fault was that "date_column CMP datetime_const" stopped being sargable. It turned out there quite a few people who had queries like
      SELECT ... WHERE date_column < NOW() ... 

    and those queries became awfully slow.

  • In 5.0.54, We've fixed BUG#32198 and made "date_column CMP datetime_const" sargable again. Apologies to everyone who was affected.

What keeps me concerned is that both old and new interpretation of DATE/DATETIME comparisons are not compatible with PostgreSQL. PostgreSQL does something strange: comparison of DATE column with DATETIME constant is interpreted as DATETIME comparison, while comparison with NOW() seems to be interpreted as comparison of DATEs:

MySQL PostgreSQL
mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2007-12-16 18:24:12 |
+---------------------+
1 row in set (0.01 sec)
test=# select now();
              now
-------------------------------
 2007-12-16 18:23:47.197907+03
(1 row)

OK

mysql> select a from tbl where date_col=now();
Empty set (0.02 sec)
test=# select a from tbl where date_col=now();
 a
---
(0 rows)

OK

mysql> select a from tbl
    -> where date_col='2007-12-16 18:24:12';
Empty set (0.00 sec)
test=# select a from tbl
test-# where date_col='2007-12-16 18:24:12';
     a
------------
 2007-12-16
(1 row)

bummer. Why is explicitly specified DATETIME value handled differently from NOW()?

I don't know what is the logic behind this (or is this a bug in PostgreSQL?) If you do, please let me know.

In my SQL code, I think I'm going to play it safe and always explicitly cast to either DATE or DATETIME.

MySQL: Planet MySQL

Windows download link fixed

For all of you, windows users, who found the sad 404 page
Please, try again…

Shoka: News

Shoka Java Web Start problem on jre 6.0 fixed

Running from jws,  jre 5.0 was required and now it’s fixed to support 5.0 or greater.If you experienced proplem running shoka via jws with jre 6.0, please try again.

thanks to Thermopyle ( more )

Shoka: News

Page 1 | Next >>
Username:
Password:
(or Cancel)