title: Time/datetime Comparison in PostgreSQL (Heroku)
body: <p>I'm building an app for Heroku (Postgres) but for various reasons, developing it locally using MySQL. I've hit a roadblock concerning something that my MySQL dev environment takes with no trouble but that the heroku Postgres environment hangs up on. Here is the log stream from Heroku:</p>
  
  <pre><code>2012-02-07T10:00:00+00:00 app[web.1]: Report Load (2.5ms)  SELECT id, datetime_utc FROM "reports" WHERE (datetime_utc = '2012-02-07 10:00:00.000000') AND (datetime_utc &gt; spot_sunrise_utc AND datetime_utc &gt; spot_sunset_utc) ORDER BY datetime_utc ASC LIMIT 500
  2012-02-07T10:00:00+00:00 app[web.1]: PGError: ERROR:  operator does not exist: timestamp without time zone &gt; time without time zone
  2012-02-07T10:00:00+00:00 app[web.1]: LINE 1: ...EEN 0.4573170731707317 and 200) AND (datetime_utc &gt; spot_sun...
  2012-02-07T10:00:00+00:00 app[web.1]:                                                              ^
  2012-02-07T10:00:00+00:00 app[web.1]: HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
  </code></pre>
  
  <p>The <code>datetime_utc</code> field is a real <code>datetime</code> whereas the <code>spot_sunrise</code>/<code>sunset_utc</code> fields are just time values. </p>
  
  <p>What is causing this, and how do I work around it?</p>