Skip to content
Snippets Groups Projects
Commit 1098046f authored by Alex Reisner's avatar Alex Reisner
Browse files

Merge pull request #637 from jzelenkov/fix-postgres-oid

[2nd try] fixes postgres "unknown OID" warnings
parents 8c066874 1fe561fa
No related branches found
No related tags found
No related merge requests found
......@@ -196,11 +196,19 @@ module Geocoder::Store
end
if distance
clause += ", " unless clause.empty?
clause += "#{distance} AS #{distance_column}"
if using_postgresql?
clause += "'#{distance}'::character(255) AS #{distance_column}"
else
clause += "#{distance} AS #{distance_column}"
end
end
if bearing
clause += ", " unless clause.empty?
clause += "#{bearing} AS #{bearing_column}"
if using_postgresql?
clause += "'#{bearing}'::character(255) AS #{bearing_column}"
else
clause += "#{bearing} AS #{bearing_column}"
end
end
clause
end
......@@ -222,6 +230,10 @@ module Geocoder::Store
connection.adapter_name.match(/sqlite/i)
end
def using_postgresql?
connection.adapter_name.match(/postgres/i)
end
##
# Value which can be passed to where() to produce no results.
#
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment