Closed MangTomas23 closed 8 years ago
Having similar issue:
SQLSTATE[42883]: Undefined function: 7 ERROR: function lower(numeric) does not exist LINE 1: ...iption) ILIKE $6 then 10 else 0 end) + (case when LOWER(prod... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. (SQL: select count() as aggregate from (select "products"., max((case when LOWER(products.product_code) ILIKE chicken then 75 else 0 end) + (case when LOWER(products.product_code) ILIKE chicken% then 25 else 0 end) + (case when LOWER(products.product_code) ILIKE %chicken% then 5 else 0 end) + (case when LOWER(products.description) ILIKE chicken then 150 else 0 end) + (case when LOWER(products.description) ILIKE chicken% then 50 else 0 end) + (case when LOWER(products.description) ILIKE %chicken% then 10 else 0 end) + (case when LOWER(products.price) ILIKE chicken then 225 else 0 end) + (case when LOWER(products.price) ILIKE chicken% then 75 else 0 end) + (case when LOWER(products.price) ILIKE %chicken% then 15 else 0 end)) as relevance from "products" group by "products"."product_code" having (case when LOWER(products.product_code) ILIKE chicken then 75 else 0 end) + (case when LOWER(products.product_code) ILIKE chicken% then 25 else 0 end) + (case when LOWER(products.product_code) ILIKE %chicken% then 5 else 0 end) + (case when LOWER(products.description) ILIKE chicken then 150 else 0 end) + (case when LOWER(products.description) ILIKE chicken% then 50 else 0 end) + (case when LOWER(products.description) ILIKE %chicken% then 10 else 0 end) + (case when LOWER(products.price) ILIKE chicken then 225 else 0 end) + (case when LOWER(products.price) ILIKE chicken% then 75 else 0 end) + (case when LOWER(products.price) ILIKE %chicken% then 15 else 0 end) >= 7.50 order by "relevance" desc) as products)
SQLSTATE[42803]: Grouping error: 7 ERROR: column "products.description" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select count() as aggregate from (select "products"., max(... ^ (SQL: select count() as aggregate from (select "products"., max((case when LOWER(products.product_code) ILIKE chicken then 75 else 0 end) + (case when LOWER(products.product_code) ILIKE chicken% then 25 else 0 end) + (case when LOWER(products.product_code) ILIKE %chicken% then 5 else 0 end) + (case when LOWER(products.description) ILIKE chicken then 150 else 0 end) + (case when LOWER(products.description) ILIKE chicken% then 50 else 0 end) + (case when LOWER(products.description) ILIKE %chicken% then 10 else 0 end) + (case when LOWER(products.price) ILIKE chicken then 225 else 0 end) + (case when LOWER(products.price) ILIKE chicken% then 75 else 0 end) + (case when LOWER(products.price) ILIKE %chicken% then 15 else 0 end)) as relevance from "products" group by "products"."product_code" having (case when LOWER(products.product_code) ILIKE chicken then 75 else 0 end) + (case when LOWER(products.product_code) ILIKE chicken% then 25 else 0 end) + (case when LOWER(products.product_code) ILIKE %chicken% then 5 else 0 end) + (case when LOWER(products.description) ILIKE chicken then 150 else 0 end) + (case when LOWER(products.description) ILIKE chicken% then 50 else 0 end) + (case when LOWER(products.description) ILIKE %chicken% then 10 else 0 end) + (case when LOWER(products.price) ILIKE chicken then 225 else 0 end) + (case when LOWER(products.price) ILIKE chicken% then 75 else 0 end) + (case when LOWER(products.price) ILIKE %chicken% then 15 else 0 end) >= 7.50 order by "relevance" desc) as products where "product_code" in (152, 1442, 1818, 265597))
Hey, add constraint primary key id column on products table
It works really fine on mySQL but when I run it on Heroku that is using pgSQL it returns a
QueryException