Permalink
Browse files

Use the floor rounding for PostgreSQL timestamps.

  • Loading branch information...
pat committed Jun 8, 2012
1 parent ceb0bc8 commit 07c2c29a1066eb1f9875f2e961be21f76cd02693
Showing with 6 additions and 2 deletions.
  1. +4 −0 HISTORY
  2. +2 −2 lib/thinking_sphinx/adapters/postgresql_adapter.rb
View
@@ -1,3 +1,7 @@
Edge:
* Cast PostgreSQL timestamps to their floored integers (instead of rounding up).
* Don't add array_accum to PostgreSQL v80311 (8.3.?) or newer.
1.4.12 - May 14th 2012
* Updating Riddle references to 1.5.2.
* Can explicitly specify available types for STI tables instead of automatically discovering them with "SELECT DISTINCT type FROM <table>" (Cedric Maion).
@@ -33,9 +33,9 @@ def cast_to_string(clause)
def cast_to_datetime(clause)
if ThinkingSphinx::Configuration.instance.use_64_bit
"cast(extract(epoch from #{clause}) as bigint)"
"cast(floor(extract(epoch from #{clause})) as bigint)"
else
"cast(extract(epoch from #{clause}) as int)"
"cast(floor(extract(epoch from #{clause})) as int)"
end
end

0 comments on commit 07c2c29

Please sign in to comment.