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

Merge pull request #628 from jzelenkov/fix-postresql-oid

fixes postgres "unknown OID" warnings
parents c5c45940 a3b07dfc
No related branches found
No related tags found
No related merge requests found
...@@ -194,13 +194,16 @@ module Geocoder::Store ...@@ -194,13 +194,16 @@ module Geocoder::Store
else else
clause = (columns || full_column_name("*")) clause = (columns || full_column_name("*"))
end end
identifierType = using_postgresql? ? "::character(255)" : ""
if distance if distance
clause += ", " unless clause.empty? clause += ", " unless clause.empty?
clause += "#{distance} AS #{distance_column}" clause += "'#{distance}'#{identifierType} AS #{distance_column}"
end end
if bearing if bearing
clause += ", " unless clause.empty? clause += ", " unless clause.empty?
clause += "#{bearing} AS #{bearing_column}" clause += "'#{bearing}'#{identifierType} AS #{bearing_column}"
end end
clause clause
end end
...@@ -222,6 +225,11 @@ module Geocoder::Store ...@@ -222,6 +225,11 @@ module Geocoder::Store
connection.adapter_name.match(/sqlite/i) connection.adapter_name.match(/sqlite/i)
end end
def using_postgresql?
connection.adapter_name.match(/postgres/i)
end
## ##
# Value which can be passed to where() to produce no results. # 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