jeremyevans/sequel — Issue #450: prepared statement rounds Time parameter value down to second
Author: olek
Created: 2012-03-09 02:00:52+00:00
State: open

When used with PostgreSQL, normal generated query SQL contains Time information with microseconds.

Switching to prepared statements, time information is rounded to a second (and overall, time string sent to DB looks like just output of the .to_s method).

For now, I am working around this issue by binding variable to 'dataset.literal(some_time)' instead of 'some_time'.

Here are 2 log lines for same query, one plain, one prepared:

UPDATE "alert_subscriptions" SET "locked_by" = '75584', "locked_at" = '2012-03-08 20:52:04.162872-0500' WHERE (("locked_by" IS NULL) OR (locked_at < '2012-03-08 18:52:04.162872-0500'))

EXECUTE lock_all_available_subscriptions; ["75584", 2012-03-08 20:52:04 -0500, 2012-03-08 18:52:04 -0500]