Особенность сравнения даты в БД GAE

Наткнулся на багу в своем приложении. При разборе выяснил, что (null < datetime) is True, а не как я предполагал - False.

Мне стало интересно: почему я предположил, что должен получить False, ведь никогда не сталкивался. Решил проверить как поведут себя другие БД. В итоге я получил False (как и ожидал) в PostgreSQL и MySQL.

Google Appengine

>>> from datetime import datetime
>>> from google.appengine.ext import db
>>> class TestDateCompare(db.Model):
...     title = db.StringProperty(required=True)
...     dt = db.DateTimeProperty()
...
>>> tdc = TestDateCompare(title='with date 1', dt=datetime.now())
>>> tdc.put()
 datastore_types.Key.from_path(u'TestDateCompare', 1087011L, _app=u'con')
>>> tdc = TestDateCompare(title='without date', dt=None)
>>> tdc.put()
 datastore_types.Key.from_path(u'TestDateCompare', 1094005L, _app=u'con')
>>> tdc = TestDateCompare(title='with date 2', dt=datetime.now())
>>> tdc.put()
 datastore_types.Key.from_path(u'TestDateCompare', 1094006L, _app=u'con')
>>> [tdc.title for tdc in TestDateCompare.all()]
 [u'with date 1', u'without date', u'with date 2']
>>> [tdc.title for tdc in TestDateCompare.all().filter('dt <', datetime.now())]
 [u'without date', u'with date 1', u'with date 2']

PostgreSQL

test=# CREATE TABLE test_date_compare(id serial NOT NULL, title varchar(20) NOT NULL, dt timestamp);
NOTICE:  CREATE TABLE will create implicit sequence "test_date_compare_id_seq" for serial column "test_date_compare.id"
CREATE TABLE
test=# INSERT INTO test_date_compare(title, dt) VALUES('with date 1', NOW());
INSERT 0 1
test=# INSERT INTO test_date_compare(title, dt) VALUES('without date', NULL);
INSERT 0 1
test=# INSERT INTO test_date_compare(title, dt) VALUES('with date 2', NOW());
INSERT 0 1
test=# SELECT * FROM test_date_compare;
 id |    title     |             dt
----+--------------+----------------------------
  1 | with date 1  | 2011-07-05 09:31:49.831577
  2 | without date |
  3 | with date 2  | 2011-07-05 09:32:07.261631
(3 rows)

test=# SELECT * FROM test_date_compare WHERE dt < NOW();
 id |    title    |             dt
----+-------------+----------------------------
  1 | with date 1 | 2011-07-05 09:31:49.831577
  3 | with date 2 | 2011-07-05 09:32:07.261631
(2 rows)

MySQL

mysql> CREATE TABLE test_date_compare(id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(20) not null, dt DATETIME);
Query OK, 0 rows affected (0.05 sec)

mysql> INSERT INTO test_date_compare(title, dt) VALUES('with date 1', NOW());
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO test_date_compare(title, dt) VALUES('without date', NULL);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO test_date_compare(title, dt) VALUES('with date 2', NOW());
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM test_date_compare;
+----+--------------+---------------------+
| id | title        | dt                  |
+----+--------------+---------------------+
|  1 | with date 1  | 2011-07-05 05:55:14 |
|  2 | without date | NULL                |
|  3 | with date 2  | 2011-07-05 05:55:30 |
+----+--------------+---------------------+
3 rows in set (0.00 sec)

mysql> SELECT * FROM test_date_compare WHERE dt < NOW();
+----+-------------+---------------------+
| id | title       | dt                  |
+----+-------------+---------------------+
|  1 | with date 1 | 2011-07-05 05:55:14 |
|  3 | with date 2 | 2011-07-05 05:55:30 |
+----+-------------+---------------------+
2 rows in set (0.00 sec)