Fixed #21146 - DatabaseCache converts expires to python value

DatabaseCache uses raw cursors to bypass the ORM. This prevents it from
being used by database backends that require special handling of datetime
values.

There is no easy way to test this, so no tests added.
Enforce ordering on PostgreSQL get_constraints cols (refs #21134)