0

I have two models: Country and Resort. Resort has field point with type "point". Model Country has_many Resorts. When i get countries resorts with kaminari( .page(params[:page]).per(20) ) i have an error:

PG::UndefinedFunction: ERROR:  could not identify an equality operator for type point
LINE 1: SELECT  DISTINCT "resorts".* FROM "resorts" INNER JOIN "coun...
                         ^
: SELECT  DISTINCT "resorts".* FROM "resorts" INNER JOIN "country_resorts" ON "resorts"."id" = "country_resorts"."resort_id" WHERE "country_resorts"."country_id" = $1 AND "country_resorts"."what" = $2 LIMIT 20 OFFSET 0
PG::UndefinedFunction: ERROR:  could not identify an equality operator for type point
LINE 1: SELECT  DISTINCT "resorts".* FROM "resorts" INNER JOIN "coun...

If i get resorts without kaminari i get normal result.

How i can resolve this issue?

emi
  • 2,830
  • 5
  • 31
  • 53
KriM
  • 1
  • 1
  • http://stackoverflow.com/questions/23509740/distinct-on-postgresql-json-data-column and http://stackoverflow.com/questions/2532190/postgres-error-when-using-distinct-postgres-error-could-not-identify-an-order – Athar Aug 30 '15 at 19:15
  • I try to add .select("DISTINCT ON (resorts.id) resorts.*"), but i get sql query like this: "DISTINCT DISTINCT ON (resorts.id) resorts.*", so i try .select("ON (resorts.id) resorts.*") and it's work. Realy i need to add this select to all such queries? In mysql i hadn't got such problem. – KriM Aug 30 '15 at 19:20
  • im so sorry i don't really use `pg`, so cant really help much. i just google for error to help you in case i found something and just added the links. :( – Athar Aug 30 '15 at 19:28

0 Answers0